Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/metrics_center/lib/src/google_benchmark.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void _parseAnItem(
) {
final String name = item[kNameKey] as String;
final Map<String, String> timeUnitMap = <String, String>{
kUnitKey: item[_kTimeUnitKey] as String
if (item.containsKey(_kTimeUnitKey)) kUnitKey: item[_kTimeUnitKey] as String
};
for (final String subResult in item.keys) {
if (!_kNonNumericalValueSubResults.contains(subResult)) {
Expand Down
27 changes: 27 additions & 0 deletions packages/metrics_center/test/example_google_benchmark.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,33 @@
"real_coefficient": 6548,
"big_o": "N",
"time_unit": "ns"
},
{
"name": "ParagraphFixture/TextBigO_BigO",
"family_index": 5,
"per_family_instance_index": 0,
"run_name": "ParagraphFixture/TextBigO",
"run_type": "aggregate",
"repetitions": 1,
"threads": 1,
"aggregate_name": "BigO",
"aggregate_unit": "time",
"cpu_coefficient": 3.8,
"real_coefficient": 3.89,
"big_o": "N",
"time_unit": "ns"
},
{
"name": "ParagraphFixture/TextBigO_RMS",
"family_index": 5,
"per_family_instance_index": 0,
"run_name": "ParagraphFixture/TextBigO",
"run_type": "aggregate",
"repetitions": 1,
"threads": 1,
"aggregate_name": "RMS",
"aggregate_unit": "percentage",
"rms": 4.89
}
]
}
7 changes: 5 additions & 2 deletions packages/metrics_center/test/google_benchmark_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ void main() {
test('GoogleBenchmarkParser parses example json.', () async {
final List<MetricPoint> points =
await GoogleBenchmarkParser.parse('test/example_google_benchmark.json');
expect(points.length, 6);
expect(points.length, 9);
expectSetMatch(
points.map((MetricPoint p) => p.value),
<int>[101, 101, 4460, 4460, 6548, 6548],
<double>[101, 101, 4460, 4460, 6548, 6548, 3.8, 3.89, 4.89],
);
expectSetMatch(
points.map((MetricPoint p) => p.tags[kSubResultKey]),
Expand All @@ -25,6 +25,7 @@ void main() {
'real_time',
'cpu_coefficient',
'real_coefficient',
'rms',
],
);
expectSetMatch(
Expand All @@ -33,6 +34,8 @@ void main() {
'BM_PaintRecordInit',
'SkParagraphFixture/ShortLayout',
'SkParagraphFixture/TextBigO_BigO',
'ParagraphFixture/TextBigO_BigO',
'ParagraphFixture/TextBigO_RMS',
],
);
for (final MetricPoint p in points) {
Expand Down