@@ -16,6 +16,7 @@ public class DefaultOrderer : IOrderer
16
16
{
17
17
public static readonly IOrderer Instance = new DefaultOrderer ( ) ;
18
18
19
+ private readonly IComparer < string [ ] > categoryComparer = CategoryComparer . Instance ;
19
20
private readonly IComparer < ParameterInstances > paramsComparer = ParameterComparer . Instance ;
20
21
private readonly IComparer < Job > jobComparer = JobComparer . Instance ;
21
22
private readonly IComparer < BenchmarkCase > benchmarkComparer ;
@@ -31,7 +32,7 @@ public DefaultOrderer(
31
32
SummaryOrderPolicy = summaryOrderPolicy ;
32
33
MethodOrderPolicy = methodOrderPolicy ;
33
34
IComparer < Descriptor > targetComparer = new DescriptorComparer ( methodOrderPolicy ) ;
34
- benchmarkComparer = new BenchmarkComparer ( paramsComparer , jobComparer , targetComparer ) ;
35
+ benchmarkComparer = new BenchmarkComparer ( categoryComparer , paramsComparer , jobComparer , targetComparer ) ;
35
36
logicalGroupComparer = new LogicalGroupComparer ( benchmarkComparer ) ;
36
37
}
37
38
@@ -103,14 +104,14 @@ public string GetLogicalGroupKey(ImmutableArray<BenchmarkCase> allBenchmarksCase
103
104
}
104
105
105
106
var keys = new List < string > ( ) ;
107
+ if ( rules . Contains ( BenchmarkLogicalGroupRule . ByCategory ) )
108
+ keys . Add ( string . Join ( "," , benchmarkCase . Descriptor . Categories ) ) ;
106
109
if ( rules . Contains ( BenchmarkLogicalGroupRule . ByMethod ) )
107
110
keys . Add ( benchmarkCase . Descriptor . DisplayInfo ) ;
108
111
if ( rules . Contains ( BenchmarkLogicalGroupRule . ByJob ) )
109
112
keys . Add ( benchmarkCase . Job . DisplayInfo ) ;
110
113
if ( rules . Contains ( BenchmarkLogicalGroupRule . ByParams ) )
111
114
keys . Add ( benchmarkCase . Parameters . ValueInfo ) ;
112
- if ( rules . Contains ( BenchmarkLogicalGroupRule . ByCategory ) )
113
- keys . Add ( string . Join ( "," , benchmarkCase . Descriptor . Categories ) ) ;
114
115
115
116
string logicalGroupKey = string . Join ( "-" , keys . Where ( key => key != string . Empty ) ) ;
116
117
return logicalGroupKey == string . Empty ? "*" : logicalGroupKey ;
@@ -127,12 +128,18 @@ public virtual IEnumerable<IGrouping<string, BenchmarkCase>> GetLogicalGroupOrde
127
128
128
129
private class BenchmarkComparer : IComparer < BenchmarkCase >
129
130
{
131
+ private readonly IComparer < string [ ] > categoryComparer ;
130
132
private readonly IComparer < ParameterInstances > paramsComparer ;
131
133
private readonly IComparer < Job > jobComparer ;
132
134
private readonly IComparer < Descriptor > targetComparer ;
133
135
134
- public BenchmarkComparer ( IComparer < ParameterInstances > paramsComparer , IComparer < Job > jobComparer , IComparer < Descriptor > targetComparer )
136
+ public BenchmarkComparer (
137
+ IComparer < string [ ] > categoryComparer ,
138
+ IComparer < ParameterInstances > paramsComparer ,
139
+ IComparer < Job > jobComparer ,
140
+ IComparer < Descriptor > targetComparer )
135
141
{
142
+ this . categoryComparer = categoryComparer ;
136
143
this . targetComparer = targetComparer ;
137
144
this . jobComparer = jobComparer ;
138
145
this . paramsComparer = paramsComparer ;
@@ -145,6 +152,7 @@ public int Compare(BenchmarkCase x, BenchmarkCase y)
145
152
if ( x == null ) return - 1 ;
146
153
return new [ ]
147
154
{
155
+ categoryComparer ? . Compare ( x . Descriptor . Categories , y . Descriptor . Categories ) ?? 0 ,
148
156
paramsComparer ? . Compare ( x . Parameters , y . Parameters ) ?? 0 ,
149
157
jobComparer ? . Compare ( x . Job , y . Job ) ?? 0 ,
150
158
targetComparer ? . Compare ( x . Descriptor , y . Descriptor ) ?? 0 ,
0 commit comments