Skip to content

v8-profiler structure changed #4

@cocoto

Description

@cocoto

Problem encoutered

When I try to execute nodegrind from nodegrind XX.js, I have this error :

TypeError: Cannot read property 'functionName' of undefined
at convertProfNode (/usr/lib/node_modules/nodegrind/nodegrind.js:57:21)
at prof2cpuprofile (/usr/lib/node_modules/nodegrind/nodegrind.js:73:9)
at process.module.exports.startCPU (/usr/lib/node_modules/nodegrind/nodegrind.js:99:6)
at process.emit (events.js:95:17)

By looking at the structure of the returned object of profiler.stopProfiling('global'), topRoot doesn't exist. This is the structure of the object :

{
  "typeId": "CPU",
  "uid": 1,
  "title": "global",
  "head": {
    "functionName": "(root)",
    "url": "",
    "lineNumber": 0,
    "callUID": 3878777185,
    "totalTime": 629,
    "selfTime": 0,
    "totalSamplesCount": 604,
    "selfSamplesCount": 0,
    "children": [
      {
        "functionName": "(anonymous function)",
        "url": "node.js",
        "lineNumber": 27,
        "callUID": 132503087,
        "totalTime": 515,
        "selfTime": 0,
        "totalSamplesCount": 495,
        "selfSamplesCount": 0,
        "children": [...]
       }
    ]
},
"bottomRoot": {
    "functionName": "(root)",
    "url": "",
    "lineNumber": 0,
    "callUID": 3878777185,
    "totalTime": 629,
    "selfTime": 0,
    "totalSamplesCount": 604,
    "selfSamplesCount": 0,
    "children": [
      {
        "functionName": "/usr/lib/node_modules/nodegrind/nodegrind.js",
        "url": "",
        "lineNumber": 0,
        "callUID": 2677288670,
        "totalTime": 1,
        "selfTime": 0,
        "totalSamplesCount": 1,
        "selfSamplesCount": 0,
        "children": [...]
      }
    ]
  }
}

The structure seems to be an hybrid between node v10.X and v11.X (as you previously patched), with bottomRoot instead of topRoot

Informations

Node v0.10.33
ArchLinux x86_64 3.17.2-1-ARCH
nodegrind v0.2.0
v8-profiler v5.0.0

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