Commit 8c3c62eb authored by Laurent Claustre's avatar Laurent Claustre

Flush statistic log file

parent 989c4579
Pipeline #16789 passed with stages
in 38 minutes and 45 seconds
......@@ -2035,7 +2035,7 @@ CtConfig::ModuleTypeCallback* CtSaving::_getConfigHandler()
CtSaving::SaveContainer::SaveContainer(Stream& stream)
: m_stream(stream), m_statistic_size(16),
m_max_writing_task(1), m_running_writing_task(0),
m_log_stat_enable(false)
m_log_stat_enable(false), m_log_stat_file(NULL)
{
DEB_CONSTRUCTOR();
}
......@@ -2185,6 +2185,12 @@ void CtSaving::SaveContainer::writeFileStat(Data& aData, Timestamp start, Timest
void CtSaving::SaveContainer::setEnableLogStat(bool enable)
{
// TODO: check that no current saving is active
AutoMutex aLock = AutoMutex(m_cond.mutex());
if (m_log_stat_enable && !enable) {
fclose(m_log_stat_file);
m_log_stat_file = NULL;
}
m_log_stat_enable = enable;
}
......@@ -2204,6 +2210,10 @@ void CtSaving::SaveContainer::prepareLogStat(const CtSaving::Parameters& pars)
if (m_log_stat_directory.empty()) {
m_log_stat_directory = pars.directory;
} else {
// check if directory changed, then update
if (m_log_stat_directory != pars.directory)
m_log_stat_directory = pars.directory;
else
m_stream.checkDirectoryAccess(m_log_stat_directory);
}
......@@ -2657,6 +2667,11 @@ void CtSaving::SaveContainer::close(const CtSaving::Parameters* params,
}
}
}
// flush log file each time a frame file is closed
aLock.unlock();
if (m_log_stat_enable)
fflush(m_log_stat_file);
}
void CtSaving::SaveContainer::_setBuffer(int frameNumber,
ZBufferType* buffers)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment