TRACE-CMD-MEM(1)
๐ TRACE-CMD-MEM(1) ๐
ok so this is a page from the libtracefs Manual โ yes bestie, libtracefs, that's the one โ and it's all about trace-cmd-mem, the little tool that tells you how much memory your kmem events were out here requesting. slay.
โจ NAME โจ
trace-cmd-mem โ show memory usage of certain kmem events ๐ง
๐ธ SYNOPSIS ๐ธ
trace-cmd mem [OPTIONS][input-file]
๐ฆ DESCRIPTION ๐ฆ
okay so here's the vibe: trace-cmd(1) mem requires a trace-cmd record that had these events enabled, no cap:
kmalloc
kmalloc_node
kfree
kmem_cache_alloc
kmem_cache_alloc_node
kmem_cache_alloc_free
(it literally says kmem_cache_alloc_free in there, i'm not touching it, that's what it says ๐
)
Then it reads the amount requested and the ammount freed โ yes, "ammount", the manpage said it first, not me ๐ญ โ plus the functions that called the allocation. Then it reports:
- the final amount of bytes requested and allocated
- the total amount allocated and requested
- the max allocation and requested during the run
- the amount of wasted bytes (
allocated - requested) that was not freed - the max wasted amount during the run
And the whole list gets sorted in descending order of wasted bytes after the run. main character sorting energy, honestly ๐
here's what that output is giving, literally:
Function Waste Alloc req TotAlloc TotReq MaxAlloc MaxReq MaxWaste
-------- ----- ----- --- -------- ------ -------- ------ --------
rb_allocate_cpu_buffer 768 2304 1536 2304 1536 2304 1536 768
alloc_pipe_info 400 1152 752 1152 752 1152 752 400
instance_mkdir 252 544 292 544 292 544 292 252
__d_alloc 215 1086560 1086345 1087208 1086993 1086560 1086345 215
get_empty_filp 72 2304 2232 4864 4712 4864 4712 152
mm_alloc 40 960 920 960 920 960 920 40
prepare_creds 32 192 160 1728 1440 1728 1440 288
tracing_buffers_open 8 32 24 32 24 32 24 8
do_brk 0 0 0 368 368 368 368 0
journal_add_journal_head 0 6048 6048 6048 6048 6048 6048 0
journal_start 0 0 0 1224 1224 48 48 0
__rb_allocate_pages 0 3289856 3289856 3289856 3289856 3289856 3289856 0
anon_vma_alloc 0 0 0 936 936 864 864 0
[...]
๐ OPTIONS ๐
-iinput-file โ okay so by default,trace-cmd histwill read the filetrace.dat. (yes it sayshist, that's the manpage's business, not mine ๐) But the-ioption opens up the given input-file instead. And ngl, the input file can also just be specified as the last item on the command line โ lowkey convenient ๐ซถ
๐ SEE ALSO ๐
trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1), trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1), trace-cmd-hist(1), trace-cmd-split(1), trace-cmd-listen(1)
like, the whole friend group. go read them, fr fr ๐
๐ AUTHOR ๐
Written by Steven Rostedt, <rostedt@goodmis.org[1]> โ an actual icon โจ
๐ RESOURCES ๐
https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/
(the source. go look. it's right there ๐ฆ)
โญ COPYING โญ
Copyright (C) 2013 Red Hat, Inc. Free use of this software is granted under the terms of the GNU Public License (GPL).
periodt. free use, GPL terms, that's the whole deal ๐
๐ NOTES ๐
rostedt@goodmis.orgmailto:rostedt@goodmis.org
literally the whole page, nothing skipped, you're welcome bestie ๐๐
and that's a wrap! this cutie is from libtracefs, dated 03/09/2026, and it goes by TRACE-CMD-MEM(1) โ stan ๐ธ๐ฆ๐
๐ฆ where this page comes from
- arch rolling: trace-cmd 3.4-1 ยท GPL-2.0-only AND LGPL-2.1-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms