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 ๐Ÿ’…

  • -i input-file โ€” okay so by default, trace-cmd hist will read the file trace.dat. (yes it says hist, that's the manpage's business, not mine ๐Ÿ™ˆ) But the -i option 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 ๐Ÿ“

  1. rostedt@goodmis.org mailto: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