1OPERF(1)                    General Commands Manual                   OPERF(1)
2
3
4

NAME

6       operf - Performance profiler tool for Linux
7
8

SYNOPSIS

10       operf  [ options ] [ --system-wide | --pid <pid> | [ command [ args ] ]
11       ]
12
13

DESCRIPTION

15       Operf is the profiler tool provided with OProfile. Operf uses the Linux
16       Performance  Events  Subsystem and, thus, does not require the obsolete
17       oprofile kernel driver.
18
19       By default, operf uses <current_dir>/oprofile_data as  the  session-dir
20       and  stores  profiling  data  there.  You can change this by way of the
21       --session-dir option. The usual post-profiling analysis tools  such  as
22       opreport(1)  and opannotate(1) can be used to generate profile reports.
23       Unless a session-dir is specified, the post-processing  analysis  tools
24       will  search  for samples in <current_dir>/oprofile_data first. If that
25       directory does not exist, the post-processing tools  use  the  standard
26       session-dir of /var/lib/oprofile.
27
28       Statistics,  such as total samples received and lost samples, are writ‐
29       ten to the operf.log file that can be found in  the  <session_dir>/sam‐
30       ples directory.
31
32

RUN MODES

34       One (and only one) of the following run modes must be specified:
35
36       command[args]
37              The  command  or application to be profiled.  args are the input
38              arguments that the command or application requires.
39
40       --pid / -p PID
41              This option enables operf to profile a running application.  PID
42              should  be  the  process  ID of the process you wish to profile.
43              When finished profiling (e.g., when the profiled process  ends),
44              press  Ctrl-c  to  stop operf. If you run operf --pid as a back‐
45              ground job (i.e., with the &), you must stop it in a  controlled
46              manner  in  order for it to process the profile data it has col‐
47              lected.  Use kill -SIGINT <operf-PID> for this purpose.
48
49              Limitation: When using this option to profile  a  multi-threaded
50              application that also forks new processes, be aware that samples
51              for processes that are forked before profiling  is  started  may
52              not be recorded (depending on timing of thread creation and when
53              operf is started).
54
55       --system-wide / -s
56              This option is for performing a system-wide profile.   You  must
57              have  root  authority  to run operf in this mode.  When finished
58              profiling, Ctrl-c to stop operf. If you run operf  --system-wide
59              as  a  background  job (i.e., with the &), you must stop it in a
60              controlled manner in order for it to process the profile data it
61              has  collected.   Use kill -SIGINT <operf-PID> for this purpose.
62              It is recommended that when running operf with this option,  the
63              user's  current working directory should be /root or a subdirec‐
64              tory of /root to avoid storing sample data  files  in  locations
65              accessible by regular users.
66

OTHER OPTIONS

