Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bin/stackprof
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ parser = OptionParser.new(ARGV) do |o|
o.on('--graphviz', "Graphviz output (use with dot)"){ options[:format] = :graphviz }
o.on('--node-fraction [frac]', OptionParser::DecimalNumeric, 'Drop nodes representing less than [frac] fraction of samples'){ |n| options[:node_fraction] = n }
o.on('--stackcollapse', 'stackcollapse.pl compatible output (use with stackprof-flamegraph.pl)'){ options[:format] = :stackcollapse }
o.on('--flamegraph', "timeline-flamegraph output (js)"){ options[:format] = :flamegraph }
o.on('--flamegraph-viewer [f.js]', String, "open html viewer for flamegraph output\n\n"){ |file|
puts("open file://#{File.expand_path('../../lib/stackprof/flamegraph/viewer.html', __FILE__)}?data=#{File.expand_path(file)}")
o.on('--flamegraph', "output format for consumption by --flamegraph-viewer"){ options[:format] = :flamegraph }
o.on('--flamegraph-viewer [profile-path]', "open a viewer for the flamegraph of the given profile"){ |f|
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I switched this back to preserve the original switches, with the added ability to use --flamegraph-viewer directly on a profile file without needing to do the compile step first, but also supporting doing the compile step first to preserve people's existing workflows

StackProf::Report.view_flamegraph_in_browser(f)
exit
}
o.on('--select-files []', String, 'Show results of matching files'){ |path| (options[:select_files] ||= []) << File.expand_path(path) }
Expand Down Expand Up @@ -73,7 +73,7 @@ when :graphviz
when :stackcollapse
report.print_stackcollapse
when :flamegraph
report.print_flamegraph
report.print_speedscope_js_for_profile(file)
when :method
options[:walk] ? report.walk_method(options[:filter]) : report.print_method(options[:filter])
when :file
Expand Down
Loading