1ocount(1) General Commands Manual ocount(1)
2
3
4
6 ocount - Event counting tool for Linux
7
8
10 ocount [ options ] [ --system-wide | --process-list <pids> | --thread-
11 list <tids> | --cpu-list <cpus> | [ command [ args ] ] ]
12
13
15 ocount is an OProfile tool that can be used to count native hardware
16 events occurring in either a given application, a set of processes or
17 threads, a subset of active system processors, or the entire system.
18 The data collected during a counting session is displayed to stdout by
19 default or, optionally, to a file.
20
21 When counting multiple events, the kernel may not be able to count all
22 events simultaneously and, thus, may need to multiplex the counting of
23 the events. If this happens, the "Percent time enabled" column in the
24 ocount output will be less than 100, but counts are scaled up to a 100%
25 estimated value.
26
27
29 One (and only one) of the following run modes must be specified. If
30 you run ocount using a run mode other than command [args] , press Ctrl-
31 c to stop ocount when finished counting (e.g., when the monitored
32 process ends). If you background ocount (i.e., with '&') while using
33 one these run modes, you must stop it in a controlled manner so that
34 the data collection process can be shut down cleanly and final results
35 can be displayed. Use kill -SIGINT <ocount-PID> for this purpose.
36
37 command [args]
38 The command is the application for which to count events. args
39 are the input arguments required by the application. The com‐
40 mand and its arguments must be positioned at the end of the com‐
41 mand line, after all ocount options.
42
43 --process-list / -p pids
44 Use this option to count events for one or more already-running
45 applications, specified via a comma-separated list ( pids ).
46 Event counts will be collected for all children of the passed
47 process(es) as well. You must have privileges for the user ID
48 under which the specified process(es) are running; e.g., for a
49 non-root user, the user ID of the process(es) is the same as
50 that used for running ocount. A lack of privileges will result
51 in the following failure message:
52 perf_event_open failed with Permission denied
53
54
55 --thread-list / -r tids
56 Use this option to count events for one or more already-running
57 threads, specified via a comma-separated list ( tids ). Event
58 counts will not be collected for any children of the passed
59 thread(s). See the description of --process-list concerning
60 required privileges.
61
62
63 --system-wide / -s
64 This option is for counting events for all processes running on
65 your system. You must have root authority to run ocount in this
66 mode.
67
68
69 --cpu-list / -C cpus
70 This option is for counting events on a subset of processors on
71 your system. You must have root authority to run ocount in this
72 mode. This is a comma-separated list, where each element in the
73 list may be either a single processor number or a range of pro‐
74 cessor numbers; for example: '-C 2,3,4-11,15'.
75
76
78 --events / -e event1[,event2[,...]]
79 This option is for passing a comma-separated list of event spec‐
80 ifications for counting. Each event spec is of the form:
81 name[:unitmask[:kernel[:user]]]
82 Note: Do not include a count value in the event spec, as that
83 parameter is only needed when profiling.
84
85 You can specify unitmask values using either a numerical value
86 (hex values must begin with "0x") or a symbolic name (if the
87 name=<um_name> field is shown in the ophelp output). For some
88 named unit masks, the hex value is not unique; thus, OProfile
89 tools enforce specifying such unit masks value by name. If no
90 unit mask is specified, the default unit mask value for the
91 event is used.
92
93 The kernel and user parts of the event specification are binary
94 values ('1' or '0') indicating whether or not to count events in
95 kernel space and user space.
96 Note: In order to specify the kernel/user bits, you must also
97 specify a unitmask value, even if the running processor type
98 does not use unit masks — in which case, use the value '0' to
99 signify a null unit mask; for example:
100 -e INST_RETIRED_ANY_P:0:1:0
101 ^ ^ ^
102 | | |--- '0': do not count user space
103 events
104 | |-- '1': count kernel space events
105 |-- '0': the null unit mask
106
107 Event names for certain processor types include a _GRP<n> suf‐
108 fix. For such cases, the --events option may be specified with
109 or without the _GRP<n> suffix.
110
111 When no event specification is given, the default event for the
112 running processor type will be used for counting. Use ophelp to
113 list the available events for your processor type.
114
115
116 --separate-thread / -t
117 This option can be used in conjunction with either the
118 --process-list or --thread-list option to display event counts
119 on a per-thread (per-process) basis. Without this option, all
120 counts are aggregated.
121
122 NOTE: If new threads are started by the process(es) being moni‐
123 tored after counting begins, the counts for those threads are
124 aggregated with their parent's counts.
125
126
127 --separate-cpu / -c
128 This option can be used in conjunction with either the --system-
129 wide or --cpu-list option to display event counts on a per-cpu
130 basis. Without this option, all counts are aggregated.
131
132
133 --time-interval / -i interval_length[:num_intervals]
134
135 Note: The interval_length is given in milliseconds. However, the
136 current implementation only supports 100 ms granularity, so the
137 given interval_length will be rounded to the nearest 100 ms.
138 Results collected for each time interval are printed immediately
139 instead of the default of one dump of cumulative event counts at
140 the end of the run. Counters are reset to zero at the start of
141 each interval.
142
143 If num_intervals is specified, ocount exits after the specified
144 number of intervals occur.
145
146
147 --brief-format / -b
148 Use this option to print results in the following brief format:
149 [cpu or thread,]<event_name>[:umask[:K:U]],<count>,<per‐
150 cent_time_enabled>
151 [ <u32> ,]< string >[< u32>[<bb>]],< u64 >,<
152 double >
153
154 The umask, Kernel and User modes are only printed if the values
155 were specified as part of the event. The 'K' and 'U' fields are
156 binary fields separated by colons, where the value for each
157 binary field may be either '0' or '1'.
158
159 If --timer-interval is specified, a separate line formatted as
160 timestamp,<num_seconds_since_epoch>[.n]
161 is printed ahead of each dump of event counts. If the time
162 interval specified is less than one second, the timestamp will
163 have 1/10 second precision.
164
165
166 --output-file / -f outfile_name
167 Results are written to outfile_name instead of interactively to
168 the terminal.
169
170 --verbose / -V
171 Use this option to increase the verbosity of the output.
172
173 --version / -v
174 Show ocount version.
175
176 --help / -h
177 Display brief usage message.
178
179 --usage / -u
180 Display brief usage message.
181
182
184 $ ocount make
185
186
188 This man page is current for oprofile-1.3.0.
189
190
192 operf(1).
193
194
195
196oprofile 1.3.0 Thu 15 November 2018 ocount(1)