Context: Eliminated hooks timer

This commit is contained in:
Paul Beckingham 2016-11-13 13:37:54 -05:00
parent ae128f587d
commit e3d006f867
3 changed files with 11 additions and 11 deletions

View file

@ -331,7 +331,7 @@ int Context::run ()
<< " commit:" << time_commit_us << " commit:" << time_commit_us
<< " sort:" << time_sort_us << " sort:" << time_sort_us
<< " render:" << static_cast <long> (timer_render.total_us ()) << " render:" << static_cast <long> (timer_render.total_us ())
<< " hooks:" << static_cast <long> (timer_hooks.total_us ()) << " hooks:" << time_hooks_us
<< " other:" << static_cast <long> (timer_total.total_us () - << " other:" << static_cast <long> (timer_total.total_us () -
time_init_us - time_init_us -
timer_load.total_us () - timer_load.total_us () -
@ -341,7 +341,7 @@ int Context::run ()
time_commit_us - time_commit_us -
time_sort_us - time_sort_us -
timer_render.total_us () - timer_render.total_us () -
timer_hooks.total_us ()) time_hooks_us)
<< " total:" << static_cast <long> (timer_total.total_us ()) << " total:" << static_cast <long> (timer_total.total_us ())
<< '\n'; << '\n';
debug (s.str ()); debug (s.str ());

View file

@ -106,7 +106,7 @@ public:
long time_commit_us {0}; long time_commit_us {0};
long time_sort_us {0}; long time_sort_us {0};
Timer timer_render; Timer timer_render;
Timer timer_hooks; long time_hooks_us {0};
}; };
#endif #endif

View file

@ -111,7 +111,7 @@ void Hooks::onLaunch () const
if (! _enabled) if (! _enabled)
return; return;
context.timer_hooks.start (); Timer timer;
std::vector <std::string> matchingScripts = scripts ("on-launch"); std::vector <std::string> matchingScripts = scripts ("on-launch");
if (matchingScripts.size ()) if (matchingScripts.size ())
@ -144,7 +144,7 @@ void Hooks::onLaunch () const
} }
} }
context.timer_hooks.stop (); context.time_hooks_us += timer.total_us ();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -164,7 +164,7 @@ void Hooks::onExit () const
if (! _enabled) if (! _enabled)
return; return;
context.timer_hooks.start (); Timer timer;
std::vector <std::string> matchingScripts = scripts ("on-exit"); std::vector <std::string> matchingScripts = scripts ("on-exit");
if (matchingScripts.size ()) if (matchingScripts.size ())
@ -206,7 +206,7 @@ void Hooks::onExit () const
} }
} }
context.timer_hooks.stop (); context.time_hooks_us += timer.total_us ();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -226,7 +226,7 @@ void Hooks::onAdd (Task& task) const
if (! _enabled) if (! _enabled)
return; return;
context.timer_hooks.start (); Timer timer;
std::vector <std::string> matchingScripts = scripts ("on-add"); std::vector <std::string> matchingScripts = scripts ("on-add");
if (matchingScripts.size ()) if (matchingScripts.size ())
@ -271,7 +271,7 @@ void Hooks::onAdd (Task& task) const
task = Task (input[0]); task = Task (input[0]);
} }
context.timer_hooks.stop (); context.time_hooks_us += timer.total_us ();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -292,7 +292,7 @@ void Hooks::onModify (const Task& before, Task& after) const
if (! _enabled) if (! _enabled)
return; return;
context.timer_hooks.start (); Timer timer;
std::vector <std::string> matchingScripts = scripts ("on-modify"); std::vector <std::string> matchingScripts = scripts ("on-modify");
if (matchingScripts.size ()) if (matchingScripts.size ())
@ -337,7 +337,7 @@ void Hooks::onModify (const Task& before, Task& after) const
after = Task (input[1]); after = Task (input[1]);
} }
context.timer_hooks.stop (); context.time_hooks_us += timer.total_us ();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////