Content-Length: 313542 | pFad | http://github.com/flutter/flutter/issues/128000

9F Enable developers to run heapprofd traces on Flutter applications · Issue #128000 · flutter/flutter · GitHub
Skip to content

Enable developers to run heapprofd traces on Flutter applications #128000

@dnfield

Description

@dnfield

I'm not sure if this is just a documentation bug or something we want to actively make easier.

It's possible to run a Perfetto native heap trace on Android 9+. However, to get symbols in the trace, you need either an unstripped libflutter.so or be on Linux.

Here are the steps to get a symbolicated heapprofd trace today:

  1. Build the engine locally, using a gn invocation like the following: flutter/tools/gn --android --android-cpu arm64 --no-strip (with your preferred runtime mode/unopt settings).
  2. Add the following to your Flutter application's android/app/build.gradle:
  android {
    // Other options...
    packagingOptions {
        doNotStrip '**/libflutter.so'
    }
  }
  1. Do a flutter run --local-engine=android_debug_arm64 (replace the runtime mode to match the runtime from your locally built engine).
  2. Clone https://github.com/google/perfetto
  3. Invoke the Perfetto tools/trace_heap script: tools/trace_heap -n com.example.myAppName
  4. Interact with your application.

Perfetto will tell you where it put the heap trace file at the end. Googlers can upload that to pprof, or anyone else can upload it to https://ui.perfetto.dev/#!/viewer

It is possible for Perfetto to apply the symbols, but currently that only works on Linux (a limitation in Perfetto itself).

We should either better document how to do this somewhere, or ideally make it easier for developers to do this. For example, if Perfetto can be made to add symbols for Mac/Windows, we could instruct developers to download the symbols for their particular engine build. It may also be more feasible to just provide unstripped artifacts for e.g. debug and profile mode, and provide instructions or flags to the tool to download them and use them for heap tracing.

/cc @terrylucas @jacob314
/cc @liyuqian
/cc @segfaulthunter fyi
/cc @zanderso @jonahwilliams for input on tooling options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: http://github.com/flutter/flutter/issues/128000

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy