internal override void WritePayload(float intervalSec, int pollingIntervalMillisec)
 {
     UpdateMetric();
     lock (this)     // Lock the counter
     {
         IncrementingCounterPayload payload = new IncrementingCounterPayload();
         payload.Name                 = Name;
         payload.DisplayName          = DisplayName ?? "";
         payload.DisplayRateTimeScale = (DisplayRateTimeScale == TimeSpan.Zero) ? "" : DisplayRateTimeScale.ToString("c");
         payload.IntervalSec          = intervalSec;
         payload.Series               = $"Interval={pollingIntervalMillisec}"; // TODO: This may need to change when we support multi-session
         payload.CounterType          = "Sum";
         payload.Metadata             = GetMetadataString();
         payload.Increment            = _increment - _prevIncrement;
         payload.DisplayUnits         = DisplayUnits ?? "";
         EventSource.Write("EventCounters", new EventSourceOptions()
         {
             Level = EventLevel.LogAlways
         }, new IncrementingPollingCounterPayloadType(payload));
     }
 }
 public IncrementingPollingCounterPayloadType(IncrementingCounterPayload payload)
 {
     Payload = payload;
 }