Skip to content

Commit

Permalink
Add a trace-skia-allowlist flag for filtering Skia trace events (#83507)
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons committed Jun 1, 2021
1 parent 6ba37a3 commit 59f6cc7
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 15 deletions.
4 changes: 3 additions & 1 deletion packages/flutter_tools/lib/src/android/android_device.dart
Expand Up @@ -632,7 +632,9 @@ class AndroidDevice extends Device {
if (debuggingOptions.traceSkia)
...<String>['--ez', 'trace-skia', 'true'],
if (debuggingOptions.traceAllowlist != null)
...<String>['--ez', 'trace-allowlist', debuggingOptions.traceAllowlist],
...<String>['--es', 'trace-allowlist', debuggingOptions.traceAllowlist],
if (debuggingOptions.traceSkiaAllowlist != null)
...<String>['--es', 'trace-skia-allowlist', debuggingOptions.traceSkiaAllowlist],
if (debuggingOptions.traceSystrace)
...<String>['--ez', 'trace-systrace', 'true'],
if (debuggingOptions.endlessTraceBuffer)
Expand Down
7 changes: 7 additions & 0 deletions packages/flutter_tools/lib/src/commands/run.dart
Expand Up @@ -127,6 +127,12 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
'this comma separated list of allowed prefixes.',
valueHelp: 'foo,bar',
)
..addOption('trace-skia-allowlist',
hide: !verboseHelp,
help: 'Filters out all Skia trace events except those that are specified in '
'this comma separated list of allowed prefixes.',
valueHelp: 'skia.gpu,skia.shaders',
)
..addMultiOption('dart-entrypoint-args',
abbr: 'a',
help: 'Pass a list of arguments to the Dart entrypoint at application '
Expand Down Expand Up @@ -199,6 +205,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
skiaDeterministicRendering: argParser.options.containsKey('skia-deterministic-rendering') && boolArg('skia-deterministic-rendering'),
traceSkia: boolArg('trace-skia'),
traceAllowlist: traceAllowlist,
traceSkiaAllowlist: stringArg('trace-skia-allowlist'),
traceSystrace: boolArg('trace-systrace'),
endlessTraceBuffer: boolArg('endless-trace-buffer'),
dumpSkpOnShaderCompilation: dumpSkpOnShaderCompilation,
Expand Down
3 changes: 3 additions & 0 deletions packages/flutter_tools/lib/src/desktop_device.dart
Expand Up @@ -251,6 +251,9 @@ abstract class DesktopDevice extends Device {
if (debuggingOptions.traceAllowlist != null) {
addFlag('trace-allowlist=${debuggingOptions.traceAllowlist}');
}
if (debuggingOptions.traceSkiaAllowlist != null) {
addFlag('trace-skia-allowlist=${debuggingOptions.traceSkiaAllowlist}');
}
if (debuggingOptions.traceSystrace) {
addFlag('trace-systrace=true');
}
Expand Down
3 changes: 3 additions & 0 deletions packages/flutter_tools/lib/src/device.dart
Expand Up @@ -724,6 +724,7 @@ class DebuggingOptions {
this.skiaDeterministicRendering = false,
this.traceSkia = false,
this.traceAllowlist,
this.traceSkiaAllowlist,
this.traceSystrace = false,
this.endlessTraceBuffer = false,
this.dumpSkpOnShaderCompilation = false,
Expand Down Expand Up @@ -772,6 +773,7 @@ class DebuggingOptions {
enableSoftwareRendering = false,
skiaDeterministicRendering = false,
traceSkia = false,
traceSkiaAllowlist = null,
traceSystrace = false,
endlessTraceBuffer = false,
dumpSkpOnShaderCompilation = false,
Expand Down Expand Up @@ -800,6 +802,7 @@ class DebuggingOptions {
final bool skiaDeterministicRendering;
final bool traceSkia;
final String traceAllowlist;
final String traceSkiaAllowlist;
final bool traceSystrace;
final bool endlessTraceBuffer;
final bool dumpSkpOnShaderCompilation;
Expand Down
1 change: 1 addition & 0 deletions packages/flutter_tools/lib/src/ios/devices.dart
Expand Up @@ -363,6 +363,7 @@ class IOSDevice extends Device {
if (debuggingOptions.skiaDeterministicRendering) '--skia-deterministic-rendering',
if (debuggingOptions.traceSkia) '--trace-skia',
if (debuggingOptions.traceAllowlist != null) '--trace-allowlist="${debuggingOptions.traceAllowlist}"',
if (debuggingOptions.traceSkiaAllowlist != null) '--trace-skia-allowlist="${debuggingOptions.traceSkiaAllowlist}"',
if (debuggingOptions.endlessTraceBuffer) '--endless-trace-buffer',
if (debuggingOptions.dumpSkpOnShaderCompilation) '--dump-skp-on-shader-compilation',
if (debuggingOptions.verboseSystemLogs) '--verbose-logging',
Expand Down
1 change: 1 addition & 0 deletions packages/flutter_tools/lib/src/ios/simulators.dart
Expand Up @@ -460,6 +460,7 @@ class IOSSimulator extends Device {
if (debuggingOptions.skiaDeterministicRendering) '--skia-deterministic-rendering',
if (debuggingOptions.useTestFonts) '--use-test-fonts',
if (debuggingOptions.traceAllowlist != null) '--trace-allowlist="${debuggingOptions.traceAllowlist}"',
if (debuggingOptions.traceSkiaAllowlist != null) '--trace-skia-allowlist="${debuggingOptions.traceSkiaAllowlist}"',
if (dartVmFlags.isNotEmpty) '--dart-flags=$dartVmFlags',
'--observatory-port=${debuggingOptions.hostVmServicePort ?? 0}'
],
Expand Down
1 change: 1 addition & 0 deletions packages/flutter_tools/lib/src/windows/windows_device.dart
Expand Up @@ -355,6 +355,7 @@ class WindowsUWPDevice extends Device {
if (debuggingOptions.skiaDeterministicRendering) '--skia-deterministic-rendering',
if (debuggingOptions.traceSkia) '--trace-skia',
if (debuggingOptions.traceAllowlist != null) '--trace-allowlist="${debuggingOptions.traceAllowlist}"',
if (debuggingOptions.traceSkiaAllowlist != null) '--trace-skia-allowlist="${debuggingOptions.traceSkiaAllowlist}"',
if (debuggingOptions.endlessTraceBuffer) '--endless-trace-buffer',
if (debuggingOptions.dumpSkpOnShaderCompilation) '--dump-skp-on-shader-compilation',
if (debuggingOptions.verboseSystemLogs) '--verbose-logging',
Expand Down
Expand Up @@ -240,7 +240,8 @@ void main() {
'--ez', 'enable-software-rendering', 'true',
'--ez', 'skia-deterministic-rendering', 'true',
'--ez', 'trace-skia', 'true',
'--ez', 'trace-allowlist', 'bar,baz',
'--es', 'trace-allowlist', 'bar,baz',
'--es', 'trace-skia-allowlist', 'skia.a,skia.b',
'--ez', 'trace-systrace', 'true',
'--ez', 'endless-trace-buffer', 'true',
'--ez', 'dump-skp-on-shader-compilation', 'true',
Expand Down Expand Up @@ -270,6 +271,7 @@ void main() {
skiaDeterministicRendering: true,
traceSkia: true,
traceAllowlist: 'bar,baz',
traceSkiaAllowlist: 'skia.a,skia.b',
traceSystrace: true,
endlessTraceBuffer: true,
dumpSkpOnShaderCompilation: true,
Expand Down
28 changes: 15 additions & 13 deletions packages/flutter_tools/test/general.shard/desktop_device_test.dart
Expand Up @@ -153,19 +153,20 @@ void main() {
'FLUTTER_ENGINE_SWITCH_5': 'skia-deterministic-rendering=true',
'FLUTTER_ENGINE_SWITCH_6': 'trace-skia=true',
'FLUTTER_ENGINE_SWITCH_7': 'trace-allowlist=foo,bar',
'FLUTTER_ENGINE_SWITCH_8': 'trace-systrace=true',
'FLUTTER_ENGINE_SWITCH_9': 'endless-trace-buffer=true',
'FLUTTER_ENGINE_SWITCH_10': 'dump-skp-on-shader-compilation=true',
'FLUTTER_ENGINE_SWITCH_11': 'cache-sksl=true',
'FLUTTER_ENGINE_SWITCH_12': 'purge-persistent-cache=true',
'FLUTTER_ENGINE_SWITCH_13': 'enable-checked-mode=true',
'FLUTTER_ENGINE_SWITCH_14': 'verify-entry-points=true',
'FLUTTER_ENGINE_SWITCH_15': 'start-paused=true',
'FLUTTER_ENGINE_SWITCH_16': 'disable-service-auth-codes=true',
'FLUTTER_ENGINE_SWITCH_17': 'dart-flags=--null_assertions',
'FLUTTER_ENGINE_SWITCH_18': 'use-test-fonts=true',
'FLUTTER_ENGINE_SWITCH_19': 'verbose-logging=true',
'FLUTTER_ENGINE_SWITCHES': '19'
'FLUTTER_ENGINE_SWITCH_8': 'trace-skia-allowlist=skia.a,skia.b',
'FLUTTER_ENGINE_SWITCH_9': 'trace-systrace=true',
'FLUTTER_ENGINE_SWITCH_10': 'endless-trace-buffer=true',
'FLUTTER_ENGINE_SWITCH_11': 'dump-skp-on-shader-compilation=true',
'FLUTTER_ENGINE_SWITCH_12': 'cache-sksl=true',
'FLUTTER_ENGINE_SWITCH_13': 'purge-persistent-cache=true',
'FLUTTER_ENGINE_SWITCH_14': 'enable-checked-mode=true',
'FLUTTER_ENGINE_SWITCH_15': 'verify-entry-points=true',
'FLUTTER_ENGINE_SWITCH_16': 'start-paused=true',
'FLUTTER_ENGINE_SWITCH_17': 'disable-service-auth-codes=true',
'FLUTTER_ENGINE_SWITCH_18': 'dart-flags=--null_assertions',
'FLUTTER_ENGINE_SWITCH_19': 'use-test-fonts=true',
'FLUTTER_ENGINE_SWITCH_20': 'verbose-logging=true',
'FLUTTER_ENGINE_SWITCHES': '20'
}
),
]);
Expand All @@ -186,6 +187,7 @@ void main() {
skiaDeterministicRendering: true,
traceSkia: true,
traceAllowlist: 'foo,bar',
traceSkiaAllowlist: 'skia.a,skia.b',
traceSystrace: true,
endlessTraceBuffer: true,
dumpSkpOnShaderCompilation: true,
Expand Down

0 comments on commit 59f6cc7

Please sign in to comment.