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

Merged
merged 13 commits into from
Jan 10, 2025

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
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 good to me!
I rebased and updated some part of the code that were needed after the rebase and I'm gonna land this soon!
Thanks for your patience

@julienw julienw merged commit 72ce344 into firefox-devtools:main Jan 10, 2025
15 of 16 checks passed
@julienw
Copy link
Contributor

julienw commented Jan 10, 2025

Would you want to add some limited documentation around https://profiler.firefox.com/docs/#/./guide-android-profiling ?

nisargjhaveri added a commit to nisargjhaveri/firefox-profiler that referenced this pull request Jan 10, 2025
PR firefox-devtools#5212 added support for importing simpleperf trace file format.
Update the documentation on Android profiling to reflect this.
@nisargjhaveri
Copy link
Contributor Author

Would you want to add some limited documentation around https://profiler.firefox.com/docs/#/./guide-android-profiling ?

Thanks @julienw for updating and merging. Created #5309 to update the documentation.

@julienw julienw mentioned this pull request Jan 15, 2025
julienw added a commit that referenced this pull request Jan 15, 2025
Updates:

[Nicolas Chevobbe] Adapt Keyboard shortcut dialog in High Contrast Mode. (#5245)
[Nicolas Chevobbe] Fix sidebar-toggle in High Contrast Mode. (#5246)
[Nicolas Chevobbe] Fix timeline selection overlay time / hover line in High Contrast Mode (#5247)
[Zac Spitzer] fix broken link for processed profile format (#5267)
[Greg Tatum] Update the memory allocation docs and add DHAT docs (#5270)
[Markus Stange] Simplify some code related to thread CPU deltas (#5265)
[Greg Tatum] Update dhat convertor to work better with valgrind (#5269)
[Markus Stange] Rename UniqueStringArray to StringTable. (#5283)
[Markus Stange] Use snapshot testing in the symbolicator CLI test. (#5284)
[Markus Stange] Fix two confused upgraders which didn't expect to be run on the serialized format. (#5285)
[Nicolas Chevobbe] Fix timelineSettingsHiddenTracks in High Contrast Mode. (#5250)
[Julien Wajsberg] Fix some test and non-test warnings (#5294)
[Nisarg Jhaveri] Support importing simpleperf trace files from Android Studio (#5212)
[Sean Kim] Add HTTP response status code in the profiler network tab (#5297)
[Markus Stange] Change StringTable API a bit. (#5286)
[Markus Stange] Correctly declare imported simpleperf trace profiles to be of the current version. (#5312)
[Markus Stange] Two small changes (#5313)
[Nazım Can Altınova] Show sample tooltips on sample graph hover (#5298)

Also thanks to our localizers:

en-CA: chutten
es-CL: ravmn
es-CL: ravmn
fr: Théo Chevalier
ia: Melo46
ia: Melo46
sv-SE: Andreas Pettersson
uk: Lobodzets
zh-TW: Olvcpr423
julienw pushed a commit that referenced this pull request Jan 17, 2025
…5309)

PR #5212 added support for importing simpleperf trace file format.
Update the documentation on Android profiling to reflect this.
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