Skip to content

Empty cpu profile in chrome devtool #70

Description

@darren-fp

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions