From e906b200147d6573760d5c7f5c4848b2186ffe35 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 13 Nov 2016 13:42:48 -0500 Subject: [PATCH] Context: Eliminated render timer --- src/Context.cpp | 20 ++++++++++---------- src/Context.h | 2 +- src/ViewTask.cpp | 10 +++++----- src/commands/CmdExport.cpp | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Context.cpp b/src/Context.cpp index 6d2bffea1..c2df43c86 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -330,17 +330,17 @@ int Context::run () << " filter:" << time_filter_us << " commit:" << time_commit_us << " sort:" << time_sort_us - << " render:" << static_cast (timer_render.total_us ()) + << " render:" << time_render_us << " hooks:" << time_hooks_us - << " other:" << static_cast (timer_total.total_us () - - time_init_us - - timer_load.total_us () - - time_gc_us - - tdb2.load_time_us - - time_filter_us - - time_commit_us - - time_sort_us - - timer_render.total_us () - + << " other:" << static_cast (timer_total.total_us () - + time_init_us - + timer_load.total_us () - + time_gc_us - + tdb2.load_time_us - + time_filter_us - + time_commit_us - + time_sort_us - + time_render_us - time_hooks_us) << " total:" << static_cast (timer_total.total_us ()) << '\n'; diff --git a/src/Context.h b/src/Context.h index de2cf6aa8..d9b2e6212 100644 --- a/src/Context.h +++ b/src/Context.h @@ -105,7 +105,7 @@ public: long time_filter_us {0}; long time_commit_us {0}; long time_sort_us {0}; - Timer timer_render; + long time_render_us {0}; long time_hooks_us {0}; }; diff --git a/src/ViewTask.cpp b/src/ViewTask.cpp index c8347b4aa..b0562995f 100644 --- a/src/ViewTask.cpp +++ b/src/ViewTask.cpp @@ -110,7 +110,7 @@ ViewTask::~ViewTask () // std::string ViewTask::render (std::vector & data, std::vector & sequence) { - context.timer_render.start (); + Timer timer; bool const obfuscate = context.config.getBoolean ("obfuscate"); bool const print_empty_columns = context.config.getBoolean ("print.empty.columns"); @@ -287,7 +287,7 @@ std::string ViewTask::render (std::vector & data, std::vector & seque // Stop if the line limit is exceeded. if (++_lines >= _truncate_lines && _truncate_lines != 0) { - context.timer_render.stop (); + context.time_render_us += timer.total_us (); return out; } } @@ -373,7 +373,7 @@ std::string ViewTask::render (std::vector & data, std::vector & seque // Stop if the line limit is exceeded. if (++_lines >= _truncate_lines && _truncate_lines != 0) { - context.timer_render.stop (); + context.time_render_us += timer.total_us (); return out; } } @@ -383,12 +383,12 @@ std::string ViewTask::render (std::vector & data, std::vector & seque // Stop if the row limit is exceeded. if (++_rows >= _truncate_rows && _truncate_rows != 0) { - context.timer_render.stop (); + context.time_render_us += timer.total_us (); return out; } } - context.timer_render.stop (); + context.time_render_us += timer.total_us (); return out; } diff --git a/src/commands/CmdExport.cpp b/src/commands/CmdExport.cpp index af171cfdf..ba490e0d4 100644 --- a/src/commands/CmdExport.cpp +++ b/src/commands/CmdExport.cpp @@ -63,7 +63,7 @@ int CmdExport::execute (std::string& output) filter.subset (filtered); // Export == render. - context.timer_render.start (); + Timer timer; // Obey 'limit:N'. int rows = 0; @@ -101,7 +101,7 @@ int CmdExport::execute (std::string& output) if (json_array) output += "]\n"; - context.timer_render.stop (); + context.time_render_us += timer.total_us (); return rc; }