diff --git a/src/Context.cpp b/src/Context.cpp index 3ac308fb0..6d2bffea1 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -331,7 +331,7 @@ int Context::run () << " commit:" << time_commit_us << " sort:" << time_sort_us << " render:" << static_cast (timer_render.total_us ()) - << " hooks:" << static_cast (timer_hooks.total_us ()) + << " hooks:" << time_hooks_us << " other:" << static_cast (timer_total.total_us () - time_init_us - timer_load.total_us () - @@ -341,7 +341,7 @@ int Context::run () time_commit_us - time_sort_us - timer_render.total_us () - - timer_hooks.total_us ()) + time_hooks_us) << " total:" << static_cast (timer_total.total_us ()) << '\n'; debug (s.str ()); diff --git a/src/Context.h b/src/Context.h index c3947900f..de2cf6aa8 100644 --- a/src/Context.h +++ b/src/Context.h @@ -106,7 +106,7 @@ public: long time_commit_us {0}; long time_sort_us {0}; Timer timer_render; - Timer timer_hooks; + long time_hooks_us {0}; }; #endif diff --git a/src/Hooks.cpp b/src/Hooks.cpp index d27f8cac0..abff63366 100644 --- a/src/Hooks.cpp +++ b/src/Hooks.cpp @@ -111,7 +111,7 @@ void Hooks::onLaunch () const if (! _enabled) return; - context.timer_hooks.start (); + Timer timer; std::vector matchingScripts = scripts ("on-launch"); 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) return; - context.timer_hooks.start (); + Timer timer; std::vector matchingScripts = scripts ("on-exit"); 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) return; - context.timer_hooks.start (); + Timer timer; std::vector matchingScripts = scripts ("on-add"); if (matchingScripts.size ()) @@ -271,7 +271,7 @@ void Hooks::onAdd (Task& task) const 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) return; - context.timer_hooks.start (); + Timer timer; std::vector matchingScripts = scripts ("on-modify"); if (matchingScripts.size ()) @@ -337,7 +337,7 @@ void Hooks::onModify (const Task& before, Task& after) const after = Task (input[1]); } - context.timer_hooks.stop (); + context.time_hooks_us += timer.total_us (); } ////////////////////////////////////////////////////////////////////////////////