Add --json format#103
Conversation
NickLaMuro
left a comment
There was a problem hiding this comment.
I personally like this (not that I have too much sway), since it isn't really destructive to what is already there, and very simply adds support for speedscope as well.
Tried it out (effectively... I just did a JSON.generate report.dump on a report I was already working with) and it works in the speedscope.app just fine.
lib/stackprof/report.rb
Outdated
| @@ -1,5 +1,6 @@ | |||
| require 'pp' | |||
| require 'digest/md5' | |||
| require 'json' | |||
There was a problem hiding this comment.
Could we move this into the print_json method so we are only requiring JSON when we are using it?
There was a problem hiding this comment.
Yep; makes sense.
Done
|
Sweet! I would love to get #100 merged, but this seems like a reasonable stop-gap to me! I'm in an awkward position of technically having merge rights granted in this repository, but not rubygem publish rights, and also I'm not predominately a ruby dev. @tenderlove any chance you have time to look at this and/or #100? |
Add
--jsonoutput tostack profCLI.The generated output could be used with web viewers (e.g. I want to use it with
https://www.speedscope.app/ – yeah, I've noticed that there is a PR to add out-of-the-box speedscope support; but who knows which flame graph viewer will rock in a year or two?).