コード例 #1
0
ファイル: EmulatorController.cs プロジェクト: vainamon/emul8
        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;
            }
        }
コード例 #2
0
ファイル: EmulatorController.cs プロジェクト: emul8/emul8
 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;
     }
 }