Allow the engine to redirect traces to systrace via settings. (flutter/engine#7617)

This commit is contained in:
Chinmay Garde
2019-01-28 17:39:31 -08:00
committed by GitHub
parent 3fe8f944da
commit e361547b05
5 changed files with 26 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ struct Settings {
bool start_paused = false;
bool trace_skia = false;
bool trace_startup = false;
bool trace_systrace = false;
bool endless_trace_buffer = false;
bool enable_dart_profiling = false;
bool disable_dart_asserts = false;

View File

@@ -90,8 +90,15 @@ static const char* kDartEndlessTraceBufferArgs[]{
"--timeline_recorder=endless",
};
static const char* kDartSystraceTraceBufferArgs[]{
"--timeline_recorder=systrace",
};
static const char* kDartFuchsiaTraceArgs[] FML_ALLOW_UNUSED_TYPE = {
"--systrace_timeline",
};
static const char* kDartTraceStreamsArgs[] = {
"--timeline_streams=Compiler,Dart,Debugger,Embedder,GC,Isolate,VM",
};
@@ -361,12 +368,19 @@ DartVM::DartVM(const Settings& settings,
arraysize(kDartEndlessTraceBufferArgs));
}
if (settings.trace_systrace) {
PushBackAll(&args, kDartSystraceTraceBufferArgs,
arraysize(kDartSystraceTraceBufferArgs));
PushBackAll(&args, kDartTraceStreamsArgs, arraysize(kDartTraceStreamsArgs));
}
if (settings.trace_startup) {
PushBackAll(&args, kDartTraceStartupArgs, arraysize(kDartTraceStartupArgs));
}
#if defined(OS_FUCHSIA)
PushBackAll(&args, kDartFuchsiaTraceArgs, arraysize(kDartFuchsiaTraceArgs));
PushBackAll(&args, kDartTraceStreamsArgs, arraysize(kDartTraceStreamsArgs));
#endif
for (size_t i = 0; i < settings.dart_flags.size(); i++)

View File

@@ -231,6 +231,8 @@ blink::Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE
settings.trace_skia =
command_line.HasOption(FlagForSwitch(Switch::TraceSkia));
settings.trace_systrace =
command_line.HasOption(FlagForSwitch(Switch::TraceSystrace));
#endif
return settings;

View File

@@ -104,6 +104,12 @@ DEF_SWITCH(TraceSkia,
"Trace Skia calls. This is useful when debugging the GPU threed."
"By default, Skia tracing is not enable to reduce the number of "
"traced events")
DEF_SWITCH(
TraceSystrace,
"trace-systrace",
"Trace to the system tracer (instead of the timeline) on platforms where "
"such a tracer is available. Currently only supported on Android and "
"Fuchsia.")
DEF_SWITCH(UseTestFonts,
"use-test-fonts",
"Running tests that layout and measure text will not yield "

View File

@@ -312,6 +312,9 @@ public final class FlutterActivityDelegate
if (intent.getBooleanExtra("trace-skia", false)) {
args.add("--trace-skia");
}
if (intent.getBooleanExtra("trace-systrace", false)) {
args.add("--trace-systrace");
}
if (intent.getBooleanExtra("verbose-logging", false)) {
args.add("--verbose-logging");
}