LadderTimer typeos - actually call timer.start and update elapsed_total

This commit is contained in:
John Colvin committed 2018-05-14 17:52:07 -04:00
1 parent 8c368affd9
commit fad111314d
1 file changed
+2
@@ -55,6 +55,7 @@ namespace mbts.spark {
double excessive_cycle_ms = interval.Milliseconds * (double)one_hundred * excessive_cycle_ratio;
int cycle_count = 0;
DispatcherTimer timer = new DispatcherTimer(interval, priority, on_tick, Dispatcher.CurrentDispatcher);
timer.Start();
return Disposable.Create(timer.Stop);
//
void on_tick(object sender, EventArgs e) {
@@ -66,6 +67,7 @@ namespace mbts.spark {
var cycle_ms = (stop_watch.Elapsed - elapsed_total).TotalMilliseconds;
if (cycle_ms > excessive_cycle_ms)
Logger.warn(bts.log.Subsystem.Ui, $"Ladder '{security}' DispatcherTimer took {cycle_ms}ms to complete {one_hundred} cycles.");
elapsed_total = stop_watch.Elapsed;
}
work();
}