[Kstars-devel] branches/kstars/summer/kdeedu/kstars/kstars
Akarsh Simha
akarshsimha at gmail.com
Sat Jun 21 05:05:32 CEST 2008
SVN commit 822677 by asimha:
Adding functionality to optionally go into frugal and very-frugal
memory management modes. These modes are very buggy, but give an idea
of the excess time taken to read the harddisk.
CCMAIL: kstars-devel at kde.org
M +1 -1 skycomponents/starblockfactory.cpp
M +9 -0 skycomponents/starcomponent.cpp
M +4 -0 skycomponents/starcomponent.h
M +20 -4 skymapevents.cpp
--- branches/kstars/summer/kdeedu/kstars/kstars/skycomponents/starblockfactory.cpp #822676:822677
@@ -266,7 +266,7 @@
StarBlock *temp;
i = 0;
- while( last != NULL && last->drawID == drawID && i != nBlocks ) {
+ while( last != NULL && last->drawID < drawID && i != nBlocks ) {
temp = last->prev;
delete last;
last = temp;
--- branches/kstars/summer/kdeedu/kstars/kstars/skycomponents/starcomponent.cpp #822676:822677
@@ -42,6 +42,8 @@
BinFileHelper StarComponent::deepStarReader;
StarBlockFactory StarComponent::m_StarBlockFactory;
+bool StarComponent::frugalMem = false;
+bool StarComponent::veryFrugalMem = false;
StarComponent::StarComponent(SkyComponent *parent )
: ListComponent(parent), m_reindexNum(J2000), m_FaintMagnitude(-5.0), starsLoaded(false)
@@ -252,6 +254,10 @@
t.start();
float fake_maglim = ( ( maglim > 13.0 ) ? 13.0 : maglim );
+
+ if( veryFrugalMem )
+ m_StarBlockFactory.freeAll();
+
while ( region.hasNext() ) {
++nTrixels;
Trixel currentRegion = region.next();
@@ -357,7 +363,10 @@
t_drawUnnamed += t.restart();
}
+ if( frugalMem )
+ m_StarBlockFactory.freeUnused();
+
}
void StarComponent::addLabel( const QPointF& p, StarObject *star )
--- branches/kstars/summer/kdeedu/kstars/kstars/skycomponents/starcomponent.h #822676:822677
@@ -148,6 +148,9 @@
static StarBlockFactory m_StarBlockFactory;
static BinFileHelper deepStarReader;
+ static bool frugalMem;
+ static bool veryFrugalMem;
+
private:
SkyMesh* m_skyMesh;
StarIndex* m_starIndex;
@@ -172,6 +175,7 @@
KStarsSplash* m_reloadSplash;
KStarsSplash* m_reindexSplash;
+
// Time keeping variables
long unsigned t_drawNamed;
long unsigned t_dynamicLoad;
--- branches/kstars/summer/kdeedu/kstars/kstars/skymapevents.cpp #822676:822677
@@ -420,18 +420,34 @@
<< sl.point(1)->ra()->toHMSString() << endl;
break;
**/
- case Qt::Key_B: // print useful debug info about memory allocation for stars
+ case Qt::Key_B: // print useful debug info about memory allocation for stars
data->skyComposite()->getStarComponent()->printDebugInfo();
break;
- case Qt::Key_F: // verify the integrity of StarBlockLists
+ case Qt::Key_F: // verify the integrity of StarBlockLists
data->skyComposite()->getStarComponent()->verifySBLIntegrity();
break;
- case Qt::Key_G: // print Cache structure
+ case Qt::Key_G: // print Cache structure
StarComponent::m_StarBlockFactory.printStructure();
break;
+ case Qt::Key_H: { // Frugal memory mode
+ StarComponent::veryFrugalMem = false;
+ if( StarComponent::frugalMem = !(StarComponent::frugalMem) )
+ kDebug() << "Switched to frugal memory mode";
+ else
+ kDebug() << "Switched to generous memory mode";
+ break;
+ }
+ case Qt::Key_I: { // Very frugal memory mode
+ StarComponent::frugalMem = false;
+ if( StarComponent::veryFrugalMem = !(StarComponent::veryFrugalMem) )
+ kDebug() << "Switched to very frugal memory mode";
+ else
+ kDebug() << "Switched to generous memory mode";
+
+ break;
+ }
-
}
setOldFocus( focus() );
More information about the Kstars-devel
mailing list