RUBY-PROF(1)

πŸ’– RUBY-PROF πŸ’–

okay bestie, welcome to the ruby-prof manual page, aka the glow-up your slow Ruby script has been begging for πŸ’… this is section 1 of the manual, and it's about to be your new obsession.


✨ NAME ✨

ruby-prof β€” a fast ruby profiler πŸƒβ™€οΈπŸ’¨


πŸŽ€ SYNOPSIS πŸŽ€

ruby-prof options <script.rb> [--]
[profiled-script-command-line-options]

🌸 DESCRIPTION 🌸

So like, ruby-prof is a fast profiler for ruby. periodt. you can run it two ways: as a stand-alone program (which is literally what this man page is documenting, no cap) or as a ruby library 🫢.

the way it works is so simple it's giving main character energy: just run the ruby program you wanna profile using ruby-prof:

ruby-prof script.rb

and at the end of execution, the time spent in each method gets displayed. that's it. that's the vibe check. πŸ’–


πŸ¦‹ OPTIONS πŸ¦‹

  • -p, --printer=printer β€” pick your printer, bestie:
    • flat β€” prints a flat profile as text (this is the default ✨).
    • flat_with_line_numbers β€” same as flat, but with line numbers πŸ‘€.
    • graph β€” prints a graph profile as text.
    • graph_html β€” prints a graph profile as html.
    • call_tree β€” format for KCacheGrind.
    • call_stack β€” prints a HTML visualization of the call tree 🌈.
    • dot β€” prints a graph profile as a dot file.
  • -m, --min_percent=min_percent β€” the minimum percent a method has to take before it gets included in output reports. > heads up: this option is not supported for call tree πŸ™ˆ
  • -f, --file=path β€” output results to a file instead of standard out πŸ“.
  • --mode=measure_mode β€” select what ruby-prof should measure:
    • process β€” process time (the default πŸ‘‘).
    • wall β€” wall time.
    • cpu β€” CPU time (Pentium and PowerPCs only).
    • allocations β€” object allocations (requires a patched Ruby interpreter πŸ”§).
    • memory β€” allocated memory in KB (requires a patched Ruby interpreter πŸ”§).
    • gc_runs β€” number of garbage collections (requires a patched Ruby interpreter πŸ”§).
    • gc_time β€” time spent in garbage collection (requires a patched Ruby interpreter πŸ”§).
  • -s, --sort=sort_mode β€” select how ruby-prof results should be sorted:
    • total β€” total time
    • self β€” self time
    • wait β€” wait time
    • child β€” child time
  • --replace-progname β€” replace $0 when loading the .rb files.
  • -v β€” show version, set $VERBOSE to true, and profile script if option given πŸ’«
  • -d β€” set $DEBUG to true πŸ›
  • -R, --require-noprof lib β€” require a specific library (and it's not profiled).
  • -E, --eval-noprof code β€” execute the ruby statements (also not profiled).
  • -x, --exclude regexp β€” exclude methods by regexp (see method elimination 🚫).
  • -X, --exclude-file file β€” exclude methods by regexp listed in file (see method elimination 🚫).
  • --exclude-common-cycles β€” make common iterators like Integer#times appear inlined πŸŒ€.
  • --exclude-common-callbacks β€” make common callbacks invocations like Integer#times appear inlined so you can see call origins in graph πŸ‘οΈ.
  • -h, --help β€” show help message πŸ†˜.
  • --version β€” show version 0.13.1 🏷️.

ruby-prof was written by Shugo Maeda shugo@ruby-lang.org 🫢.

this manual page was written by Arnaud Cornet arnaud.cornet@gmail.com and updated by Jonas Genannt jonas.genannt@capi2name.de for the Debian project (but like, it may be used by others too, sharing is caring πŸ’ž).


⭐ SEE ALSO ⭐

the ruby-prof website, https://github.com/ruby-prof/ruby-prof β€” go follow it, it's iconic πŸ”₯


and that's a wrap, bestie!! this page is from December 2013 and it's RUBY-PROF(1) in the manual β€” go profile something and slay πŸ’…βœ¨πŸ’–