0.0.9 • Published 4 years ago

hermes-profile-transformer v0.0.9

Weekly downloads
355,307
License
MIT
Repository
github
Last release
4 years ago

Visualize Facebook's Hermes JavaScript runtime profile traces in Chrome Developer Tools.

Demo Profile

Overview

The Hermes runtime, used by React Native for Android, is able to output Chrome Trace Events in JSON Object Format.

This TypeScript package converts Hermes CPU profiles to Chrome Developer Tools compatible JSON Array Format, and enriches it with line and column numbers and event categories from JavaScript source maps.

Usage

If you're using hermes-profile-transformer to debug React Native Android applications, you can use the React Native CLI react-native profile-hermes command, which uses this package to convert the downloaded Hermes profiles automatically.

As a standalone package

const transformer = require('hermes-profile-transformer').default;
const { writeFileSync } = require('fs');

const hermesCpuProfilePath = './testprofile.cpuprofile';
const sourceMapPath = './index.map';
const sourceMapBundleFileName = 'index.bundle.js';

transformer(
  // profile path is required
  hermesCpuProfilePath,
  // source maps are optional
  sourceMap,
  sourceMapBundleFileName
)
  .then(events => {
    // write converted trace to a file
    return writeFileSync(
      './chrome-supported.json',
      JSON.stringify(events, null, 2),
      'utf-8'
    );
  })
  .catch(err => {
    console.log(err);
  });

Creating Hermes CPU Profiles

Opening converted profiles in Chrome Developer Tools

Open Developer Tools in Chrome, navigate to the Performance tab, and use the Load profile... feature.

Loading the Profile

API

transformer(profilePath: string, sourceMapPath?: string, bundleFileName?: string)

Parameters

ParameterTypeRequiredDescription
profilePathstringYesPath to a JSON-formatted .cpuprofile file created by the Hermes runtime
sourceMapPathstringNoPath to a source-map compatible Source Map file
bundleFileNamestringNoIf sourceMapPath is provided, you need to also provide the name of the JavaScript bundle file that the source map applies to. This file does not need to exist on disk.

Returns

Promise<DurationEvent[]>, where DurationEvent is as defined in EventInterfaces.ts.

Resources

LICENSE

MIT

easy-select-rnreact-native-bluetooth2react-native-template-rfbaseairscanairscan-examplereact-native-esc-pos-sahaab@borisovart/atol-kkt-moduledeneme323112@ntt_app/react-native-custom-notificationreact-native-custom-text-hwjamesreact-native-covid-sdkreact-native-printer-brothersreact-native-shekhar-bridge-testwilscanner@oiti/documentoscopy-react-nativequoc-testreact-native-slider-kf@infinitebrahmanuniverse/nolb-herluminos-ui-core@everything-registry/sub-chunk-1840jawwy-sdkjawwy_gamification_releasereact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgreact-native-jawwy_samplenative-date-picker-modulenative-modal-damage-vehiclenative-kakao-loginnative-google-loginnative-apple-loginnew-awesome-4321nove-repositorynpm_qwertynpm_one_12_34_1_npm_one_1_2_3npm_one_2_2@valifysolutions/react-native-vidvliveness@trackier/react-native-trackier@tg1518/react-native-lewin-aliyunplayer@thinxviewx/core-rn@status-im/react-native-transparent-video@taingo97/react-native-awesome-module@taingo97/react-native-bluetooth-escpos-printer@taingo97/react-native-bluetooth-xprinter@taingo97/react-native-expo-key-rsa-kt@taingo97/react-native-expo-rsa@taingo97/react-native-generate-key-rsa@taingo97/react-native-key-rsa@taingo97/react-native-print-xprinter@taingo97/react-native-rsa@taingo97/react-native-rsa-expo@taingo97/react-native-sunmi-printer@taingo97/react-native-telpo-printer@tasumaniadiabori/react-native-draggable-flatlist@wecraftapps/react-native-use-keyboard@vidit-me/react-native-wheelyagent-get-agentact_mvvm_shop_cartadyen-rnaffinidi-auth-sdk-kernel@amirdiafi/react-native-ios-hapticsawesome-module-kd@assystant/firebasebirken-react-native-community-image-editorbiometric-st@ali5049/react-native-buttons@azalpacir/react-native-dhp-printer@aysea/react-native-ui-library@con-test/react-native-concent-common@baloochat/react-native-svg-uri@cs6/react-native-test-native-view-library@damruravihara/react-native-testing-package@damian.lnc/coreconvert-hermes-profiler@blusalt-sdk/react-native-blusalt-document-verification@brantalikp/rn-resizejawwy_library_newjawy_library_v1gamification-jawwy-libraryframework_test_library_sixdee_new_jawwyraact-native-arunramya151reac-native-arun-ramya-testreact-native-app-bubblereact-native-app-integrity-checksumreact-native-azure-communication-servicesreact-native-basic-appreact-native-basic-screenreact-native-biometric-authenticatereact-native-auth-service-clientreact-native-aventonfacetec-aventonreact-native-badge-controlreact-native-awesome-android-123react-native-awesome-android-123-zeotapreact-native-awesome-module-latestreact-native-awesome-module-tworeact-native-animate-textreact-native-android-video-player-viewreact-native-android-scoped-storage
0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago