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

Empty cpu profile in chrome devtool #70

Open
darren-fp opened this issue Apr 10, 2024 · 1 comment
Open

Empty cpu profile in chrome devtool #70

darren-fp opened this issue Apr 10, 2024 · 1 comment

Comments

@darren-fp
Copy link

darren-fp commented Apr 10, 2024

I tried to generate a cpu profile using the example here and it outputedt a cpu profile roughly 1.3MB in size but for some reason the cpu profile seems to be empty in chrome devtools

image

CPU profile: checkboxgroup.cpuprofile

This is how I instrumented the profiler

import * as fs from 'fs';
import * as v8Profiler from 'v8-profiler-next';

v8Profiler.setGenerateType(1);
const title = 'checkboxgroup';

describe('CheckboxGroup', () => {
  v8Profiler.startProfiling(title, true);
  afterAll(() => {
    const profile = v8Profiler.stopProfiling(title);
    profile.export(function (error, result: any) {
      // if it doesn't have the extension .cpuprofile then
      // chrome's profiler tool won't like it.
      // examine the profile:
      //   Navigate to chrome://inspect
      //   Click Open dedicated DevTools for Node
      //   Select the profiler tab
      //   Load your file
      fs.writeFileSync(`${title}.cpuprofile`, result);
      profile.delete();
    });
  });
  
  // tests...
  it('should...')
});

These are the versions that I am using

  • Chrome: Version 123.0.6312.107 (Official Build) (x86_64)
  • v8-profiler-next: 1.10.0

Is there something wrong that I am doing here? Thanks in advance!

@windschaser
Copy link

Same problem. Just use Chrome with older version, the profile displays well on version 101 base on my test.

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

2 participants