|
4 | 4 | using BenchmarkDotNet.Running; |
5 | 5 | using Perfolizer.Horology; |
6 | 6 | using Perfolizer.Metrology; |
| 7 | +using Pragmastat.Metrology; |
7 | 8 |
|
8 | 9 | namespace BenchmarkDotNet.Columns |
9 | 10 | { |
@@ -48,14 +49,21 @@ public string GetValue(Summary summary, BenchmarkCase benchmarkCase, SummaryStyl |
48 | 49 | string numberFormat = descriptor.NumberFormat; |
49 | 50 |
|
50 | 51 | if (printUnits && descriptor.UnitType == UnitType.CodeSize) |
51 | | - return SizeValue.FromBytes((long)metric.Value).ToString(style.CodeSizeUnit, numberFormat, cultureInfo, unitPresentation); |
| 52 | + { |
| 53 | + var measurement = SizeValue.FromBytes((long)metric.Value).ToMeasurement(style.CodeSizeUnit); |
| 54 | + return PerfolizerMeasurementFormatter.Instance.Format(measurement, numberFormat, cultureInfo, unitPresentation); |
| 55 | + } |
52 | 56 | if (printUnits && descriptor.UnitType == UnitType.Size) |
53 | | - return SizeValue.FromBytes((long)metric.Value).ToString(style.SizeUnit, numberFormat, cultureInfo, unitPresentation); |
| 57 | + { |
| 58 | + var measurement = SizeValue.FromBytes((long)metric.Value).ToMeasurement(style.SizeUnit); |
| 59 | + return PerfolizerMeasurementFormatter.Instance.Format(measurement, numberFormat, cultureInfo, unitPresentation); |
| 60 | + } |
54 | 61 | if (printUnits && descriptor.UnitType == UnitType.Time) |
55 | 62 | { |
56 | 63 | if (numberFormat.IsBlank()) |
57 | 64 | numberFormat = "N4"; |
58 | | - return TimeInterval.FromNanoseconds(metric.Value).ToString(style.TimeUnit, numberFormat, cultureInfo, unitPresentation); |
| 65 | + var measurement = TimeInterval.FromNanoseconds(metric.Value).ToMeasurement(style.TimeUnit); |
| 66 | + return PerfolizerMeasurementFormatter.Instance.Format(measurement, numberFormat, cultureInfo, unitPresentation); |
59 | 67 | } |
60 | 68 |
|
61 | 69 | return metric.Value.ToString(numberFormat, cultureInfo); |
|
0 commit comments