Sacrificed Multithreaded recalcs, as memory footprint was damn scary.. I'll revist this later

This commit is contained in:
Mark Watkins 2012-01-10 20:16:52 +10:00
parent f9c1fa27c5
commit 2cb35b69c0
5 changed files with 34 additions and 12 deletions

View File

@ -336,7 +336,7 @@ bool Machine::Save()
Session *s=m_savelist.at(i);
s->UpdateSummaries();
s->Store(path);
//s->TrashEvents();
s->TrashEvents();
savelistCnt++;
}

View File

@ -740,6 +740,7 @@ void Session::updateCountSummary(ChannelID code)
m_timesummary[code]=timesum;
}
FlowParser flowparserobject;
void Session::UpdateSummaries()
{
ChannelID id;
@ -747,7 +748,7 @@ void Session::UpdateSummaries()
calcAHIGraph(this);
// Calculates RespRate and related waveforms (Tv, MV, Te, Ti) if missing
calcRespRate(this);
calcRespRate(this, &flowparserobject);
calcLeaks(this);
calcSPO2Drop(this);

View File

@ -2481,6 +2481,23 @@ void MainWindow::reprocessEvents(bool restart)
}
void MainWindow::FreeSessions()
{
QDate first=PROFILE.FirstDay();
QDate date=PROFILE.LastDay();
Day *day;
QDate current=daily->getDate();
do {
day=PROFILE.GetDay(date,MT_CPAP);
if (day) {
if (date!=current) {
day->CloseEvents();
}
}
date=date.addDays(-1);
} while (date>=first);
}
void MainWindow::doReprocessEvents()
{
m_inRecalculation=true;
@ -2496,10 +2513,11 @@ void MainWindow::doReprocessEvents()
int daycount=first.daysTo(date);
int idx=0;
QList<Machine *> machines=PROFILE.GetMachines(MT_UNKNOWN);
//QList<Machine *> machines=PROFILE.GetMachines(MT_UNKNOWN);
if (qprogress) {
qstatus->setText(tr("Loading Event Data"));
qstatus->setText(tr("Recalculating Summaries"));
//qstatus->setText(tr("Loading Event Data"));
qprogress->setValue(0);
qprogress->setVisible(true);
}
@ -2509,6 +2527,7 @@ void MainWindow::doReprocessEvents()
if (day) {
for (int i=0;i<day->size();i++) {
sess=(*day)[i];
bool isopen=sess->eventsLoaded();
// Load the events
sess->OpenEvents();
@ -2526,8 +2545,9 @@ void MainWindow::doReprocessEvents()
sess->destroyEvent(CPAP_RDI);
sess->SetChanged(true);
//sess->machine()->SaveSession(sess);
//if (!isopen) sess->TrashEvents();
sess->UpdateSummaries();
sess->machine()->SaveSession(sess);
if (!isopen) sess->TrashEvents();
}
}
date=date.addDays(-1);
@ -2538,10 +2558,9 @@ void MainWindow::doReprocessEvents()
} while (date>=first);
qstatus->setText(tr("Recalculating Summaries"));
for (int i=0;i<machines.size();i++) {
machines.at(i)->Save();
}
// for (int i=0;i<machines.size();i++) {
// machines.at(i)->Save();
// }
qstatus->setText(tr(""));
qprogress->setVisible(false);
@ -2553,6 +2572,7 @@ void MainWindow::doReprocessEvents()
} else {
Notify("Recalculations are now complete.","Task Completed");
FreeSessions();
daily->LoadDate(current);
if (overview) overview->ReloadGraphs();
}

View File

@ -291,6 +291,7 @@ private slots:
void on_filterBookmarksButton_clicked();
private:
void FreeSessions();
Ui::MainWindow *ui;
Daily * daily;

View File

@ -42,7 +42,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="importTab">
<attribute name="title">
@ -624,7 +624,7 @@ p, li { white-space: pre-wrap; }
<string>Shows Respiratory Disturbance Index instead of Apnea/Hypopnea Index (RDI=AHI + RERA)</string>
</property>
<property name="text">
<string>Use RDI instead of AHI (PRS1 only)</string>
<string>Use RDI instead of AHI (PRS1 only)</string>
</property>
</widget>
</item>