TIPTOP(1)
π TIPTOP(1) β the tiptop manual, but make it make sense π
okay bestie, sit down, hydrate, because this one is a whole journey β¨ This is the manual page for tiptop, living in section 1 of the manual. It's from Inria, it's all about staring at hardware performance counters for Linux tasks, and yes it is exactly as iconic as it sounds. π
β¨ NAME β¨
tiptop β display hardware performance counters for Linux tasks π¦
πΈ SYNOPSIS πΈ
tiptop [OPTION]
tiptop [OPTION] -- command (EXPERIMENTAL)
ptiptop PATTERN [OPTIONS]
π DESCRIPTION π
So. The tiptop program gives you a dynamic, real-time view of the tasks running on your system. It's very similar to top (1) β like, spiritual siblings fr fr β except the info it shows you comes from hardware counters. That's the whole vibe. π
tiptop has two running modes, and you need to know both: live-mode and batch-mode. In both modes, the system gets periodically queried for the values of hardware counters, and then various ratios get printed for each task. β¨
- In live-mode, the display is regularly updated with new values at constant time intervals. It's giving main character energy on your terminal. π
- In batch-mode, that same information is emitted to
stdout. Batch-mode is the move when you want to save stuff to a file or do further processing on it. And heads up: no interaction is possible in batch-mode. None. Zero. Don't even try. π
Also important: unless tiptop is run by root, or the executable is setuid-root, a user can only monitor the tasks it owns. That's just the rules, bestie. π
The results produced by tiptop are organized in screens. A screen consists in rows representing tasks, and columns reporting various values and ratios collected from hardware counters. Many screens can be defined. Only one screen is displayed at a time. The default screen (number 0) reports target independent values as defined in the file /usr/include/linux/event_counter.h. Other screens may rely on target-dependent counters. π
Now, the lil edge cases you must know about:
- When an expression would result in a division by zero, a
'-'sign is printed. - When a counter involved in an expression could not be read, a
'?'sign is printed.
No cap, those two little characters will save you so much confusion. π«Ά
If -- appears in the command line, tiptop treats the rest of the line as a command. A new process is forked, and hardware counters are attached just before execvp is called. This makes it possible to trace an application from the first instruction. Only the child is traced, and idle-mode is enabled (in live mode, this can be overridden by hitting keys 'p' and 'i'). This is commonly used in combination with sticky mode to track a command from start to finish. This is experimental! β οΈ
ptiptop is simply a shortcut for tiptop -p. That's it. That's the whole thing. π
And finally: tiptop requires Linux 2.6.31+. Old kernels need not apply. π
π COMMAND-LINE OPTIONS π
Quick rules before we dive in, because they matter: command line options with a parameter override values specified in the configuration file. Toggles set the value or invert the value read in the configuration file (if any). Got it? Good. Let's go. β¨
-bβ Starttiptopin batch-mode. Output is sent tostdout, and no interactive command is accepted.tiptopwill run forever, or until the number of iterations specified by-n. βΎοΈ-cβ display the command line of the task instead of its name. (toggle)--cpu-min VALUEβ %CPU activity threshold. Below this value, a task is considered idle and is not reported (unless idle-mode is on, see flag-i). π¦-d VALUEβ Specify the delay between refreshes.VALUEcan be fractional. It must be larger than0.01. β±οΈ-E FILENAMEβ Specify file where errors are logged. By default errors are logged tostderrin batch-mode, and a temporary file in live-mode. π--epochβ Print the Epoch at each refresh. In batch-mode, it is printed at the beginning of each row. In live-mode, it is at the bottom of the display. (toggle)-h,--helpβ Print a brief help message and exit. π-Hβ Show threads. (toggle)--hypervisorβ Include hypervisor activity in the reported values. βοΈ-iβ Show idle tasks. (toggle)-K,--kernelβ Include kernel activity in the reported values. This is only possible is the user is root, thetiptopexecutable is setuid root, or the paranoia level is low enough. (toggle) See file/proc/sys/kernel/perf_event_paranoid(perf_counter_paranoidon Linux 2.6.31).--list-screensβ List available screens and exit. π-n VALUEβ Automatically exit afterVALUEiterations.--no-collectβ By default, when the maximum number of open files is reached, and new processes appear,tiptopsearches for idle processes and closes the files in order to make room for the new ones. This flag disables this behavior: in case of file shortage, new processes will not get more chances than older ones. π€-o FILENAMEβ Specify the filename for the output of batch mode. πΎ--only-confβ Only screens defined in configuration file displayed (no default).-p,--pid VALUEβ Filters processes according toVALUE.VALUEcan be either the numeric valuePID, or a string. In case of a string, all tasks whose names or command lines (depending on the display, see-c) containVALUEare reported. π-S VALUEβ Starttiptopwith screen numberVALUEifVALUEis an integer. Otherwise looks for the first screen whose name containsVALUE. π--stickyβ Start in sticky mode: tasks stay in the list after they die. In live-mode, they appear in a different color (when supported). In batch-mode, the wordDEADis appended. (toggle) π--timestampβ Print a timestamp at the beginning of each row. The timestamp is the number of refreshes so far. In batch-mode, it is printed at the beginning of each row. In live-mode, it is at the bottom of the display. (toggle)-u USERβ Only show tasks owned byUSER.USERcan be either a login name, or the numeric valueUID.-Uβ Show the owner of each task. (toggle)-vβ Display build information and exit. π§--versionβ Display version information and disclaimer and exit. π-w VALUEβ Watch the task specified byVALUE.VALUEcan be either the numeric valuePID, or a string. In case of a string, all tasks whose names or command lines (depending on the display, see-c) containVALUEare reported. In live-mode, watched tasks are shown in a different color (when supported). In batch-mode, an ASCII arrow points to the watched tasks. π-W PATHβ Directory where the configuration file is located. π
π INTERACTIVE COMMANDS π
In live-mode, tiptop accepts single-key commands. Little keyboard queen. π
LEFT,RIGHTβ Rotate through available screens. π<,>β Change the reference column for sorting to the left or to the right.cβ Toggle between showing task names and command lines.dβ Change the refresh interval. The new value is queried. Fractional values larger than0.01are accepted. β±οΈeβ Display the errors encoutered so far. Scroll withUP,DOWN,PAGE_UP,PAGE_DOWN,HOMEandEND. πhβ Display a brief description of the screen and each column. π‘Hβ Toggle between showing individual threads and accumulating values per process.iβ Toggle between showing only active tasks and showing also idle tasks.Kβ Toggle between showing kernel activity and only user activity. Kernel mode is only available to root. Switching to and from kernel mode resets all counters. β οΈkβ Kill a process. The user is asked for thePID, and the signal to send. β οΈpβ Filter tasks by name orPID. The user is asked for aPIDor string. In case a string is entered, only the tasks whose name or command line contain the string are displayed. Changing the filter resets all counters. πqβ Quit. πRβ Change sorting order: ascending or descending. βοΈSβ Toggle sticky mode.sβ Same asd. (twins fr) π―uβ Filter tasks by user. The user name orPIDis queried. Note that, unlesstiptopis run by root or setuid root, tasks owned by somebody else cannot be monitored. Changing the filter resets all counters.Uβ Toggle displaying each task's owner.wβ Used to track a particular task. The user is asked for aPIDor string. In case a string is entered, all tasks whose name or command line contain the string are highlighted. β¨Wβ Writes a configuration file for the current state in the current directory. πΎ
and bestieβ¦ we're not done yet, there's more coming π
β¨ FILES β¨
Okay bestie, when tiptop boots up it's gonna go looking for a config file, and that file has exactly one name it answers to: .tiptoprc. π
Where does it look? It goes on a little quest, in this order:
- the current directory first π«Ά
- then the directory that the environment variable
TIPTOPpoints to, if that variable even exists - and finally, home sweet home: the user's home directory π
π Syntax
The file is XML. Yes, XML. We're doing XML. Here's how the whole thing is structured:
Root of tree π³
The root of the xml tree is tiptop. Like:
<tiptop> ... </tiptop>
Options βοΈ
Options get specified inside an <options> block, bestie:
<options>
<option name="option1" value="value_option1"/>
<option name="option2" value="value_option2"/>
... </options>
Here's every recognized option, with the command-line option it's lowkey twinning with:
cpu_threshold(--cpu-min)delay(-d)idle(-i)max_iter(-n)show_cmdline(-c)show_epoch(--epoch)show_hypervisor(--hypervisor)show_kernel(-K)show_timestamp(--timestamp)show_threads(-H)show_user(-U)watch_name(-w)sticky(--sticky)watch_uid(-w)
Screens π₯οΈ
Screens live inside a <screen> block. A screen is made of counters and columns, and it has a name plus an optional description. So:
<screen name="my_screen" desc="what this screen is about">
.... </screen>
Counters must provide an alias (that's what gets used for further reference) and a config. The config is either a predefined value, or the actual value that has to be handed to the perf_even_open system call (you'd typically find that in vendor architecture manuals).
Predefined values are: CPU_CYCLES, INSTRUCTIONS, CACHE_REFERENCES, CACHE_MISSES, BRANCH_INSTRUCTIONS, BRANCH_MISSES, and BUS_CYCLES.
<counter alias="instr" config="INSTRUCTIONS" />
For non-predefined configs, you have to provide a type. Right now only RAW and HW_CACHE are supported.
Optionally, a counter can be restricted to a specific architecture (like "x86") and a model. The definition of the model is architecture-dependent. For x86, it's defined as DisplayFamily_DisplayModel, as computed by the instruction CPUID. A counter for issued micro-ops on Sandy Bridge could look like this:
<counter alias="uops_issued" config="0x010e"
type="RAW" arch="x86" model="06_2A" />
And for the x86 architecture, a single counter can be valid for several models at once, no biggie:
<counter alias="uOP" config="0x1c2" type="RAW"
arch="x86" model="06_1A;06_1E;06_1F;06_2E" />
When the type is HW_CACHE, the config is specified by shifting and ORing predefined values. Let me break it down:
- the 8 least significant bits = the cache level (possible values
L1D,L1I,LL,DTLB,ITLB,BPU) - the next 8 bits = the type of access (
OP_READ,OP_WRITE,OP_PREFETCH) - the last 8 bits = one of
RESULT_ACCESSorRESULT_MISS
Heads up: "shift left" is written asshlhere, because the usual<<does not fit well in xml. π
<counter alias="L1Rmiss" type="HW_CACHE"
config="L1D | (OP_READ shl 8) | (RESULT_MISS shl 16)" />
See also /usr/include/linux/perf_events.h for more on config and type.
A column defines its header, the printf-like format for values, and an expression. Expressions evaluate as double precision. A description is optional.
<counter alias="instr" config="INSTRUCTIONS" />
<counter alias="cycle" config="CPU_CYCLES" />
<column header=" IPC" format="%4.2f"
desc="Total instructions per cycle"
expr="instr/cycle"/>
<column header=" ipc" format="%4.2f"
desc="Total instructions per cycle"
expr="instr/cycle" />
The syntax of expressions supports basic arithmetic (+ - * /), parentheses and constants. The special notation delta(counter) evaluates as the variation of the counter between refreshes. Expressions can also refer to predefined variables such as CPU_TOT (CPU usage), CPU_SYS (system CPU usage), CPU_USER (user CPU usage), PROC_ID (processor where the process was last seen). Iconic behavior honestly.
<column header=" ipc" format="%4.2f"
desc="Average IPC over last period"
expr="delta(instr) / delta(cycle)" />
Sample config file πΈ
<tiptop>
<options>
<option name="delay" value="2.0" />
<option name="stick" value="1" />
</options>
<screen name="example" desc="Sample config file">
<counter alias="cycle" config="CPU_CYCLES" />
<counter alias="instr" config="INSTRUCTIONS" />
<counter alias="miss" config="CACHE_MISSES" />
<counter alias="br_miss" config="BRANCH_MISSES" />
<!-- Sandy Bridge only -->
<counter alias="uops_issued" config="0x010e"
type="RAW" arch="x86" model="06_2A" />
<column header=" %CPU" format="%5.1f"
desc="CPU usage" expr="CPU_TOT" />
<column header=" P" format=" %2.0f"
desc="Processor where last seen" expr="PROC_ID" />
<column header=" Mcycle" format="%8.2f"
desc="Cycles (millions)"
expr="delta(cycle) / 1e6" />
<column header=" Minstr" format="%8.2f"
desc="Instructions (millions)"
expr="delta(instr) / 1e6" />
<column header=" IPC" format="%4.2f"
desc="Executed instructions per cycle"
expr="delta(instr) / delta(cycle)" />
<column header=" %MISS" format="%6.2f"
desc="Cache miss per instructions (in %)"
expr="100 * delta(miss) / delta(instr)" />
<column header=" %BMIS" format="%6.2f"
desc="Branch misprediction per instruction (in %)"
expr="100 * delta(br_miss) / delta(instr)" />
<column header="uops/inst" format=" %4.1f"
desc="Number of issued uops per instruction"
expr="delta(uops_issued) / delta(instr)" />
</screen>
</tiptop>
π CAVEATS π
Okay so real talk, no cap:
tiptopdoes not seem to work within a virtualized environment. π- Attaching counters to processes may fail for various reasons β like asking for more than is available in hardware (and btw,
tiptopdoes not implement sampling), or hitting the maximum number of open files. When that happens, you might wanna consider filtering the processes (see flags-u,-p). π«Ά - To mitigate that whole maximum-number-of-open-files limitation,
tiptoptries to close the events attached to idle processes. If that's a problem for you, see the flag--no-collect.
π BUGS π
Found something cursed? Send bug reports to:
Erven Rohou <erven.rohou@inria.fr>
π AUTHOR π
Written by Erven Rohou.
π SEE ALSO π
top(1),ps(1)/usr/include/linux/perf_counter.h(Linux 2.6.31)/usr/include/linux/event_counter.h(Linux 2.6.32+)
And that's the whole page, bestie β slay π This is the Linux flavor of the manual, dated February 2024, and it's serving TIPTOP(1) energy from start to finish. Go read your .tiptoprc and prosper β¨π¦
π¦ where this page comes from
- fedora 43: tiptop 2.3.2-5.fc43 Β· GPL-2.0-only
- fedora 44: tiptop 2.3.2-6.fc44 Β· GPL-2.0-only
- ubuntu resolute: tiptop 2.3.2-1 Β· GPL-2.0-only
- ubuntu stonking: tiptop 2.3.2-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms