Commit 770f8f1d authored by Hans Muller's avatar Hans Muller

rename TracingCategory to TimelineStream (#3822)

parent 36d437d6
......@@ -80,10 +80,10 @@ void main() {
}
}
},
categories: const <TracingCategory>[
TracingCategory.dart,
TracingCategory.gc,
TracingCategory.compiler
streams: const <TimelineStream>[
TimelineStream.dart,
TimelineStream.gc,
TimelineStream.compiler
]);
new TimelineSummary.summarize(timeline)
..writeSummaryToFile('transitions_perf', pretty: true)
......
......@@ -16,7 +16,7 @@ export 'src/driver.dart' show
CommonFinders,
EvaluatorFunction,
FlutterDriver,
TracingCategory;
TimelineStream;
export 'src/error.dart' show
DriverError,
......
......@@ -15,27 +15,27 @@ import 'health.dart';
import 'message.dart';
import 'timeline.dart';
enum TracingCategory {
enum TimelineStream {
all, api, compiler, dart, debugger, embedder, gc, isolate, vm
}
const List<TracingCategory> _defaultCategories = const <TracingCategory>[TracingCategory.all];
const List<TimelineStream> _defaultStreams = const <TimelineStream>[TimelineStream.all];
// See https://github.com/dart-lang/sdk/blob/master/runtime/vm/timeline.cc#L32
String _tracingCategoriesToString(List<TracingCategory> categories) {
final String contents = categories.map((TracingCategory category) {
switch(category) {
case TracingCategory.all: return 'all';
case TracingCategory.api: return 'API';
case TracingCategory.compiler: return 'Compiler';
case TracingCategory.dart: return 'Dart';
case TracingCategory.debugger: return 'Debugger';
case TracingCategory.embedder: return 'Embedder';
case TracingCategory.gc: return 'GC';
case TracingCategory.isolate: return 'Isolate';
case TracingCategory.vm: return 'VM';
String _timelineStreamsToString(List<TimelineStream> streams) {
final String contents = streams.map((TimelineStream stream) {
switch(stream) {
case TimelineStream.all: return 'all';
case TimelineStream.api: return 'API';
case TimelineStream.compiler: return 'Compiler';
case TimelineStream.dart: return 'Dart';
case TimelineStream.debugger: return 'Debugger';
case TimelineStream.embedder: return 'Embedder';
case TimelineStream.gc: return 'GC';
case TimelineStream.isolate: return 'Isolate';
case TimelineStream.vm: return 'VM';
default:
throw 'Unknown tracing category $category';
throw 'Unknown timeline stream $stream';
}
}).join(', ');
return '[$contents]';
......@@ -249,11 +249,11 @@ class FlutterDriver {
}
/// Starts recording performance traces.
Future<Null> startTracing({List<TracingCategory> categories: _defaultCategories}) async {
assert(categories != null && categories.length > 0);
Future<Null> startTracing({List<TimelineStream> streams: _defaultStreams}) async {
assert(streams != null && streams.length > 0);
try {
await _peer.sendRequest(_kSetVMTimelineFlagsMethod, <String, String>{
'recordedStreams': _tracingCategoriesToString(categories)
'recordedStreams': _timelineStreamsToString(streams)
});
return null;
} catch(error, stackTrace) {
......@@ -286,8 +286,8 @@ class FlutterDriver {
///
/// This is merely a convenience wrapper on top of [startTracing] and
/// [stopTracingAndDownloadTimeline].
Future<Timeline> traceAction(Future<dynamic> action(), { List<TracingCategory> categories: _defaultCategories }) async {
await startTracing(categories: categories);
Future<Timeline> traceAction(Future<dynamic> action(), { List<TimelineStream> streams: _defaultStreams }) async {
await startTracing(streams: streams);
await action();
return stopTracingAndDownloadTimeline();
}
......
......@@ -236,8 +236,8 @@ void main() {
});
});
group('traceAction categories', () {
test('specify non-default categories', () async {
group('traceAction with timeline streams', () {
test('specify non-default timeline streams', () async {
bool actionCalled = false;
bool startTracingCalled = false;
bool stopTracingCalled = false;
......@@ -267,10 +267,10 @@ void main() {
Timeline timeline = await driver.traceAction(() {
actionCalled = true;
},
categories: const <TracingCategory>[
TracingCategory.dart,
TracingCategory.gc,
TracingCategory.compiler
streams: const <TimelineStream>[
TimelineStream.dart,
TimelineStream.gc,
TimelineStream.compiler
]);
expect(actionCalled, isTrue);
......
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