-
Notifications
You must be signed in to change notification settings - Fork 241
Simplify go-torch: use raw pprof output, and use go-flags #29
Conversation
Add simple runner which runs pprof given a set of Options.
|
this is a hoog change. i will try to get to this tomorrow, but more likely it will be this weekend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this syntax preferable over new(options)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's any strong preferences - new was kind of the predecessor to the &T{} syntax. There's a few online discussions about wanting to remove new but it'll stay because of backwards compatibility.
I tend to prefer &T{}
|
Yeah, it's a huge change, I got a little carried away with the refactoring. Don't need to review immediately - early next week is fine, thanks! |
|
@prashantv thank you for putting in a lot of work/time to make these improvements! If you don't mind, I'd like to review these changes, too. I'm pretty busy with classes and clubs, but I can definitely have it reviewed by early next week. |
Use []byte everywhere for now rather than streams to keep it simple. Still need to add tests for ensuring running commands works
Add tests to validate that go-torch runs correctly.
It represents a state in the parsing state machine.
|
@sandlerben sure, if you can review by early next week that'd be great! |
|
@prashantv just to keep you updated, I plan to review it tomorrow. |
|
When I call It looks like "application options" are getting printed twice. Also, what does "Failed: could not parse options: Usage:" mean? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flamegraph.pl is in my path but for some reason I am getting the no perl script error. Do you know what might be going on?
$ which flamegraph.pl
/usr/local/bin/flamegraph.pl
$ go-torch --time=10
2015/09/15 15:00:07 Failed: could not collapse stacks: Cannot find flamegraph scripts in the PATH or current directory. You can download the script at https://github.com/brendangregg/FlameGraph. These scripts should be added to your PATH or in the directory where go-torch is executed. Alternatively, you can run go-torch with the --raw flag.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also doesn't work even when flamegraph.pl is in the current directory. Very weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have stackcollapse.pl - it's failing on collapsing stacks which uses stackcollapse? I'll make the error message more descriptive about which script failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, no I don't. So we need both of those now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked into what stack collapsing does, it was pretty trivial so just implemented it. No longer need it.
|
@prashantv I made a few small comments. Once you make those, I'll look it over one more time and then it should be good to merge. On an unrelated note, it's sad to see most of my summer's work being deleted but awesome to see how much better go-torch will work now. 😢 😀 |
Help message should not be printed twice with an error
|
@sandlerben Thank you for the review! I've moved As for the code - I wish we'd known about the raw output before, since it really simplified it a lot. Your work was still useful though -- productionizing it, and figuring out how to put the pieces together, since the overall flow of data is still the same :) @sectioneight did you want to review this change as well? |
|
Still haven't had time to take a real look. Go ahead and merge. |
|
Maybe I can try to find a (lightweight) way to add color back later. |
|
Thanks for reviewing @sandlerben We can definitely add colour back as a separate PR - we can use the color package, or there's also colog: I think we really need a minimal amount of support though, so we could just get a couple of escape codes (cyan for info prints, red for errors) rather than adding a new dependency. |
Simplify go-torch: use raw pprof output, and use go-flags
Simplify go-torch:
A lot of logic has been moved around into 2 packages:
pprof: for invoking pprof and parsing the raw output from it
renderer: for invoking flamegraph scripts
r: @sectioneight