flutterdartgoogle-chrome-devtoolsprofilingflutterdriver

Do you know any dart dev tool to properly view exported timeline information from dart VM?


I am trying to create automated performance profiling test for our application. At the moment dart allows collecting cpu samples and timeline info as well as dumping that into json file. Example:

driver = await FlutterDriver.connect(printCommunication: true).timeout(appConnectTimeout);
vms = await vmServiceConnectUri(vmUrl);
isolate = await driver.appIsolate.loadRunnable();
expect((await vms.setFlag("profiler", "true")), isA<Success>());
await driver.startTracing();
...
CpuSamples cpuSamples = await vms.getCpuSamples(
    (await vms.getVM()).isolates.first.id,
    isolate.startTime.microsecondsSinceEpoch,
    (new DateTime.now()).microsecondsSinceEpoch
  );
flutter_timeline.Timeline timeline = await driver.stopTracingAndDownloadTimeline();
await TimelineSummary.summarize(timeline).writeTimelineToFile("main", pretty: true);    

But it is possible to view the timeline.json file only in chrome developer tools which don't provide enough information about dart execution. What I am looking for something that will provide me with same capabilities as Observatory web page but with imported main.timeline.json results. Do you know anything like this?

Ideally I would like to open Observatory page and upload this timeline there and be able to see timeline, cpu table, call tree, navigate through executed code and see which parts were not executed, etc. Well, do all the things I can do with Observatory running for a live VM. Do you have any tools in mind?

Question 2: Why within this code I have cpuSamples.samples empty list while cpuSamples.functions is fully populated?

Question 3: Why chrome dev tools are able to see my app function names using the dump from the code above while dart dev tools are not able to read those and reference encoded function names in dynamic library (compiled .so file of my app). The app is running with --debug mode for now because I don't have physical device ATM


Solution

  • The issue gone by itself while discussing it with google here so look for a solution in thread along with source code: https://github.com/dart-lang/sdk/issues/42591