68       --vmlinux / -k vmlinux_path
69              A  vmlinux  file that matches the running kernel that has symbol
70              and/or debuginfo.  Kernel samples will  be  attributed  to  this
71              binary,   allowing  post-processing  tools  (like  opreport)  to
72              attribute samples to the appropriate kernel symbols.
73
74              The kernel symbol information may be obtained  from  /proc/kall‐
75              syms  if  the  user does not specify a vmlinux file.  The symbol
76              addresses are given in /proc/kallsyms if permitted by  the  set‐
77              ting of /proc/sys/kernel/kptr_restrict.
78
79              If the --vmlinux option is not used and kernel symbols cannot be
80              obtained from /proc/kallsyms, then all kernel  samples  are  at‐
81              tributed  to  "no-vmlinux", which is simply a bucket to hold the
82              samples and not an actual file.
83
84       --events / -e event1[,event2[,...]]
85              This option is for passing a comma-separated list of event spec‐
86              ifications for profiling. Each event spec is of the form:
87                 name:count[:unitmask[:kernel[:user]]]
88
89              The count value is used to control the sampling rate for profil‐
90              ing; it is the number of events to occur  between  samples.  The
91              rate  is  lowered  by  specifying a higher count value — i.e., a
92              higher number of events to occur between samples.
93
94              You can specify unitmask values using either a  numerical  value
95              (hex  values  must  begin  with "0x") or a symbolic name (if the
96              name=<um_name> field is shown in the ophelp  output).  For  some
97              named  unit  masks,  the hex value is not unique; thus, OProfile
98              tools enforce specifying such unit masks value by name.   If  no
99              unit  mask  is  specified,  the  default unit mask value for the
100              event is used.
101
102              The kernel and user parts of the event specification are  binary
103              values ('1' or '0') indicating whether or not to collect samples
104              for kernel space and user space.
105              Note: In order to specify the kernel/user bits,  you  must  also
106              specify  a  unitmask  value,  even if the processor type (or the
107              specified event) does not use unit masks — in  which  case,  use
108              the value '0' to signify a null unit mask; for example:
109                 -e INST_RETIRED_ANY_P:100000:0:1:0
110                                       ^      ^ ^ ^
111                                       |      | | |--- '0': do not record user
112              space samples
113                                       |      | |-- '1': record  kernel  space
114              samples
115                                       |      |-- '0': the null unit mask
116                                       |--count value
117
118              Event  names  for  some  IBM  PowerPC  systems include a _GRP<n>
119              (group number) suffix. You can pass either the full  event  name
120              or  the base event name (i.e., without the suffix) to operf.  If
121              the base event name is passed, operf will  automatically  choose
122              an appropriate group number suffix for the event; thus, OProfile
123              post-processing tools will always show  real  event  names  that
124              include the group number suffix.
125
126              When  no event specification is given, the default event for the
127              running processor type will be used for profiling.   Use  ophelp
128              to list the available events for your processor type.
129
130       --callgraph / -g
131              This  option enables the callgraph to be saved during profiling.
132              NOTE: The full callchain is  recorded,  so  there  is  no  depth
133              limit.
134
135       --separate-thread / -t
136              This  option  categorizes  samples by thread group ID (tgid) and
137              thread ID (tid).  The '--separate-thread' option is  useful  for
138              seeing  per-thread samples in multi-threaded applications.  When
139              used in conjunction with the '--system-wide' option, the '--sep‐
140              arate-thread'  option  is  also  useful  for  seeing per-process
141              (i.e., per-thread group) samples for  the  case  where  multiple
142              processes are executing the same program during a profiling run.
143
144       --separate-cpu / -c
145              This option categorizes samples by cpu.
146
147       --session-dir / -d path
148              This  option specifies the session path to hold the sample data.
149              If not specified, the data is saved in the oprofile_data  direc‐
150              tory on the current path.
151
152       --lazy-conversion / -l
153              Use  this  option to reduce the overhead of operf during profil‐
154              ing. Normally, profile data received from  the  kernel  is  con‐
155              verted  to  OProfile format during profiling time. This is typi‐
156              cally not an issue when profiling a single application. But when
157              using  the  --system-wide  option,  this  on-the-fly  conversion
158              process can cause  noticeable  overhead,  particularly  on  busy
159              multi-processor  systems.  The  --lazy-conversion option directs
160              operf to wait until profiling is completed to do the  conversion
161              of profile data.
162
163              Note:  This  option is not recommended to be used in conjunction
164              with the --pid option for  profiling  multi-threaded  processes.
165              Depending  on  the  order  of thread creation (or forking of new
166              processes), you may not get any samples for the new threads/pro‐
167              cesses.
168
169       --append / -a
170              By default, operf moves old profile data from <session_dir>/sam‐
171              ples/current to <session_dir>/samples/previous.  If a 'previous'
172              profile  already  existed, it will be replaced.  If the --append
173              option is passed, old profile data is left in place and new pro‐
174              file  data  will  be added to it, and the 'previous' profile (if
175              one existed) will remain untouched.  To  access  the  'previous'
176              profile,  simply add a session specification to the normal invo‐
177              cation of oprofile post-processing tools.  For example:
178                 opreport session:previous
179
180       --verbose / -V level
181              A comma-separated list of  debugging  control  values,  used  to
182              increase the verbosity of the output.  Valid values are:  debug,
183              record, convert, misc, sfile, arcs, or the special value, 'all'.
184
185       --version / -v
186              Show operf version.
187
188       --help / -h
189              Display brief usage message.
190
191       --usage / -u
192              Display brief usage message.
193
194

EXAMPLE

196       $ operf make
197
198

VERSION

200       This man page is current for oprofile-1.3.0.
201
202

SEE ALSO

204       opreport(1), opannotate(1).
205
206
207
208oprofile 1.3.0               Thu 15 November 2018                     OPERF(1)
Impressum