[Kst] extragear/graphics/kst/kst
George Staikos
staikos at kde.org
Tue Oct 25 16:52:24 CEST 2005
SVN commit 474118 by staikos:
this is as good as we can get here. The last problem is lock contention.
M +37 -45 kstdatamanager_i.cpp
--- trunk/extragear/graphics/kst/kst/kstdatamanager_i.cpp #474117:474118
@@ -254,10 +254,12 @@
}
if (recursive) {
QPtrStack<QListViewItem> trash;
+ KstVectorMap vl = x->outputVectors();
+ KstVectorMap::Iterator vlEnd = vl.end();
for (QListViewItem *i = firstChild(); i; i = i->nextSibling()) {
KstObjectItem *oi = static_cast<KstObjectItem*>(i);
- if (x->outputVectors().findTag(oi->tagName()) == x->outputVectors().end()) {
+ if (vl.findTag(oi->tagName()) == vlEnd) {
trash.push(i);
}
}
@@ -265,12 +267,12 @@
trash.clear();
// get the output vectors
- for (KstVectorMap::Iterator p = x->outputVectors().begin();
- p != x->outputVectors().end(); ++p) {
+ for (KstVectorMap::Iterator p = vl.begin(); p != vlEnd; ++p) {
bool found = false;
+ QString tn = p.data()->tagName();
for (QListViewItem *i = firstChild(); i; i = i->nextSibling()) {
KstObjectItem *oi = static_cast<KstObjectItem*>(i);
- if (oi->tagName() == p.data()->tagName()) {
+ if (oi->tagName() == tn) {
oi->update();
found = true;
break;
@@ -282,12 +284,15 @@
}
}
+ KstMatrixMap ml = x->outputMatrices();
+ KstMatrixMap::Iterator mlEnd = ml.end();
// also get the output matrices
- for (KstMatrixMap::Iterator p = x->outputMatrices().begin(); p != x->outputMatrices().end(); ++p) {
+ for (KstMatrixMap::Iterator p = ml.begin(); p != mlEnd; ++p) {
bool found = false;
+ QString tn = p.data()->tagName();
for (QListViewItem *i = firstChild(); i; i = i->nextSibling()) {
KstObjectItem *oi = static_cast<KstObjectItem*>(i);
- if (oi->tagName() == p.data()->tagName()) {
+ if (oi->tagName() == tn) {
oi->update();
found = true;
break;
@@ -315,10 +320,16 @@
_inUse = inUse;
setPixmap(2, inUse ? _dm->yesPixmap() : QPixmap());
}
- setText(3, QString::number(x->sampleCount()));
- setText(4, i18n("%1: %2 (%3 by %4)").arg(x->filename()).arg(x->field())
+ QString field = QString::number(x->sampleCount());
+ if (text(3) != field) {
+ setText(3, field);
+ }
+ field = i18n("%1: %2 (%3 by %4)").arg(x->filename()).arg(x->field())
.arg(x->xNumSteps())
- .arg(x->yNumSteps()));
+ .arg(x->yNumSteps());
+ if (text(4) != field) {
+ setText(4, field);
+ }
_removable = x->getUsage() == 2;
x->readUnlock();
}
@@ -335,8 +346,14 @@
_inUse = inUse;
setPixmap(2, inUse ? _dm->yesPixmap() : QPixmap());
}
- setText(3, QString::number(x->sampleCount()));
- setText(4, i18n("%1 to %2").arg(x->gradZMin()).arg(x->gradZMax()));
+ QString field = QString::number(x->sampleCount());
+ if (text(3) != field) {
+ setText(3, field);
+ }
+ field = i18n("%1 to %2").arg(x->gradZMin()).arg(x->gradZMax());
+ if (text(4) != field) {
+ setText(4, field);
+ }
_removable = x->getUsage() == 2;
x->readUnlock();
}
@@ -354,8 +371,14 @@
_inUse = inUse;
setPixmap(2, inUse ? _dm->yesPixmap() : QPixmap());
}
- setText(3, QString::number(x->sampleCount()));
- setText(4, i18n("[%1..%2]").arg(x->minValue()).arg(x->maxValue()));
+ QString field = QString::number(x->sampleCount());
+ if (text(3) != field) {
+ setText(3, field);
+ }
+ field = i18n("[%1..%2]").arg(x->minValue()).arg(x->maxValue());
+ if (text(4) != field) {
+ setText(4, field);
+ }
x->readUnlock();
_removable = false;
}
@@ -446,7 +469,7 @@
}
break;
}
- cnt++;
+ ++cnt;
}
}
@@ -569,10 +592,6 @@
return;
}
-#ifdef BENCHMARK
- QTime t;
- t.start();
-#endif
QListViewItem *currentItem = DataView->selectedItem();
QPtrStack<QListViewItem> trash;
@@ -580,9 +599,6 @@
KST::vectorList.lock().writeLock();
KST::matrixList.lock().writeLock();
-#ifdef BENCHMARK
- kstdDebug() << "-------- data manager setup: " << t.elapsed() << endl;
-#endif
// garbage collect first
for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) {
KstObjectItem *oi = static_cast<KstObjectItem*>(i);
@@ -602,17 +618,11 @@
}
}
}
-#ifdef BENCHMARK
- kstdDebug() << "-------- data manager garbage collect: " << t.elapsed() << endl;
-#endif
trash.setAutoDelete(true);
DataView->blockSignals(true);
trash.clear();
DataView->blockSignals(false);
-#ifdef BENCHMARK
- kstdDebug() << "-------- data manager empty trash: " << t.elapsed() << endl;
-#endif
// update the data objects
for (KstDataObjectList::iterator it = KST::dataObjectList.begin();
@@ -633,9 +643,6 @@
}
}
-#ifdef BENCHMARK
- kstdDebug() << "-------- data manager update objects: " << t.elapsed() << endl;
-#endif
KST::matrixList.lock().writeUnlock();
KST::vectorList.lock().writeUnlock();
KST::dataObjectList.lock().writeUnlock();
@@ -657,9 +664,6 @@
connect(i, SIGNAL(updated()), this, SLOT(doUpdates()));
}
}
-#ifdef BENCHMARK
- kstdDebug() << "-------- data manager update data vectors: " << t.elapsed() << endl;
-#endif
// update the static vectors
KstSVectorList svl = kstObjectSubList<KstVector,KstSVector>(KST::vectorList);
@@ -678,9 +682,6 @@
connect(i, SIGNAL(updated()), this, SLOT(doUpdates()));
}
}
-#ifdef BENCHMARK
- kstdDebug() << "-------- data manager update static vectors: " << t.elapsed() << endl;
-#endif
// update the data matrices
KstRMatrixList rml = kstObjectSubList<KstMatrix,KstRMatrix>(KST::matrixList);
@@ -699,9 +700,6 @@
connect(i, SIGNAL(updated()), this, SLOT(doUpdates()));
}
}
-#ifdef BENCHMARK
- kstdDebug() << "-------- data manager update data matrices: " << t.elapsed() << endl;
-#endif
// update the static matrices
KstSMatrixList sml = kstObjectSubList<KstMatrix,KstSMatrix>(KST::matrixList);
@@ -720,9 +718,6 @@
connect(i, SIGNAL(updated()), this, SLOT(doUpdates()));
}
}
-#ifdef BENCHMARK
- kstdDebug() << "-------- data manager update static matrices: " << t.elapsed() << endl;
-#endif
// is this really necessary? I would think not...
for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) {
@@ -739,9 +734,6 @@
Edit->setEnabled(false);
Delete->setEnabled(false);
}
-#ifdef BENCHMARK
- kstdDebug() << "-------- data manager update unnecessary stuff??: " << t.elapsed() << endl;
-#endif
}
More information about the Kst
mailing list