[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Wed Nov 10 12:30:39 CET 2004
CVS commit by staikos:
Barth's fix for incorrect memory calculations.
M +25 -6 datawizard.ui.h 1.98
--- kdeextragear-2/kst/kst/datawizard.ui.h #1.97:1.98
@@ -387,13 +387,23 @@ void DataWizard::finished()
//
unsigned long memoryRequested = 0, memoryAvailable = 1024*1024*1024; // 1GB
+ unsigned long frames;
#ifdef HAVE_LINUX
meminfo();
memoryAvailable = S(kb_main_free + kb_main_buffers + kb_main_cached);
#endif
+
if (_kstDataRange->ReadToEnd->isChecked()) {
- int removeSamples = _kstDataRange->DoSkip->isChecked() ? _kstDataRange->Skip->value() : 0;
- memoryRequested += (ds->frameCount(_xVector->currentText()) - removeSamples)*ds->samplesPerFrame(_xVector->currentText())*sizeof(double);
+ frames = ds->frameCount(_xVector->currentText()) - _kstDataRange->F0->value();
} else {
- memoryRequested += _kstDataRange->N->value()*ds->samplesPerFrame(_xVector->currentText())*sizeof(double);
+ frames = _kstDataRange->N->value();
+ if (frames > ds->frameCount(_xVector->currentText())) {
+ frames = ds->frameCount(_xVector->currentText());
+ }
+ }
+
+ if (_kstDataRange->DoSkip->isChecked()) {
+ memoryRequested += frames / _kstDataRange->Skip->value() * sizeof(double);;
+ } else {
+ memoryRequested += frames * ds->samplesPerFrame(_xVector->currentText())*sizeof(double);
}
@@ -404,9 +414,18 @@ void DataWizard::finished()
if (i->isOn()) {
QString field = it.current()->text(0);
+
if (_kstDataRange->ReadToEnd->isChecked()) {
- int removeSamples = _kstDataRange->DoSkip->isChecked() ? _kstDataRange->Skip->value() : 0;
- memoryRequested += (ds->frameCount(field) - removeSamples)*ds->samplesPerFrame(field)*sizeof(double);
+ frames = ds->frameCount(field) - _kstDataRange->F0->value();
} else {
- memoryRequested += _kstDataRange->N->value()*ds->samplesPerFrame(field)*sizeof(double);
+ frames = _kstDataRange->N->value();
+ if (frames > ds->frameCount(field)) {
+ frames = ds->frameCount();
+ }
+ }
+
+ if (_kstDataRange->DoSkip->isChecked()) {
+ memoryRequested += frames / _kstDataRange->Skip->value()*sizeof(double);;
+ } else {
+ memoryRequested += frames * ds->samplesPerFrame(field)*sizeof(double);
}
}
More information about the Kst
mailing list