Context: Add timer that measures the total command duration explicitly

This commit is contained in:
Tomas Babej 2015-09-12 23:28:07 +02:00 committed by Paul Beckingham
parent ed58263c16
commit b9f217a716
2 changed files with 7 additions and 1 deletions

View file

@ -93,6 +93,7 @@ Context::~Context ()
////////////////////////////////////////////////////////////////////////////////
int Context::initialize (int argc, const char** argv)
{
timer_total.start ();
timer_init.start ();
int rc = 0;
@ -315,6 +316,8 @@ int Context::run ()
tdb2.commit (); // Harmless if called when nothing changed.
hooks.onExit (); // No chance to update data.
timer_total.stop ();
std::stringstream s;
s << "Perf "
<< PACKAGE_STRING
@ -335,7 +338,8 @@ int Context::run ()
<< " sort:" << timer_sort.total ()
<< " render:" << timer_render.total ()
<< " hooks:" << timer_hooks.total ()
<< " total:" << (timer_init.total () +
<< " other:" << timer_total.total () -
(timer_init.total () +
timer_load.total () +
timer_gc.total () +
timer_filter.total () +
@ -343,6 +347,7 @@ int Context::run ()
timer_sort.total () +
timer_render.total () +
timer_hooks.total ())
<< " total:" << timer_total.total ()
<< "\n";
debug (s.str ());
}

View file

@ -106,6 +106,7 @@ public:
int terminal_width;
int terminal_height;
Timer timer_total;
Timer timer_init;
Timer timer_load;
Timer timer_gc;