diff options
author | Sung Yoon Whang <suwhang@microsoft.com> | 2019-03-16 19:06:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-16 19:06:11 -0700 |
commit | b31dacad8ec2b79f24e1b4ab4b0a7c0a20159601 (patch) | |
tree | a97c61d9d16edd85118f526159970f300a751fe1 /src/System.Private.CoreLib/shared | |
parent | 5bfb7417d5841c7ff79452f92e13603c5b0459fc (diff) | |
download | coreclr-b31dacad8ec2b79f24e1b4ab4b0a7c0a20159601.tar.gz coreclr-b31dacad8ec2b79f24e1b4ab4b0a7c0a20159601.tar.bz2 coreclr-b31dacad8ec2b79f24e1b4ab4b0a7c0a20159601.zip |
Fixing some payload serialization issue on new EventCounters (#23295)
* Fixing some payload serialization issue on new EventCounters
* Fix build error
Diffstat (limited to 'src/System.Private.CoreLib/shared')
4 files changed, 8 insertions, 7 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/CounterPayload.cs b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/CounterPayload.cs index e7dd90d4b0..ae4a1a7280 100644 --- a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/CounterPayload.cs +++ b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/CounterPayload.cs @@ -124,7 +124,7 @@ namespace System.Diagnostics.Tracing public string DisplayName { get; set; } - public TimeSpan DisplayRateTimeScale { get; set; } + public string DisplayRateTimeScale { get; set; } public float Increment { get; set; } @@ -150,7 +150,7 @@ namespace System.Diagnostics.Tracing { yield return new KeyValuePair<string, object>("Name", Name); yield return new KeyValuePair<string, object>("DisplayName", DisplayName); - yield return new KeyValuePair<string, object>("DisplayRateTimeScale", DisplayRateTimeScale.ToString("c")); + yield return new KeyValuePair<string, object>("DisplayRateTimeScale", DisplayRateTimeScale); yield return new KeyValuePair<string, object>("Increment", Increment); yield return new KeyValuePair<string, object>("IntervalSec", IntervalSec); yield return new KeyValuePair<string, object>("Series", $"Interval={IntervalSec}"); @@ -161,4 +161,4 @@ namespace System.Diagnostics.Tracing #endregion // Implementation of the IEnumerable interface } -}
\ No newline at end of file +} diff --git a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/IncrementingEventCounter.cs b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/IncrementingEventCounter.cs index 05f6d43894..1b83819479 100644 --- a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/IncrementingEventCounter.cs +++ b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/IncrementingEventCounter.cs @@ -62,8 +62,8 @@ namespace System.Diagnostics.Tracing IncrementingCounterPayload payload = new IncrementingCounterPayload(); payload.Name = _name; payload.IntervalSec = intervalSec; - payload.DisplayName = DisplayName; - payload.DisplayRateTimeScale = DisplayRateTimeScale; + payload.DisplayName = (DisplayName == null) ? "" : DisplayName; + payload.DisplayRateTimeScale = (DisplayRateTimeScale == TimeSpan.Zero) ? "" : DisplayRateTimeScale.ToString("c"); payload.MetaData = GetMetaDataString(); payload.Increment = _increment - _prevIncrement; _prevIncrement = _increment; diff --git a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/IncrementingPollingCounter.cs b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/IncrementingPollingCounter.cs index d9f640c73d..8cd5c42b1b 100644 --- a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/IncrementingPollingCounter.cs +++ b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/IncrementingPollingCounter.cs @@ -71,8 +71,8 @@ namespace System.Diagnostics.Tracing { IncrementingCounterPayload payload = new IncrementingCounterPayload(); payload.Name = _name; - payload.DisplayName = DisplayName; - payload.DisplayRateTimeScale = DisplayRateTimeScale; + payload.DisplayName = (DisplayName == null) ? "" : DisplayName; + payload.DisplayRateTimeScale = (DisplayRateTimeScale == TimeSpan.Zero) ? "" : DisplayRateTimeScale.ToString("c"); payload.IntervalSec = intervalSec; payload.MetaData = GetMetaDataString(); payload.Increment = _increment - _prevIncrement; diff --git a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/PollingCounter.cs b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/PollingCounter.cs index 364e50dc3d..f156ef1dd0 100644 --- a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/PollingCounter.cs +++ b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/PollingCounter.cs @@ -58,6 +58,7 @@ namespace System.Diagnostics.Tracing CounterPayload payload = new CounterPayload(); payload.Name = _name; + payload.DisplayName = (DisplayName == null) ? "" : DisplayName; payload.Count = 1; // NOTE: These dumb-looking statistics is intentional payload.IntervalSec = intervalSec; payload.Mean = value; |