Switch benchmarks to thread duration (#8113)

For measuring the Dart thread, we care about thread duration (tdur) rather than
wall duration (dur) because we don't want to count the time when the Dart
thread is descheduled (e.g., in preference to the raster thread).

Prior to this change, these benchmarks were mostly measuring whether the OS
decided to finish the Dart thread's time slice or hand over the CPU to the
raster thread to complete the visual part of the frame. Now we actually measure
the work done on the Dart thread.
This commit is contained in:
Adam Barth
2017-02-13 16:07:07 -08:00
committed by GitHub
parent 2a6b6ac1eb
commit be86554479
4 changed files with 41 additions and 31 deletions

View File

@@ -20,7 +20,7 @@ void main() {
}
Map<String, dynamic> build(int timeStamp, int duration) => <String, dynamic>{
'name': 'Frame', 'ph': 'X', 'ts': timeStamp, 'dur': duration
'name': 'Frame', 'ph': 'X', 'ts': timeStamp, 'tdur': duration
};
Map<String, dynamic> begin(int timeStamp) => <String, dynamic>{

View File

@@ -17,6 +17,7 @@ void main() {
'pid': 123,
'tid': 234,
'dur': 345,
'tdur': 245,
'ts': 456,
'tts': 567,
'args': <String, dynamic>{
@@ -37,6 +38,7 @@ void main() {
expect(e1.processId, 123);
expect(e1.threadId, 234);
expect(e1.duration, const Duration(microseconds: 345));
expect(e1.threadDuration, const Duration(microseconds: 245));
expect(e1.timestampMicros, 456);
expect(e1.threadTimestampMicros, 567);
expect(e1.arguments, <String, dynamic>{ 'arg1': true });
@@ -48,6 +50,7 @@ void main() {
expect(e2.processId, isNull);
expect(e2.threadId, isNull);
expect(e2.duration, isNull);
expect(e2.threadDuration, isNull);
expect(e2.timestampMicros, isNull);
expect(e2.threadTimestampMicros, isNull);
expect(e2.arguments, isNull);