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() {
});
final Iterable<TimelineEvent> semanticsEvents = timeline.events.where((TimelineEvent event) => event.name == 'Semantics');
if (semanticsEvents.length != 1)
fail('Expected exactly one semantics event, got ${semanticsEvents.length}');
final Duration semanticsTreeCreation = semanticsEvents.first.duration;
if (semanticsEvents.length != 2)
fail('Expected exactly two semantics events, got ${semanticsEvents.length}');
final Duration semanticsTreeCreation = Duration(microseconds: semanticsEvents.last.timestampMicros - semanticsEvents.first.timestampMicros);
final String jsonEncoded = json.encode(<String, dynamic>{'initialSemanticsTreeCreation': semanticsTreeCreation.inMilliseconds});
File(p.join(testOutputsDirectory, 'complex_layout_semantics_perf.json')).writeAsStringSync(jsonEncoded);
......
......@@ -66,6 +66,7 @@ List<String> _allDemos = <String>[];
Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String outputPath) async {
final Map<String, List<int>> durations = <String, List<int>>{};
Map<String, dynamic> startEvent;
int frameStart;
// Save the duration of the first frame after each 'Start Transition' event.
for (Map<String, dynamic> event in events) {
......@@ -74,10 +75,19 @@ Future<void> saveDurationsHistogram(List<Map<String, dynamic>> events, String ou
assert(startEvent == null);
startEvent = event;
} else if (startEvent != null && eventName == 'Frame') {
final String routeName = startEvent['args']['to'] as String;
durations[routeName] ??= <int>[];
durations[routeName].add(event['dur'] as int);
startEvent = null;
final String phase = event['ph'] as String;
final int timestamp = event['ts'] as int;
if (phase == 'B') {
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