Unverified Commit cf00b969 authored by Jim Graham's avatar Jim Graham Committed by GitHub

Fix semantics and transition-perf tests to parse new event format. (#47899)

parent 4f23c434
...@@ -34,9 +34,9 @@ void main() { ...@@ -34,9 +34,9 @@ void main() {
}); });
final Iterable<TimelineEvent> semanticsEvents = timeline.events.where((TimelineEvent event) => event.name == 'Semantics'); final Iterable<TimelineEvent> semanticsEvents = timeline.events.where((TimelineEvent event) => event.name == 'Semantics');
if (semanticsEvents.length != 1) if (semanticsEvents.length != 2)
fail('Expected exactly one semantics event, got ${semanticsEvents.length}'); fail('Expected exactly two semantics events, got ${semanticsEvents.length}');
final Duration semanticsTreeCreation = semanticsEvents.first.duration; final Duration semanticsTreeCreation = Duration(microseconds: semanticsEvents.last.timestampMicros - semanticsEvents.first.timestampMicros);
final String jsonEncoded = json.encode(<String, dynamic>{'initialSemanticsTreeCreation': semanticsTreeCreation.inMilliseconds}); final String jsonEncoded = json.encode(<String, dynamic>{'initialSemanticsTreeCreation': semanticsTreeCreation.inMilliseconds});
File(p.join(testOutputsDirectory, 'complex_layout_semantics_perf.json')).writeAsStringSync(jsonEncoded); File(p.join(testOutputsDirectory, 'complex_layout_semantics_perf.json')).writeAsStringSync(jsonEncoded);
......
...@@ -66,6 +66,7 @@ List<String> _allDemos = <String>[]; ...@@ -66,6 +66,7 @@ List<String> _allDemos = <String>[];
Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String outputPath) async { Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String outputPath) async {
final Map<String, List<int>> durations = <String, List<int>>{}; final Map<String, List<int>> durations = <String, List<int>>{};
Map<String, dynamic> startEvent; Map<String, dynamic> startEvent;
int frameStart;
// Save the duration of the first frame after each 'Start Transition' event. // Save the duration of the first frame after each 'Start Transition' event.
for (Map<String, dynamic> event in events) { for (Map<String, dynamic> event in events) {
...@@ -74,10 +75,19 @@ Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou ...@@ -74,10 +75,19 @@ Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou
assert(startEvent == null); assert(startEvent == null);
startEvent = event; startEvent = event;
} else if (startEvent != null && eventName == 'Frame') { } else if (startEvent != null && eventName == 'Frame') {
final String routeName = startEvent['args']['to'] as String; final String phase = event['ph'] as String;
durations[routeName] ??= <int>[]; final int timestamp = event['ts'] as int;
durations[routeName].add(event['dur'] as int); if (phase == 'B') {
startEvent = null; assert(frameStart == null);
frameStart = timestamp;
} else {
assert(phase == 'E');
final String routeName = startEvent['args']['to'] as String;
durations[routeName] ??= <int>[];
durations[routeName].add(timestamp - frameStart);
startEvent = null;
frameStart = null;
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment