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

Error: Cannot read properties of undefined (reading 'name') #55

Open
gentlee opened this issue Nov 22, 2023 · 0 comments
Open

Error: Cannot read properties of undefined (reading 'name') #55

gentlee opened this issue Nov 22, 2023 · 0 comments

Comments

@gentlee
Copy link

gentlee commented Nov 22, 2023

Reproduce steps:

  1. Enable sampling profiler on android device (Xiaomi Redmi Go)
  2. Disable it
  3. Download .cpuprofile
  4. Transform with transform script (without source maps)
  5. Try upload to chrome dev performance tab
  6. Got the error

Input: sampling-profiler-trace3882871943179202698.cpuprofile
Output (unzip): chrome-supported.json.zip

Transform script:

/**
 * Used to transform hermes profiler outputs to supported by chrome dev tools.
 * https://github.com/react-native-community/hermes-profile-transformer
 */

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

const hermesCpuProfilePath = 'sampling-profiler-trace3882871943179202698.cpuprofile'

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)
  })
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

No branches or pull requests

1 participant