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

v8-profiler structure changed #4

Open
cocoto opened this issue Nov 10, 2014 · 2 comments
Open

v8-profiler structure changed #4

cocoto opened this issue Nov 10, 2014 · 2 comments

Comments

@cocoto
Copy link

cocoto commented Nov 10, 2014

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

@cocoto
Copy link
Author

cocoto commented Nov 12, 2014

I just saw that nodegrind v0.2.0 was designed for Node v0.11
I will install v0.1.8 as soon as possible and confirm my mistake.

@gwicke
Copy link
Owner

gwicke commented Nov 12, 2014

@cocoto: It would be nice to dynamically switch the behavior based on the node version, so that the latest would work with both 0.11 and 0.10. I did try a tiny bit in 5f2ca32, but I suspect that f359eca might be a problem for 0.10 as well.

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