Prevent DivideByZeroException in EventCounter.ToString() (dotnet/coreclr#27581)
authorJesperTreetop <jesper.lindholm@treetop.se>
Tue, 5 Nov 2019 18:33:18 +0000 (19:33 +0100)
committerSung Yoon Whang <suwhang@microsoft.com>
Tue, 5 Nov 2019 18:33:18 +0000 (10:33 -0800)
commit34a96f70883c16bfdfde629f30c8d2049bfbda62
tree4e484daa0c55ab5922f3dfe7eec1b4f108222ca1
parent64cf6d3914079624810958b13d63ef4cff20444f
Prevent DivideByZeroException in EventCounter.ToString() (dotnet/coreclr#27581)

* Prevent DivideByZeroException in EventCounter.ToString()

Maybe it should print something other than 0. Maybe "Mean" should be excluded. But at least with this it doesn't divide by zero. Ternary operator in interpolated string is not super readable; didn't know if making the code more descriptive would have performance implications.

* Update src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventCounter.cs

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/a187c727956c8ed30635f75450e7dfc38f2ccf38
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventCounter.cs