@@ -63,11 +63,15 @@ public static Benchit clear() {
63
63
return singleton .clearInternal ();
64
64
}
65
65
66
- public static ComparisonResult compare (Stat orderBy , String ... tags ) {
66
+ public static ComparisonResult compare (Stat orderBy , Order order , String ... tags ) {
67
67
if (singleton == null ) {
68
68
singleton = get ();
69
69
}
70
- return singleton .compareInternal (orderBy , tags );
70
+ return singleton .compareInternal (orderBy , order , tags );
71
+ }
72
+
73
+ public static ComparisonResult compare (Stat orderBy , String ... tags ) {
74
+ return compare (orderBy , Order .ASCENDING , tags );
71
75
}
72
76
73
77
public static void setDefaultPrecision (Precision precision ) {
@@ -112,13 +116,24 @@ private Benchit clearInternal() {
112
116
return this ;
113
117
}
114
118
115
- private ComparisonResult compareInternal (Stat orderBy , String ... tags ) {
119
+ private ComparisonResult compareInternal (Stat orderBy , Order order , String ... tags ) {
116
120
ArrayList <Result > results = new ArrayList <>();
117
- for (String tag : tags ) {
118
- results .add (analyzeInternal (tag ));
121
+
122
+ if (tags .length == 0 ) {
123
+ for (String tag : benchmarks .keySet ()) {
124
+ results .add (analyzeInternal (tag ));
125
+ }
126
+ } else {
127
+ for (String tag : tags ) {
128
+ results .add (analyzeInternal (tag ));
129
+ }
119
130
}
120
131
121
- return new ComparisonResult (results );
132
+ return new ComparisonResult (orderBy , order , results );
133
+ }
134
+
135
+ static void log (String message ) {
136
+ Log .d (TAG , message );
122
137
}
123
138
124
139
static void log (String type , String tag , String result ) {
@@ -141,6 +156,10 @@ public static enum Stat {
141
156
AVERAGE , RANGE , STANDARD_DEVIATION
142
157
}
143
158
159
+ public static enum Order {
160
+ ASCENDING , DESCENDING
161
+ }
162
+
144
163
public static enum Precision {
145
164
NANO ("ns" , 1 ),
146
165
MICRO ("µs" , 1000 ),
0 commit comments