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

feat: add a command to download the Hermes Sampling Profiler to a local machine #1246

Merged
merged 68 commits into from
Sep 4, 2020

Conversation

jessieAnhNguyen
Copy link
Contributor

@jessieAnhNguyen jessieAnhNguyen commented Aug 13, 2020

Summary:


This PR implements a new command to download the Hermes Sampling Profiler to a local machine.

This command is built as part of the goal to visualize the performance of JavaScript running on Hermes in a React Native app.
@saphal1998 and I worked on this under @axemclion and @jevakallio guidance.

1. Purpose:

  • This new command helps users convert a Hermes tracing profile to Chrome tracing profile and pull it to the local machine
  • Instructions on how to use Hermes: Using Hermes
  • The hermes-profile-transformer tool that converts Hermes tracing profile to Chrome tracing profile Hermes-profile-transformer package

2. Usage:

react-native profile-hermes [destinationDir] <flag>
  • destinationDir is optional; if provided, pull the file to that directory

    default: pull to the current React Native app root directory

Options

  • --filename [string]

File name of the profile to be downloaded, ex. sampling-profiler-trace8593107139682635366.cpuprofile

default: pull the latest file

  • --verbose

Lists commands and steps that are run internally to pull the file from Android device

  • --raw

Pulls the original Hermes tracing profile without any transformation

  • --sourcemap-path [string]

The local path to your source map file if you generated it manually, ex. /tmp/sourcemap.json

  • --generate-sourcemap

Generate the JS bundle and source map in os.tmpdir()

Notes on source map

  • Source map is used to enhance the profile and associate trace events with the application code
  • This step is recommended in order for the source map to be generated:

If you are planning on building a debug APK, that will run without the packager, by invoking ./gradlew assembleDebug you can simply set bundleInDebug: true in your app/build.gradle file, inside the project.ext.react map.

Test Plan:


  • yarn
  • yarn lint
  • Test on a React Native app: follow the instructions on the CLI's Testing Plan
  • Command react-native profile-hermes as per instruction above

Example output of running the command

image

image

jessieAnhNguyen and others added 30 commits July 7, 2020 20:13
Implemented command to download the Hermes Sampling Profiler to a local machine
Integrated transformer tool into CLI
implemented @todo get only the .cpuprofile from cache/
add a few verbose logs
edited profile-hermes.md
add the usage to commands.md
delete the profile-hermes.md
This was referenced Mar 13, 2021
@BrendonSled
Copy link
Contributor

BrendonSled commented Mar 18, 2021

is there no appId flag?

Would really be nice to have this included:

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.

7 participants