Path: blob/master/tools/perf/Documentation/perf-record.txt
10821 views
perf-record(1)1==============23NAME4----5perf-record - Run a command and record its profile into perf.data67SYNOPSIS8--------9[verse]10'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] <command>11'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] -- <command> [<options>]1213DESCRIPTION14-----------15This command runs a command and gathers a performance counter profile16from it, into perf.data - without displaying anything.1718This file can then be inspected later on, using 'perf report'.192021OPTIONS22-------23<command>...::24Any command you can specify in a shell.2526-e::27--event=::28Select the PMU event. Selection can be:2930- a symbolic event name (use 'perf list' to list all events)3132- a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a33hexadecimal event descriptor.3435- a hardware breakpoint event in the form of '\mem:addr[:access]'36where addr is the address in memory you want to break in.37Access is the memory access type (read, write, execute) it can38be passed as follows: '\mem:addr[:[r][w][x]]'.39If you want to profile read-write accesses in 0x1000, just set40'mem:0x1000:rw'.4142--filter=<filter>::43Event filter.4445-a::46--all-cpus::47System-wide collection from all CPUs.4849-l::50Scale counter values.5152-p::53--pid=::54Record events on existing process ID.5556-t::57--tid=::58Record events on existing thread ID.5960-r::61--realtime=::62Collect data with this RT SCHED_FIFO priority.63-D::64--no-delay::65Collect data without buffering.66-A::67--append::68Append to the output file to do incremental profiling.6970-f::71--force::72Overwrite existing data file. (deprecated)7374-c::75--count=::76Event period to sample.7778-o::79--output=::80Output file name.8182-i::83--no-inherit::84Child tasks do not inherit counters.85-F::86--freq=::87Profile at this frequency.8889-m::90--mmap-pages=::91Number of mmap data pages.9293-g::94--call-graph::95Do call-graph (stack chain/backtrace) recording.9697-q::98--quiet::99Don't print any message, useful for scripting.100101-v::102--verbose::103Be more verbose (show counter open errors, etc).104105-s::106--stat::107Per thread counts.108109-d::110--data::111Sample addresses.112113-T::114--timestamp::115Sample timestamps. Use it with 'perf report -D' to see the timestamps,116for instance.117118-n::119--no-samples::120Don't sample.121122-R::123--raw-samples::124Collect raw sample records from all opened counters (default for tracepoint counters).125126-C::127--cpu::128Collect samples only on the list of CPUs provided. Multiple CPUs can be provided as a129comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2.130In per-thread mode with inheritance mode on (default), samples are captured only when131the thread executes on the designated CPUs. Default is to monitor all CPUs.132133-N::134--no-buildid-cache::135Do not update the builid cache. This saves some overhead in situations136where the information in the perf.data file (which includes buildids)137is sufficient.138139-G name,...::140--cgroup name,...::141monitor only in the container (cgroup) called "name". This option is available only142in per-cpu mode. The cgroup filesystem must be mounted. All threads belonging to143container "name" are monitored when they run on the monitored CPUs. Multiple cgroups144can be provided. Each cgroup is applied to the corresponding event, i.e., first cgroup145to first event, second cgroup to second event and so on. It is possible to provide146an empty cgroup (monitor all the time) using, e.g., -G foo,,bar. Cgroups must have147corresponding events, i.e., they always refer to events defined earlier on the command148line.149150SEE ALSO151--------152linkperf:perf-stat[1], linkperf:perf-list[1]153154155