Skip to contentSkip to conversation

Perf kmem usage

DISCUSSION Li Huafei 1 participant 1 message May 10, 2021

lore
Share & tools
lore

Li Huafei

author
#0 lore raw

Hi everyone,

I failed to use perf with the following command:

 # perf kmem record --slab --page
  Error: unknown option `slab'

Usage: perf record [<options>] [<command>]

    or: perf record [<options>] -- <command> [<options>]

    -a, --all-cpus        system-wide collection from all CPUs
    -b, --branch-any      sample any taken branches
    -B, --no-buildid      do not collect buildids in perf.data
    -c, --count <n>       event period to sample
    -C, --cpu <cpu>       list of cpus to monitor
    -d, --data            Record the sample addresses
    ...

This is because commit be8299e4a2e2("perf kmem: Pass additional arguments to 'perf record'") no longer parses the arguments after the subcommand and passes them to 'perf record'. Perhaps the correct usage should be:

 # perf kmem --slab --page record

That is, use the method given in 'perf kmem -h':

perf kmem [<options>] {record|stat}

But we tend to use it the following way(perhaps I'm wrong):

perf kmem {record|stat} [<options>]

and I've seen some places where it's used, like commit c9758cc45699("perf kmem: Implement stat --page --caller"), or "man perf kmem" help information. So I'd like to confirm whether this is allowed. If allowed, we may need a fix for commit be8299e4a2e2("perf kmem: Pass additional arguments to 'perf record'").

Regards,
Huafei