Instrument vm service extensions in the gallery (#17977)

https://github.com/flutter/flutter/issues/17956

* Add a `debugInstrumentAction()` method that will wrap an action
  in a stopwatch and print the time it took to run the action.
* Add a global `debugInstrumentationEnabled` that will control
  whether `debugInstrumentAction()` does anything (even in debug
  builds).
* Add some basic instrumentation to `registerServiceExtension()`
* Temporarily enable the `debugInstrumentationEnabled` flag in the
  Gallery to give us better visibility into what's happening in
  https://github.com/flutter/flutter/issues/17956
This commit is contained in:
Todd Volkert
2018-05-28 12:40:43 -07:00
committed by GitHub
parent d21b2799a0
commit 7c60b7405a
4 changed files with 135 additions and 1 deletions

View File

@@ -5,11 +5,15 @@
// Thanks for checking out Flutter!
// Like what you see? Tweet us @flutterio
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'gallery/app.dart';
void main() {
// Temporary debugging hook for https://github.com/flutter/flutter/issues/17956
debugInstrumentationEnabled = true;
// Overriding https://github.com/flutter/flutter/issues/13736 for better
// visual effect at the cost of performance.
MaterialPageRoute.debugEnableFadingRoutes = true; // ignore: deprecated_member_use