[Kst] kst_hfi_calib_branch: kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Wed Nov 10 12:33:11 CET 2004
CVS commit by staikos:
merge Barth's memory calculation fix
M +25 -6 datawizard.ui.h 1.96.2.2
--- kdeextragear-2/kst/kst/datawizard.ui.h #1.96.2.1:1.96.2.2
@@ -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