}//end Stop() public DataStatistics Get() { try { var result = new DataStatistics(); result.DataSize = string.IsNullOrEmpty(Data) ? 0 : System.Text.ASCIIEncoding.Unicode.GetByteCount(Data); result.ElapsedMilliseconds = _stopwatch?.ElapsedMilliseconds ?? 0; result.NHStatistics = _nhMonitor?.Get(); return(result); } catch (Exception e) { _genericLog.Error($"{_nameOfThis} - Exception while Getting Statistics regarding {_element}: {e.Message}"); _genericLog.Debug($"{_nameOfThis} - Exception while Getting Statistics regarding {_element}: {e.StackTrace}"); if (!ContinueOnError) { throw; } return(null); } }//end Get()
}//end Stop() public ActionStatistics Get() { if (!_run) { return(null); } var result = new ActionStatistics(); try { if (MonitorStatus == MonitorStatus.None) { _genericLog.Error($"{_nameOfThis} - Get() was called, but the Monitor was never Started. Start and then Stop the Monitor, before Getting the results."); return(null); } if (MonitorStatus == MonitorStatus.Running) { _genericLog.Info($"{_nameOfThis} - Get() was called, but the Monitor is still Running. The results presented might be inaccurate. (Hint: Stop the Monitor, before Logging the results)"); } result.NHStatistics = _nhMonitor?.Get(); result.UsageStatistics = _usageMonitor?.Get(); return(result); } catch (Exception e) { _genericLog.Error($"{_nameOfThis} - Exception while Getting Statistics: {e.Message}"); _genericLog.Debug($"{_nameOfThis} - Exception while Getting Statistics: {e.StackTrace}"); if (!ContinueOnError) { throw; } return(null); } }//end Get()