Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support importing simpleperf trace files from Android Studio #5212

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

nisargjhaveri
Copy link
Contributor

Fix #5203.

Attempt to add importer for simpleperf trace files. These can be generated using the simpleperf report-sample command or using Profiler UI in Android Studio.

Here is the file format details: https://cs.android.com/android/platform/superproject/main/+/main:system/extras/simpleperf/cmd_report_sample.proto

Added a couple of dependencies to work with protobuf. These will also be useful for more importers in future, I believe pprof also uses protobufs (in discussion at #4462).

This is one attempt. I'm fairly new to the codebase and Flow. Feel free to suggest any changes as required.

Copy link

codecov bot commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 96.98113% with 8 lines in your changes missing coverage. Please review.

Project coverage is 86.06%. Comparing base (28e880e) to head (a7493d9).
Report is 92 commits behind head on main.

Files with missing lines Patch % Lines
src/profile-logic/import/simpleperf.js 96.88% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5212      +/-   ##
==========================================
- Coverage   88.61%   86.06%   -2.56%     
==========================================
  Files         308      311       +3     
  Lines       28051    29582    +1531     
  Branches     7596     8156     +560     
==========================================
+ Hits        24858    25460     +602     
- Misses       2979     3542     +563     
- Partials      214      580     +366     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mstange
Copy link
Contributor

mstange commented Nov 25, 2024

Can you share an example output profile?

This importer would be nice to have. As an alternative you can also use samply import perf.data with a samply built from the main branch of https://github.com/mstange/samply .

Copy link
Contributor

@julienw julienw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks pretty good! Impressive work!

I suggested a few things, tell me what you think!
Also it would be good to have a few tests, at least one import test. See unit/profile-conversion.test.js for existing tests.

package.json Outdated Show resolved Hide resolved
src/profile-logic/import/proto/simpleperf_report.proto Outdated Show resolved Hide resolved
src/profile-logic/import/simpleperf.js Outdated Show resolved Hide resolved
src/profile-logic/import/simpleperf.js Outdated Show resolved Hide resolved
src/profile-logic/import/simpleperf.js Outdated Show resolved Hide resolved
src/profile-logic/import/simpleperf.js Outdated Show resolved Hide resolved
src/profile-logic/import/simpleperf.js Outdated Show resolved Hide resolved
src/profile-logic/import/simpleperf.js Outdated Show resolved Hide resolved
src/profile-logic/import/simpleperf.js Outdated Show resolved Hide resolved
src/profile-logic/process-profile.js Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@nisargjhaveri
Copy link
Contributor Author

@mstange Thanks for pointing out samply, seems interesting. I'll have a look! Though this only helps when you have control over the perf.data file which might not be available when exporting the profile from Android Studio.

@julienw Thanks a lot for the review. I have addressed most of the suggestions. Please have a look?

@julienw julienw self-requested a review December 3, 2024 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support importing simpleperf trace files from Android Studio
3 participants