mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Context: Eliminated filter timer
This commit is contained in:
parent
89b8c9f198
commit
14f1002680
3 changed files with 14 additions and 15 deletions
|
@ -327,7 +327,7 @@ int Context::run ()
|
||||||
<< " init:" << time_init_us
|
<< " init:" << time_init_us
|
||||||
<< " load:" << static_cast <long> (timer_load.total_us ())
|
<< " load:" << static_cast <long> (timer_load.total_us ())
|
||||||
<< " gc:" << time_gc_us - tdb2.load_time_us
|
<< " gc:" << time_gc_us - tdb2.load_time_us
|
||||||
<< " filter:" << static_cast <long> (timer_filter.total_us ())
|
<< " filter:" << time_filter_us
|
||||||
<< " commit:" << static_cast <long> (timer_commit.total_us ())
|
<< " commit:" << static_cast <long> (timer_commit.total_us ())
|
||||||
<< " sort:" << static_cast <long> (timer_sort.total_us ())
|
<< " sort:" << static_cast <long> (timer_sort.total_us ())
|
||||||
<< " render:" << static_cast <long> (timer_render.total_us ())
|
<< " render:" << static_cast <long> (timer_render.total_us ())
|
||||||
|
@ -337,7 +337,7 @@ int Context::run ()
|
||||||
timer_load.total_us () -
|
timer_load.total_us () -
|
||||||
time_gc_us -
|
time_gc_us -
|
||||||
tdb2.load_time_us -
|
tdb2.load_time_us -
|
||||||
timer_filter.total_us () -
|
time_filter_us -
|
||||||
timer_commit.total_us () -
|
timer_commit.total_us () -
|
||||||
timer_sort.total_us () -
|
timer_sort.total_us () -
|
||||||
timer_render.total_us () -
|
timer_render.total_us () -
|
||||||
|
|
|
@ -102,7 +102,7 @@ public:
|
||||||
long time_init_us {0};
|
long time_init_us {0};
|
||||||
Timer timer_load;
|
Timer timer_load;
|
||||||
long time_gc_us {0};
|
long time_gc_us {0};
|
||||||
Timer timer_filter;
|
long time_filter_us {0};
|
||||||
Timer timer_commit;
|
Timer timer_commit;
|
||||||
Timer timer_sort;
|
Timer timer_sort;
|
||||||
Timer timer_render;
|
Timer timer_render;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <Filter.h>
|
#include <Filter.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
|
#include <Timer.h>
|
||||||
#include <DOM.h>
|
#include <DOM.h>
|
||||||
#include <Eval.h>
|
#include <Eval.h>
|
||||||
#include <Variant.h>
|
#include <Variant.h>
|
||||||
|
@ -59,7 +60,7 @@ bool domSource (const std::string& identifier, Variant& value)
|
||||||
// Take an input set of tasks and filter into a subset.
|
// Take an input set of tasks and filter into a subset.
|
||||||
void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output)
|
void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output)
|
||||||
{
|
{
|
||||||
context.timer_filter.start ();
|
Timer timer;
|
||||||
_startCount = (int) input.size ();
|
_startCount = (int) input.size ();
|
||||||
|
|
||||||
context.cli2.prepareFilter ();
|
context.cli2.prepareFilter ();
|
||||||
|
@ -98,15 +99,14 @@ void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output
|
||||||
|
|
||||||
_endCount = (int) output.size ();
|
_endCount = (int) output.size ();
|
||||||
context.debug (format ("Filtered {1} tasks --> {2} tasks [list subset]", _startCount, _endCount));
|
context.debug (format ("Filtered {1} tasks --> {2} tasks [list subset]", _startCount, _endCount));
|
||||||
context.timer_filter.stop ();
|
context.time_filter_us += timer.total_us ();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Take the set of all tasks and filter into a subset.
|
// Take the set of all tasks and filter into a subset.
|
||||||
void Filter::subset (std::vector <Task>& output)
|
void Filter::subset (std::vector <Task>& output)
|
||||||
{
|
{
|
||||||
context.timer_filter.start ();
|
Timer timer;
|
||||||
|
|
||||||
context.cli2.prepareFilter ();
|
context.cli2.prepareFilter ();
|
||||||
|
|
||||||
std::vector <std::pair <std::string, Lexer::Type>> precompiled;
|
std::vector <std::pair <std::string, Lexer::Type>> precompiled;
|
||||||
|
@ -119,9 +119,9 @@ void Filter::subset (std::vector <Task>& output)
|
||||||
|
|
||||||
if (precompiled.size ())
|
if (precompiled.size ())
|
||||||
{
|
{
|
||||||
context.timer_filter.stop ();
|
Timer timer_pending;
|
||||||
auto pending = context.tdb2.pending.get_tasks ();
|
auto pending = context.tdb2.pending.get_tasks ();
|
||||||
context.timer_filter.start ();
|
context.time_filter_us -= timer_pending.total_us ();
|
||||||
_startCount = (int) pending.size ();
|
_startCount = (int) pending.size ();
|
||||||
|
|
||||||
Eval eval;
|
Eval eval;
|
||||||
|
@ -148,9 +148,9 @@ void Filter::subset (std::vector <Task>& output)
|
||||||
shortcut = pendingOnly ();
|
shortcut = pendingOnly ();
|
||||||
if (! shortcut)
|
if (! shortcut)
|
||||||
{
|
{
|
||||||
context.timer_filter.stop ();
|
Timer timer_completed;
|
||||||
auto completed = context.tdb2.completed.get_tasks ();
|
auto completed = context.tdb2.completed.get_tasks ();
|
||||||
context.timer_filter.start ();
|
context.time_filter_us -= timer_completed.total_us ();
|
||||||
_startCount += (int) completed.size ();
|
_startCount += (int) completed.size ();
|
||||||
|
|
||||||
for (auto& task : completed)
|
for (auto& task : completed)
|
||||||
|
@ -170,20 +170,19 @@ void Filter::subset (std::vector <Task>& output)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
safety ();
|
safety ();
|
||||||
context.timer_filter.stop ();
|
|
||||||
|
|
||||||
|
Timer pending_completed;
|
||||||
for (auto& task : context.tdb2.pending.get_tasks ())
|
for (auto& task : context.tdb2.pending.get_tasks ())
|
||||||
output.push_back (task);
|
output.push_back (task);
|
||||||
|
|
||||||
for (auto& task : context.tdb2.completed.get_tasks ())
|
for (auto& task : context.tdb2.completed.get_tasks ())
|
||||||
output.push_back (task);
|
output.push_back (task);
|
||||||
|
context.time_filter_us -= pending_completed.total_us ();
|
||||||
context.timer_filter.start ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_endCount = (int) output.size ();
|
_endCount = (int) output.size ();
|
||||||
context.debug (format ("Filtered {1} tasks --> {2} tasks [{3}]", _startCount, _endCount, (shortcut ? "pending only" : "all tasks")));
|
context.debug (format ("Filtered {1} tasks --> {2} tasks [{3}]", _startCount, _endCount, (shortcut ? "pending only" : "all tasks")));
|
||||||
context.timer_filter.stop ();
|
context.time_filter_us += timer.total_us ();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue