thlorenz / flamegraph

Generates flamegraphs with Node.js or in the browser.
http://thlorenz.github.io/flamegraph/web/
MIT License
165 stars 28 forks source link

Unable to detect input type for… #11

Open garthk opened 9 years ago

garthk commented 9 years ago

After taking a trace from node 0.12.2 using Instruments 6.3.1, and exporting the Call Tree as 27200.csv:

$ cat 27200.csv | flamegraph --inputtype instruments > 27200.svg && open 27200.svg
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: Unable to detect input type for 
"Running Time,Self (ms),,Symbol Name"
    at getConverter (/usr/local/lib/node_modules/flamegraph/node_modules/cpuprofilify/lib/get-converter.js:27:9)
    at CpuProfilifier.convert (/usr/local/lib/node_modules/flamegraph/node_modules/cpuprofilify/index.js:70:26)
    at flamegraph (/usr/local/lib/node_modules/flamegraph/index.js:47:30)
    at ondata (/usr/local/lib/node_modules/flamegraph/from-stream.js:35:17)
    at ConcatStream.<anonymous> (/usr/local/lib/node_modules/flamegraph/node_modules/concat-stream/index.js:36:43)
    at ConcatStream.emit (events.js:129:20)
    at finishMaybe (/usr/local/lib/node_modules/flamegraph/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:460:14)
    at endWritable (/usr/local/lib/node_modules/flamegraph/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:469:3)
    at ConcatStream.Writable.end (/usr/local/lib/node_modules/flamegraph/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:436:5)
    at Socket.onend (_stream_readable.js:505:10)

I've also tried flamegraph -t instruments. I'm not sure why cpuprofilify is trying to detect the input type. Does flamegraph not pass its --inputtype?

phillipj commented 9 years ago

This is a cpuprofilify issue, just opened a PR fixing it.

phillipj commented 9 years ago

FYI @garthk edit your .csv by removing (ms) from the first line. That should fix your issue while waiting for the PR to merge

garthk commented 9 years ago

Thanks for the workaround!

bringingkatigbak commented 8 years ago

likewise, thanks for the workaround! however, how are you getting the memory addresses mapped to the function names? (the webapp uses the pid-n.map)

phillipj commented 8 years ago

@bringingkatigbak Its been a while since I've used this. Could it be you need the --map parameter I tried to expose in https://github.com/thlorenz/cpuprofilify/pull/5 ?

bringingkatigbak commented 8 years ago

@phillipj I see that thlorenz/flamegraph consumes thlorenz/cpuprofilify which both have pull requests to support the -m option. how do these two pull request reconcile with each other?

github.com/thlorenz/cpuprofilify/pull/5 github.com/thlorenz/flamegraph/pull/12

phillipj commented 8 years ago

@bringingkatigbak both cpuprofilify and flamegraph comes with an CLI tool in addition to the npm module you normally require() in the code. As far as I see they could both be merged as they add --map to their respective CLI tool.