private void HandleTimeMeasure(TimeMeasurementOperation operation) { switch (operation) { case TimeMeasurementOperation.Start: stopwatch.Start(); this.Log(LogLevel.Info, "Time measurement started."); break; case TimeMeasurementOperation.Stop: stopwatch.Stop(); this.Log(LogLevel.Info, "Time measurement finished. Elapsed {0}s = {1}", Misc.NormalizeDecimal(stopwatch.Elapsed.TotalSeconds), stopwatch.Elapsed); break; case TimeMeasurementOperation.Reset: if (stopwatch.IsRunning) { stopwatch.Restart(); } else { stopwatch.Reset(); } this.Log(LogLevel.Info, "Time measurement reseted."); break; default: this.Log(LogLevel.Warning, "Invalid value written to time measurement register, ignoring."); break; } }
private void HandleTimeMeasure(TimeMeasurementOperation operation) { switch(operation) { case TimeMeasurementOperation.Start: stopwatch.Start(); this.Log(LogLevel.Info, "Time measurement started."); break; case TimeMeasurementOperation.Stop: stopwatch.Stop(); this.Log(LogLevel.Info, "Time measurement finished. Elapsed {0}s = {1}", Misc.NormalizeDecimal(stopwatch.Elapsed.TotalSeconds), stopwatch.Elapsed); break; case TimeMeasurementOperation.Reset: if(stopwatch.IsRunning) { stopwatch.Restart(); } else { stopwatch.Reset(); } this.Log(LogLevel.Info, "Time measurement reseted."); break; default: this.Log(LogLevel.Warning, "Invalid value written to time measurement register, ignoring."); break; } }