MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / call

Method call

cp-profiler/src/cpprofiler/utils/maybe_caller.cpp:16–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16void MaybeCaller::call(std::function<void(void)> fn)
17{
18 using namespace std::chrono;
19
20 auto now = system_clock::now();
21 auto elapsed = duration_cast<milliseconds>(now - last_call_time).count();
22
23 if (elapsed > min_elapsed_)
24 {
25 fn();
26 last_call_time = system_clock::now();
27 }
28 else
29 {
30 /// call delayed
31 delayed_fn = fn;
32 updateTimer.start(min_elapsed_);
33 }
34}
35
36void MaybeCaller::callViaTimer() { delayed_fn(); }
37

Callers 2

ExecutionWindowMethod · 0.80
IcicleCanvasMethod · 0.80

Calls 2

countMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected