Skip to content
Snippets Groups Projects
Commit 3e3b91b1 authored by Joana Plewnia's avatar Joana Plewnia
Browse files

Fixed Statistics for multiple serial recordings while only starting the scenario once

- added lastStarted and lastStopped fields in addition to firstStarted and firstStopped
- filter statistics are reset when start recording is pressed
	- resets #accepted, #rejected, additional_time
parent aba21e0d
No related branches found
No related tags found
1 merge request!422Draft: Memory Viewer LTM Recording Progress bar
Pipeline #17250 passed
......@@ -281,8 +281,8 @@ namespace armarx::armem::server::ltm
try
{
times["Started LTM1"] = this->getStatistics().firstStarted;
times["Stopped LTM1"] = this->getStatistics().firstStopped;
times["Started LTM1"] = this->getStatistics().lastStarted;
times["Stopped LTM1"] = this->getStatistics().lastStopped;
information["LTM"] = first_stats;
}
catch (...)
......@@ -291,8 +291,8 @@ namespace armarx::armem::server::ltm
}
auto exportPath = this->getMemoryBasePath();
auto exportName = this->getExportName();
auto recording_started = this->getStatistics().firstStarted;
auto recording_stopped = this->getStatistics().firstStopped;
auto recording_started = this->getStatistics().lastStarted;
auto recording_stopped = this->getStatistics().lastStopped;
test::save_statistics(information,
times,
recording_started,
......
......@@ -35,6 +35,8 @@ namespace armarx::armem::server::ltm::detail
bool firstStop = true;
armarx::core::time::DateTime firstStarted = armarx::core::time::DateTime::Invalid();
armarx::core::time::DateTime firstStopped = armarx::core::time::DateTime::Invalid();
armarx::core::time::DateTime lastStarted = armarx::core::time::DateTime::Invalid();
armarx::core::time::DateTime lastStopped = armarx::core::time::DateTime::Invalid();
};
public:
......@@ -79,15 +81,18 @@ namespace armarx::armem::server::ltm::detail
void
enable()
{
processors->resetFilterStatisticsForNewEpisode(); //make sure the statistics are
//resetted before the recording starts
auto now = armarx::core::time::DateTime::Now();
ARMARX_INFO << "Enabling LTM " << id().str() << " at " << now.toDateTimeString();
ARMARX_INFO << "Storing information at " << this->getExportName();
enabled = true;
if (statistics.firstStart)
{
statistics.firstStarted = armarx::core::time::DateTime::Now();
statistics.firstStarted = now;
statistics.firstStart = false;
}
statistics.lastStarted = now;
this->_enable();
}
......@@ -100,9 +105,10 @@ namespace armarx::armem::server::ltm::detail
enabled = false;
if (statistics.firstStop)
{
statistics.firstStopped = armarx::core::time::DateTime::Now();
statistics.firstStopped = now;
statistics.firstStop = false;
}
statistics.lastStopped = now;
this->_disable();
ARMARX_INFO << "Disabling of LTM finished";
}
......
......@@ -80,4 +80,12 @@ namespace armarx::armem::server::ltm
}
return stats;
}
void Processors::resetFilterStatisticsForNewEpisode()
{
ARMARX_DEBUG << "Resetting statistics for filters";
for(const auto& filter_ptr: this->snapFilters){
filter_ptr->resetStatisticsForNewEpisode();
}
}
} // namespace armarx::armem::server::ltm
......@@ -25,6 +25,12 @@ namespace armarx::armem::server::ltm
std::map<std::string, processor::SnapshotFilter::FilterStatistics> getSnapshotFilterStatistics();
/**
* @brief resetFilterStatisticsForNewEpisode runs resetFilterStatisticsForNewEpisode on all
* snapshot filters
*/
void resetFilterStatisticsForNewEpisode();
public:
// Unique Memory Filters
std::vector<std::unique_ptr<processor::MemoryFilter>> memFilters;
......
......@@ -22,5 +22,12 @@ namespace armarx::armem::server::ltm::processor
return "Base_Filter";
}
void SnapshotFilter::resetStatisticsForNewEpisode()
{
stats.accepted = 0;
stats.rejected = 0;
stats.additional_time = std::chrono::duration<double>::zero();
}
} // namespace armarx::armem::server::ltm::processor
......@@ -46,5 +46,11 @@ namespace armarx::armem::server::ltm::processor
virtual FilterStatistics getFilterStatistics();
virtual std::string getName();
/**
* @brief resetStatisticsForNewEpisode resets the parts of the statistics that are unique
* to one recording cycle (episode)
*/
void resetStatisticsForNewEpisode();
};
} // namespace armarx::armem::server::ltm::processor
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment