Skip to content
Snippets Groups Projects
Commit 2978f63b authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Call FileStream::enableTimers()

parent 33accb73
No related branches found
No related tags found
1 merge request!352config/default: added -fsanitize=signed-integer-overflow...
Pipeline #103087 passed
......@@ -40,6 +40,7 @@
#include "parser.h"
#include "factory.h"
#include "cdo_def_options.h"
#include "fileStream.h"
static ProcessManager g_processManager;
......@@ -347,17 +348,21 @@ static void
timer_report(std::vector<cdo::iTimer *> &timers)
{
FILE *fp = stdout;
fprintf(fp, "\nTimer report: shift = %g\n", cdo::timerShift);
if (Options::cdoVerbose) fprintf(fp, "\nTimer report: shift = %g\n", cdo::timerShift);
fprintf(fp, " Name Calls Min Average Max Total\n");
for (auto &timer : timers)
{
auto total = timer->elapsed();
auto avg = timer->sum;
if (timer->calls > 0) avg /= timer->calls;
if (timer->calls > 0)
{
auto total = timer->elapsed();
auto avg = timer->sum;
avg /= timer->calls;
// if (timer.stat != rt_stat_undef)
fprintf(fp, "%8s %7d %12.4g %12.4g %12.4g %12.4g\n", timer->name.c_str(), timer->calls, timer->min, avg, timer->max, total);
// if (timer.stat != rt_stat_undef)
fprintf(fp, "%8s %7d %12.4g %12.4g %12.4g %12.4g\n", timer->name.c_str(), timer->calls, timer->min, avg, timer->max,
total);
}
}
}
......@@ -438,6 +443,9 @@ main(int argc, char *argv[])
allTimers.push_back(&cdo::writeTimer);
g_processManager.buildProcessTree(processStructure);
FileStream::enableTimers(g_processManager.get_num_processes() == 1 && Threading::ompNumMaxThreads == 1);
// if (g_processManager.get_num_processes() == 1) { cdiDefGlobal("NETCDF_LAZY_GRID_LOAD", true); }
totalTimer.start();
g_processManager.run_processes();
......
......@@ -47,11 +47,13 @@ public:
// FileStreamOnly
int getFileID();
static void
enableTimers(const bool p_enable)
enableTimers(bool p_enable)
{
FileStream::TimerEnabled = p_enable;
}
static bool
timersEnabled()
{
......@@ -65,6 +67,7 @@ protected:
private:
std::string m_filename;
void checkDatarange(int varID, double *array, size_t numMissVals);
protected:
FileStream() = default;
};
......
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