[Kstars-devel] KDE/kdeedu/kstars/kstars
Jason Harris
kstars at 30doradus.org
Wed Jun 7 07:37:57 CEST 2006
SVN commit 549013 by harris:
Fix bug causing large lag in Full updates.
The problem was that I was recreating an Earth object inside the loop
over all copmets and asteroids, even though the Component itself
contains the Earth object. Fixing this caused the timing for
SkyMapComposite::updatePlanets() to go from 1.4 seconds to 0.03
seconds!!
I also fixed some other minor issues in skycomponents.
Note: I have committed the TIMING code that I had earlier sent to the
list as patches, so we can continue to use this information for
profiling.
CCMAIL: kstars-devel at kde.org
M +3 -3 kstars.cpp
M +7 -7 kstars.h
M +27 -0 kstarsdata.cpp
M +1 -1 skycomponents/singlecomponent.cpp
M +25 -2 skycomponents/skymapcomposite.cpp
M +2 -0 skycomponents/skymapcomposite.h
M +3 -1 skycomponents/solarsystemcomposite.cpp
M +1 -3 skycomponents/solarsystemlistcomponent.cpp
M +18 -5 skymapevents.cpp
--- trunk/KDE/kdeedu/kstars/kstars/kstars.cpp #549012:549013
@@ -238,11 +238,11 @@
}
}
-KStarsData* KStars::data( void ) { return kstarsData; }
+KStarsData* KStars::data() { return kstarsData; }
-SkyMap* KStars::map( void ) { return skymap; }
+SkyMap* KStars::map() { return skymap; }
-InfoBoxes* KStars::infoBoxes( void ) { return map()->infoBoxes(); }
+InfoBoxes* KStars::infoBoxes() { return map()->infoBoxes(); }
GeoLocation* KStars::geo() { return data()->geo(); }
--- trunk/KDE/kdeedu/kstars/kstars/kstars.h #549012:549013
@@ -110,11 +110,11 @@
/**@return pointer to the INDI driver
*/
- INDIDriver* getINDIDriver(void) { return indidriver; }
+ INDIDriver* getINDIDriver() { return indidriver; }
/**@return pointer to the INDI menu
*/
- INDIMenu* getINDIMenu(void) { return indimenu; }
+ INDIMenu* getINDIMenu() { return indimenu; }
/** Establish the INDI system. No GUI
*/
@@ -152,13 +152,13 @@
ASYNC lookTowards( const QString &direction );
/**DCOP interface function. Zoom in one step. */
- ASYNC zoomIn(void) { slotZoomIn(); };
+ ASYNC zoomIn() { slotZoomIn(); };
/**DCOP interface function. Zoom out one step. */
- ASYNC zoomOut(void){ slotZoomOut(); };
+ ASYNC zoomOut(){ slotZoomOut(); };
/**DCOP interface function. reset to the default zoom level. */
- ASYNC defaultZoom(void) { slotDefaultZoom(); }
+ ASYNC defaultZoom() { slotDefaultZoom(); }
/**DCOP interface function. Set zoom level to specified value.
*@param z the zoom level. Units are pixels per radian.
@@ -383,7 +383,7 @@
/**
*Apply new settings and redraw skymap
*/
- void slotApplyConfigChanges( void );
+ void slotApplyConfigChanges();
/**
*action slot: Zoom in one step
@@ -424,7 +424,7 @@
/**
*Resume execution of DCOP commands
*/
- void resumeDCOP( void ) { kapp->dcopClient()->resume(); }
+ void resumeDCOP() { kapp->dcopClient()->resume(); }
/**
*Remove all trails which may have been added to solar system bodies
--- trunk/KDE/kdeedu/kstars/kstars/kstarsdata.cpp #549012:549013
@@ -270,31 +270,58 @@
KSNumbers num( ut().djd() );
+ //TIMING
+ QTime t;
+
if ( fabs( ut().djd() - LastNumUpdate.djd() ) > 1.0 ) {
LastNumUpdate = ut().djd();
+ //TIMING
+ t.start();
+
skyComposite()->update( this, &num );
+
+ //TIMING
+ kDebug() << QString("SkyMapComposite::update() took %1 ms").arg(t.elapsed()) << endl;
}
if ( fabs( ut().djd() - LastPlanetUpdate.djd() ) > 0.01 ) {
LastPlanetUpdate = ut().djd();
+ //TIMING
+ t.start();
+
skyComposite()->updatePlanets( this, &num );
+
+ //TIMING
+ kDebug() << QString("SkyMapComposite::updatePlanets() took %1 ms").arg(t.elapsed()) << endl;
}
// Moon moves ~30 arcmin/hr, so update its position every minute.
if ( fabs( ut().djd() - LastMoonUpdate.djd() ) > 0.00069444 ) {
LastMoonUpdate = ut();
+ //TIMING
+ t.start();
+
skyComposite()->updateMoons( this, &num );
+
+ //TIMING
+ kDebug() << QString("SkyMapComposite::updateMoons() took %1 ms").arg(t.elapsed()) << endl;
}
//Update Alt/Az coordinates. Timescale varies with zoom level
//If Clock is in Manual Mode, always update. (?)
if ( fabs( ut().djd() - LastSkyUpdate.djd() ) > 0.25/Options::zoomFactor() || clock()->isManualMode() ) {
LastSkyUpdate = ut();
+ //TIMING
+ t.start();
+
skyComposite()->update( this ); //omit KSNumbers arg == just update Alt/Az coords
//Update focus
skymap->updateFocus();
+ //TIMING
+ kDebug() << QString("SkyMapComposite::update() for Alt/Az took %1 ms").arg(t.elapsed()) << endl;
+
if ( clock()->isManualMode() )
QTimer::singleShot( 0, skymap, SLOT( forceUpdateNow() ) );
else skymap->forceUpdate();
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/singlecomponent.cpp #549012:549013
@@ -45,7 +45,7 @@
void SingleComponent::update( KStarsData *data, KSNumbers *num )
{
if ( visible() ) {
- if ( num ) skyObject()->updateCoords( num, data->geo()->lat(), data->lst() );
+ if ( num ) skyObject()->updateCoords( num );
skyObject()->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
}
}
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.cpp #549012:549013
@@ -82,10 +82,33 @@
data, SIGNAL( progressText( const QString & ) ) );
}
+void SkyMapComposite::update(KStarsData *data, KSNumbers *num )
+{
+ //1. Milky Way
+ m_MilkyWay->update( data, num );
+ //2. Coordinate grid
+ m_CoordinateGrid->update( data, num );
+ //3. Constellation boundaries
+ m_CBounds->update( data, num );
+ //4. Constellation lines
+ m_CLines->update( data, num );
+ //5. Constellation names
+ m_CNames->update( data, num );
+ //6. Equator
+ m_Equator->update( data, num );
+ //7. Ecliptic
+ m_Ecliptic->update( data, num );
+ //8. Deep sky
+ m_DeepSky->update( data, num );
+ //9. Custom catalogs
+ m_CustomCatalogs->update( data, num );
+ //10. Stars
+ m_Stars->update( data, num );
+}
+
void SkyMapComposite::updatePlanets(KStarsData *data, KSNumbers *num )
{
- foreach (SkyComponent *component, solarSystem())
- component->updatePlanets( data, num );
+ m_SolarSystem->updatePlanets( data, num );
}
void SkyMapComposite::updateMoons(KStarsData *data, KSNumbers *num )
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.h #549012:549013
@@ -78,6 +78,8 @@
*/
SkyMapComposite(SkyComponent *parent, KStarsData *data);
+ virtual void update( KStarsData *data, KSNumbers *num=0 );
+
/**
*@short Delegate planet position updates to the SolarSystemComposite
*
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/solarsystemcomposite.cpp #549012:549013
@@ -79,7 +79,9 @@
void SolarSystemComposite::updatePlanets( KStarsData *data, KSNumbers *num )
{
m_Earth->findPosition( num );
- SkyComposite::updatePlanets( data, num );
+ foreach ( SkyComponent *comp, components() ) {
+ comp->updatePlanets( data, num );
+ }
}
void SolarSystemComposite::updateMoons( KStarsData *data, KSNumbers *num )
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/solarsystemlistcomponent.cpp #549012:549013
@@ -45,9 +45,7 @@
if ( visible() ) {
foreach ( SkyObject *o, objectList() ) {
KSPlanetBase *p = (KSPlanetBase*)o;
- KSPlanet Earth( data, I18N_NOOP( "Earth" ) );
- Earth.findPosition( num );
- p->findPosition( num, data->geo()->lat(), data->lst(), &Earth );
+ p->findPosition( num, data->geo()->lat(), data->lst(), earth() );
p->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
if ( p->hasTrail() )
--- trunk/KDE/kdeedu/kstars/kstars/skymapevents.cpp #549012:549013
@@ -267,7 +267,7 @@
kapp->processEvents();
break;
- case Qt::Key_C: //Center clicked object object
+ case Qt::Key_C: //Center clicked object
if ( clickedObject() ) slotCenter();
break;
@@ -308,12 +308,18 @@
}
break;
-
-
//TIMING
// *** Uncomment and insert timing test code here ***
-// case Qt::Key_X:
-// break;
+ case Qt::Key_X:
+ {
+ //ks->updateTime() timing
+ QTime t;
+ t.start();
+ data->setFullTimeUpdate();
+ ks->updateTime();
+ kDebug() << QString("X: Full update took %1 ms").arg(t.elapsed()) << endl;
+ break;
+ }
//END_TIMING
}
@@ -674,6 +680,10 @@
return ; // exit because the pixmap is repainted and that's all what we want
}
+ //TIMING
+ QTime t;
+ t.start();
+
QPainter psky;
setMapGeometry();
@@ -715,5 +725,8 @@
psky2.end();
computeSkymap = false; // use forceUpdate() to compute new skymap else old pixmap will be shown
+
+ //TIMING
+ kDebug() << QString("Skymap draw took %1 ms").arg(t.elapsed()) << endl;
}
More information about the Kstars-devel
mailing list