![]() ![]() Pprof is a powerful aggregated profile analysis toolkit, but note that pprof is an aggregated format that dedupes similar stacktraces, so you lose a chronological view, only supporting flamegraph-style visualisations. ![]() Has an interactive command-line for filtering and displaying top traces, flamegraphs, a web ui, and Graphviz visualisation of expensive code paths. Pprof is a very mature profiler, used by Google since 1998. We can select start/end times on the dark lines to see a flamechart filtered to that exact duration, and we see indeed that it's prometheus and node_exporter using the CPU: FlameScope zoomed into the busy few seconds on the CPU pprof In this, we see a regular spurt of CPU activity for about 20% of a vertical line (1/5 of a second), every 15 seconds (not surprising, as this is a server running Prometheus, monitoring some servers every 15 seconds).Īside: this style of 2D visualisation of a large time unit along the x-axis and a smaller time unit along the y-axis reminds me of my earlier Scatter.FM project visualising songs you listen to. $ perf report > profile.txt A 60 second profile of my home server. Perhaps you might use this for profiling a busy server, or a post-startup 'stead state' session in a client app.įor this demo, we will use a longer window, over the entire system -a for 60 seconds: $ perf record -g -F 1000 -a - sleep 60 Useful for visualising a long timeline and zooming in on problem timeslices. Netflix's FlameScope renders perf data on a 2D grid (seconds along x axis and milliseconds on y axis), as a space-filling histogram. The output of perf script: raw per-sample stack traces with program name, pid, timestamp, and cycle count, program counter, symbol, and binary. Perf outputs a binary perf.data file containing all the samples, which can be formatted as text by the perf script subcommand: $ perf scriptĥ5c83b5a2773 longest_match+0x103 (/usr/bin/gzip)ĥ5c83b5a3010 deflate+0x470 (/usr/bin/gzip)ħf4547c5f0b2 _libc_start_main+0xf2 (/usr/lib/x86_64-linux-gnu/libc-2.31.so)ħf4547cf6e8e _memcpy_sse2_unaligned_erms+0x16e (inlined)ĥ5c83b5a2997 fill_window+0x87 (/usr/bin/gzip)ĥ5c83b5a2d34 deflate+0x194 (/usr/bin/gzip) $ perf record -g -call-graph dwarf -e context-switches -o perf.data gzip somebigfile.txt ![]() # Record stack traces of gzip every time it context switches $ perf record -g -call-graph dwarf -F 4000 -o perf.data gzip -9 somebigfile.txt # -call-graph dwarf is required because gzip for Ubuntu was built with -fomit-frame-pointer 4000 times a second), e.g.: # Prerequisite: install debug symbols. a thread context switch, or a syscall) or on a regular schedule (e.g. Perf can interrupt threads to record thread's stack traces, triggered by an event (e.g. I’ll be focussing on profilers that can visualise the output of the linux perf tool (aka linux-perf-tool aka perf_events, because that’s what I’m profiling with right now. A profiler that's a good fit for the work you're doing can save you a lot of time, so it's worth evaluating the options. Hopefully this can help people find the profiler UI that's right for them.ĬPU Profiler output is extremely multidimensional - processes, threads, stacks, frames, libraries, kernels, so making sense of it requires strong visualisation tools. I couldn't find any list of profiler UIs online. This post is a quick literature review of CPU profiler user interfaces available for analysing Linux program performance.
0 Comments
Leave a Reply. |