Skip to content

Commit

Permalink
ensure the order of Metrics columns
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsitnik committed Aug 4, 2021
1 parent 2925b4b commit 51d39f0
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/BenchmarkDotNet/Columns/MetricColumn.cs
Expand Up @@ -16,7 +16,7 @@ public class MetricColumn : IColumn
public string Legend => descriptor.Legend;
public bool AlwaysShow => true;
public ColumnCategory Category => ColumnCategory.Metric;
public int PriorityInCategory => 0;
public int PriorityInCategory => descriptor.PriorityInCategory;
public bool IsNumeric => true;
public UnitType UnitType => descriptor.UnitType;

Expand Down
Expand Up @@ -12,6 +12,7 @@ internal class AllocatedNativeMemoryDescriptor : IMetricDescriptor
public UnitType UnitType => UnitType.Size;
public string Unit => SizeUnit.B.Name;
public bool TheGreaterTheBetter => false;
public int PriorityInCategory => 0;
}

internal class NativeMemoryLeakDescriptor : IMetricDescriptor
Expand All @@ -23,5 +24,6 @@ internal class NativeMemoryLeakDescriptor : IMetricDescriptor
public UnitType UnitType => UnitType.Size;
public string Unit => SizeUnit.B.Name;
public bool TheGreaterTheBetter => false;
public int PriorityInCategory => 0;
}
}
3 changes: 3 additions & 0 deletions src/BenchmarkDotNet/Diagnosers/MemoryDiagnoser.cs
Expand Up @@ -56,6 +56,7 @@ private class AllocatedMemoryMetricDescriptor : IMetricDescriptor
public UnitType UnitType => UnitType.Size;
public string Unit => SizeUnit.B.Name;
public bool TheGreaterTheBetter => false;
public int PriorityInCategory => GC.MaxGeneration + 1;
}

private class GarbageCollectionsMetricDescriptor : IMetricDescriptor
Expand All @@ -69,6 +70,7 @@ private GarbageCollectionsMetricDescriptor(int generationId)
Id = $"Gen{generationId}Collects";
DisplayName = $"Gen {generationId}";
Legend = $"GC Generation {generationId} collects per 1000 operations";
PriorityInCategory = generationId;
}

public string Id { get; }
Expand All @@ -78,6 +80,7 @@ private GarbageCollectionsMetricDescriptor(int generationId)
public UnitType UnitType => UnitType.Dimensionless;
public string Unit => "Count";
public bool TheGreaterTheBetter => false;
public int PriorityInCategory { get; }
}
}
}
1 change: 1 addition & 0 deletions src/BenchmarkDotNet/Diagnosers/PmcMetricDescriptor.cs
Expand Up @@ -20,5 +20,6 @@ internal PmcMetricDescriptor(PreciseMachineCounter counter)
public string NumberFormat => "N0";
public UnitType UnitType => UnitType.Dimensionless;
public string Unit => "Count";
public int PriorityInCategory => 0;
}
}
2 changes: 2 additions & 0 deletions src/BenchmarkDotNet/Diagnosers/ThreadingDiagnoser.cs
Expand Up @@ -61,6 +61,7 @@ private class CompletedWorkItemCountMetricDescriptor : IMetricDescriptor
public UnitType UnitType => UnitType.Dimensionless;
public string Unit => "Count";
public bool TheGreaterTheBetter => false;
public int PriorityInCategory => 0;
}

private class LockContentionCountMetricDescriptor : IMetricDescriptor
Expand All @@ -74,6 +75,7 @@ private class LockContentionCountMetricDescriptor : IMetricDescriptor
public UnitType UnitType => UnitType.Dimensionless;
public string Unit => "Count";
public bool TheGreaterTheBetter => false;
public int PriorityInCategory => 0;
}
}
}
1 change: 1 addition & 0 deletions src/BenchmarkDotNet/Disassemblers/DisassemblyDiagnoser.cs
Expand Up @@ -169,6 +169,7 @@ private class NativeCodeSizeMetricDescriptor : IMetricDescriptor
public UnitType UnitType => UnitType.Size;
public string Unit => SizeUnit.B.Name;
public bool TheGreaterTheBetter => false;
public int PriorityInCategory => 0;
}
}
}
2 changes: 2 additions & 0 deletions src/BenchmarkDotNet/Reports/Metric.cs
Expand Up @@ -32,6 +32,8 @@ public interface IMetricDescriptor
[PublicAPI] string Unit { get; }

[PublicAPI] bool TheGreaterTheBetter { get; }

[PublicAPI] int PriorityInCategory { get; }
}

public class MetricDescriptorEqualityComparer : EqualityComparer<IMetricDescriptor>
Expand Down

0 comments on commit 51d39f0

Please sign in to comment.