PPROF(1)

๐Ÿ“ฆ version 2.15, in epel 10, epel 9

๐Ÿ’… PPROF โ€” the manual page, but make it make sense

okay so bestie, quick context before we dive in: pprof is part of gperftools, and it's basically the tool that reads your profiling data and tells you what your program is actually doing with its life. it's giving detective energy. let's go ๐Ÿ•ต๏ธโ€โ™€๏ธ


โœจ SYNOPSIS โœจ

pprof [options] <program> <profile>

๐ŸŒธ DESCRIPTION ๐ŸŒธ

pprof prints the specified cpu- or heap-profile. that's it, that's the whole pitch. you feed it a <program> and a <profile>, and it spills the tea about where your cycles (or your memory) went. lowkey iconic. ๐Ÿ’–


๐ŸŽ€ OPTIONS ๐ŸŽ€

  • --cum โ€” sort by cumulative data. sort of a "give me the big picture" vibe.
  • --base=<base> โ€” subtract <base> from <profile> before display. yes, literally math-ing one profile against another. ๐Ÿงฎ

๐Ÿ“Š Reporting Granularity ๐Ÿ“Š

how zoomed-in do you wanna be, bestie? pick your level of detail:

  • --addresses โ€” report at address level (maximum zoom, no cap ๐Ÿ”)
  • --lines โ€” report at source line level
  • --functions โ€” report at function level [default] โญ
  • --files โ€” report at source file level

๐Ÿ–จ๏ธ Output type ๐Ÿ–จ๏ธ

what format is your little report gonna come out in? choose your fighter:

  • --text โ€” generate text report [default] โœจ
  • --gv โ€” generate Postscript and display. it'll pop it open for you, so polite ๐Ÿ’…
  • --list=<regexp> โ€” generate source listing of matching routines
  • --disasm=<regexp> โ€” generate disassembly of matching routines
  • --dot โ€” generate DOT file to stdout
  • --ps โ€” generate Postscript to stdout
  • --pdf โ€” generate PDF to stdout
  • --gif โ€” generate GIF to stdout

๐Ÿ“ Heap-Profile Options ๐Ÿ“

these only matter when you're dealing with a heap profile, so like, vibe check the situation first:

  • --inuse_space โ€” display in-use (mega)bytes [default] ๐ŸŒธ
  • --inuse_objects โ€” display in-use objects
  • --alloc_space โ€” display allocated (mega)bytes
  • --alloc_objects โ€” display allocated objects
  • --show_bytes โ€” display space in bytes (for the people who want the raw numbers, respect ๐Ÿซถ)
  • --drop_negative โ€” ignore negaive differences
ok so real talk, that's literally how it's spelled in the original โ€” negaive. not me fixing it. i would never. ๐Ÿ’€

๐Ÿฆ‹ Call-graph Options ๐Ÿฆ‹

the fine-tuning section. this is where you get to be picky:

  • --nodecount=<n> โ€” show at most so many nodes [default=80]
  • --nodefraction=<f> โ€” hide nodes below <f>*total [default=.005]
  • --edgefraction=<f> โ€” hide edges below <f>*total [default=.001]
  • --focus=<regexp> โ€” focus on nodes matching <regexp>
  • --ignore=<regexp> โ€” ignore nodes matching <regexp>
  • --scale=<n> โ€” set GV scaling [default=0]

๐Ÿ”ฅ EXAMPLES ๐Ÿ”ฅ

here's where it clicks, fr fr:

pprof /bin/ls ls.prof

outputs one line per procedure. simple, clean, slay.


pprof --gv /bin/ls ls.prof

displays annotated call-graph via 'gv'. pretty pictures โœจ


pprof --gv --focus=Mutex /bin/ls ls.prof

restricts to code paths including a .*Mutex.* entry.


pprof --gv --focus=Mutex --ignore=string /bin/ls ls.prof

code paths including Mutex but not string. very "i want this but absolutely NOT that" of it ๐Ÿ’…


pprof --list=getdir /bin/ls ls.prof

Dissassembly (with per-line annotations) for getdir()


pprof --disasm=getdir /bin/ls ls.prof

Dissassembly (with per-PC annotations) for getdir()


Copyright ยฉ 2005 Google Inc.


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

further documentation for pprof is maintained as a web page called cpu_profiler.html and is likely installed at one of the following locations:

/usr/share/gperftools/cpu_profiler.html
/usr/local/share/gperftools/cpu_profiler.html
go read those, they're the main character energy of extra docs ๐Ÿงš

okay that's the whole page bestie, you're officially pprof-pilled ๐ŸŽ€ this was pprof (part of gperftools), dated February 2005 โ€” vintage but still eating, ngl. mwah ๐Ÿ’–๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from