5 Documentation written by Tom Zanussi
10 Histogram triggers are special event triggers that can be used to
11 aggregate trace event data into histograms. For information on
12 trace events and event triggers, see Documentation/trace/events.rst.
15 2. Histogram Trigger Command
16 ============================
18 A histogram trigger command is an event trigger command that
19 aggregates event hits into a hash table keyed on one or more trace
20 event format fields (or stacktrace) and a set of running totals
21 derived from one or more trace event format fields and/or event
24 The format of a hist trigger is as follows::
26 hist:keys=<field1[,field2,...]>[:values=<field1[,field2,...]>]
27 [:sort=<field1[,field2,...]>][:size=#entries][:pause][:continue]
28 [:clear][:name=histname1] [if <filter>]
30 When a matching event is hit, an entry is added to a hash table
31 using the key(s) and value(s) named. Keys and values correspond to
32 fields in the event's format description. Values must correspond to
33 numeric fields - on an event hit, the value(s) will be added to a
34 sum kept for that field. The special string 'hitcount' can be used
35 in place of an explicit value field - this is simply a count of
36 event hits. If 'values' isn't specified, an implicit 'hitcount'
37 value will be automatically created and used as the only value.
38 Keys can be any field, or the special string 'stacktrace', which
39 will use the event's kernel stacktrace as the key. The keywords
40 'keys' or 'key' can be used to specify keys, and the keywords
41 'values', 'vals', or 'val' can be used to specify values. Compound
42 keys consisting of up to two fields can be specified by the 'keys'
43 keyword. Hashing a compound key produces a unique entry in the
44 table for each unique combination of component keys, and can be
45 useful for providing more fine-grained summaries of event data.
46 Additionally, sort keys consisting of up to two fields can be
47 specified by the 'sort' keyword. If more than one field is
48 specified, the result will be a 'sort within a sort': the first key
49 is taken to be the primary sort key and the second the secondary
50 key. If a hist trigger is given a name using the 'name' parameter,
51 its histogram data will be shared with other triggers of the same
52 name, and trigger hits will update this common data. Only triggers
53 with 'compatible' fields can be combined in this way; triggers are
54 'compatible' if the fields named in the trigger share the same
55 number and type of fields and those fields also have the same names.
56 Note that any two events always share the compatible 'hitcount' and
57 'stacktrace' fields and can therefore be combined using those
58 fields, however pointless that may be.
60 'hist' triggers add a 'hist' file to each event's subdirectory.
61 Reading the 'hist' file for the event will dump the hash table in
62 its entirety to stdout. If there are multiple hist triggers
63 attached to an event, there will be a table for each trigger in the
64 output. The table displayed for a named trigger will be the same as
65 any other instance having the same name. Each printed hash table
66 entry is a simple list of the keys and values comprising the entry;
67 keys are printed first and are delineated by curly braces, and are
68 followed by the set of value fields for the entry. By default,
69 numeric fields are displayed as base-10 integers. This can be
70 modified by appending any of the following modifiers to the field
73 =========== ==========================================
74 .hex display a number as a hex value
75 .sym display an address as a symbol
76 .sym-offset display an address as a symbol and offset
77 .syscall display a syscall id as a system call name
78 .execname display a common_pid as a program name
79 .log2 display log2 value rather than raw number
80 .usecs display a common_timestamp in microseconds
81 =========== ==========================================
83 Note that in general the semantics of a given field aren't
84 interpreted when applying a modifier to it, but there are some
85 restrictions to be aware of in this regard:
87 - only the 'hex' modifier can be used for values (because values
88 are essentially sums, and the other modifiers don't make sense
90 - the 'execname' modifier can only be used on a 'common_pid'. The
91 reason for this is that the execname is simply the 'comm' value
92 saved for the 'current' process when an event was triggered,
93 which is the same as the common_pid value saved by the event
94 tracing code. Trying to apply that comm value to other pid
95 values wouldn't be correct, and typically events that care save
96 pid-specific comm fields in the event itself.
98 A typical usage scenario would be the following to enable a hist
99 trigger, read its current contents, and then turn it off::
101 # echo 'hist:keys=skbaddr.hex:vals=len' > \
102 /sys/kernel/debug/tracing/events/net/netif_rx/trigger
104 # cat /sys/kernel/debug/tracing/events/net/netif_rx/hist
106 # echo '!hist:keys=skbaddr.hex:vals=len' > \
107 /sys/kernel/debug/tracing/events/net/netif_rx/trigger
109 The trigger file itself can be read to show the details of the
110 currently attached hist trigger. This information is also displayed
111 at the top of the 'hist' file when read.
113 By default, the size of the hash table is 2048 entries. The 'size'
114 parameter can be used to specify more or fewer than that. The units
115 are in terms of hashtable entries - if a run uses more entries than
116 specified, the results will show the number of 'drops', the number
117 of hits that were ignored. The size should be a power of 2 between
118 128 and 131072 (any non- power-of-2 number specified will be rounded
121 The 'sort' parameter can be used to specify a value field to sort
122 on. The default if unspecified is 'hitcount' and the default sort
123 order is 'ascending'. To sort in the opposite direction, append
124 .descending' to the sort key.
126 The 'pause' parameter can be used to pause an existing hist trigger
127 or to start a hist trigger but not log any events until told to do
128 so. 'continue' or 'cont' can be used to start or restart a paused
131 The 'clear' parameter will clear the contents of a running hist
132 trigger and leave its current paused/active state.
134 Note that the 'pause', 'cont', and 'clear' parameters should be
135 applied using 'append' shell operator ('>>') if applied to an
136 existing trigger, rather than via the '>' operator, which will cause
137 the trigger to be removed through truncation.
139 - enable_hist/disable_hist
141 The enable_hist and disable_hist triggers can be used to have one
142 event conditionally start and stop another event's already-attached
143 hist trigger. Any number of enable_hist and disable_hist triggers
144 can be attached to a given event, allowing that event to kick off
145 and stop aggregations on a host of other events.
147 The format is very similar to the enable/disable_event triggers::
149 enable_hist:<system>:<event>[:count]
150 disable_hist:<system>:<event>[:count]
152 Instead of enabling or disabling the tracing of the target event
153 into the trace buffer as the enable/disable_event triggers do, the
154 enable/disable_hist triggers enable or disable the aggregation of
155 the target event into a hash table.
157 A typical usage scenario for the enable_hist/disable_hist triggers
158 would be to first set up a paused hist trigger on some event,
159 followed by an enable_hist/disable_hist pair that turns the hist
160 aggregation on and off when conditions of interest are hit::
162 # echo 'hist:keys=skbaddr.hex:vals=len:pause' > \
163 /sys/kernel/debug/tracing/events/net/netif_receive_skb/trigger
165 # echo 'enable_hist:net:netif_receive_skb if filename==/usr/bin/wget' > \
166 /sys/kernel/debug/tracing/events/sched/sched_process_exec/trigger
168 # echo 'disable_hist:net:netif_receive_skb if comm==wget' > \
169 /sys/kernel/debug/tracing/events/sched/sched_process_exit/trigger
171 The above sets up an initially paused hist trigger which is unpaused
172 and starts aggregating events when a given program is executed, and
173 which stops aggregating when the process exits and the hist trigger
176 The examples below provide a more concrete illustration of the
177 concepts and typical usage patterns discussed above.
179 'special' event fields
180 ------------------------
182 There are a number of 'special event fields' available for use as
183 keys or values in a hist trigger. These look like and behave as if
184 they were actual event fields, but aren't really part of the event's
185 field definition or format file. They are however available for any
186 event, and can be used anywhere an actual event field could be.
189 ====================== ==== =======================================
190 common_timestamp u64 timestamp (from ring buffer) associated
191 with the event, in nanoseconds. May be
192 modified by .usecs to have timestamps
193 interpreted as microseconds.
194 common_cpu int the cpu on which the event occurred.
195 ====================== ==== =======================================
197 Extended error information
198 --------------------------
200 For some error conditions encountered when invoking a hist trigger
201 command, extended error information is available via the
202 corresponding event's 'hist' file. Reading the hist file after an
203 error will display more detailed information about what went wrong,
204 if information is available. This extended error information will
205 be available until the next hist trigger command for that event.
207 If available for a given error condition, the extended error
208 information and usage takes the following form::
210 # echo xxx > /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger
211 echo: write error: Invalid argument
213 # cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/hist
214 ERROR: Couldn't yyy: zzz
217 6.2 'hist' trigger examples
218 ---------------------------
220 The first set of examples creates aggregations using the kmalloc
221 event. The fields that can be used for the hist trigger are listed
222 in the kmalloc event's format file::
224 # cat /sys/kernel/debug/tracing/events/kmem/kmalloc/format
228 field:unsigned short common_type; offset:0; size:2; signed:0;
229 field:unsigned char common_flags; offset:2; size:1; signed:0;
230 field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
231 field:int common_pid; offset:4; size:4; signed:1;
233 field:unsigned long call_site; offset:8; size:8; signed:0;
234 field:const void * ptr; offset:16; size:8; signed:0;
235 field:size_t bytes_req; offset:24; size:8; signed:0;
236 field:size_t bytes_alloc; offset:32; size:8; signed:0;
237 field:gfp_t gfp_flags; offset:40; size:4; signed:0;
239 We'll start by creating a hist trigger that generates a simple table
240 that lists the total number of bytes requested for each function in
241 the kernel that made one or more calls to kmalloc::
243 # echo 'hist:key=call_site:val=bytes_req' > \
244 /sys/kernel/debug/tracing/events/kmem/kmalloc/trigger
246 This tells the tracing system to create a 'hist' trigger using the
247 call_site field of the kmalloc event as the key for the table, which
248 just means that each unique call_site address will have an entry
249 created for it in the table. The 'val=bytes_req' parameter tells
250 the hist trigger that for each unique entry (call_site) in the
251 table, it should keep a running total of the number of bytes
252 requested by that call_site.
254 We'll let it run for awhile and then dump the contents of the 'hist'
255 file in the kmalloc event's subdirectory (for readability, a number
256 of entries have been omitted)::
258 # cat /sys/kernel/debug/tracing/events/kmem/kmalloc/hist
259 # trigger info: hist:keys=call_site:vals=bytes_req:sort=hitcount:size=2048 [active]
261 { call_site: 18446744072106379007 } hitcount: 1 bytes_req: 176
262 { call_site: 18446744071579557049 } hitcount: 1 bytes_req: 1024
263 { call_site: 18446744071580608289 } hitcount: 1 bytes_req: 16384
264 { call_site: 18446744071581827654 } hitcount: 1 bytes_req: 24
265 { call_site: 18446744071580700980 } hitcount: 1 bytes_req: 8
266 { call_site: 18446744071579359876 } hitcount: 1 bytes_req: 152
267 { call_site: 18446744071580795365 } hitcount: 3 bytes_req: 144
268 { call_site: 18446744071581303129 } hitcount: 3 bytes_req: 144
269 { call_site: 18446744071580713234 } hitcount: 4 bytes_req: 2560
270 { call_site: 18446744071580933750 } hitcount: 4 bytes_req: 736
274 { call_site: 18446744072106047046 } hitcount: 69 bytes_req: 5576
275 { call_site: 18446744071582116407 } hitcount: 73 bytes_req: 2336
276 { call_site: 18446744072106054684 } hitcount: 136 bytes_req: 140504
277 { call_site: 18446744072106224230 } hitcount: 136 bytes_req: 19584
278 { call_site: 18446744072106078074 } hitcount: 153 bytes_req: 2448
279 { call_site: 18446744072106062406 } hitcount: 153 bytes_req: 36720
280 { call_site: 18446744071582507929 } hitcount: 153 bytes_req: 37088
281 { call_site: 18446744072102520590 } hitcount: 273 bytes_req: 10920
282 { call_site: 18446744071582143559 } hitcount: 358 bytes_req: 716
283 { call_site: 18446744072106465852 } hitcount: 417 bytes_req: 56712
284 { call_site: 18446744072102523378 } hitcount: 485 bytes_req: 27160
285 { call_site: 18446744072099568646 } hitcount: 1676 bytes_req: 33520
292 The output displays a line for each entry, beginning with the key
293 specified in the trigger, followed by the value(s) also specified in
294 the trigger. At the beginning of the output is a line that displays
295 the trigger info, which can also be displayed by reading the
298 # cat /sys/kernel/debug/tracing/events/kmem/kmalloc/trigger
299 hist:keys=call_site:vals=bytes_req:sort=hitcount:size=2048 [active]
301 At the end of the output are a few lines that display the overall
302 totals for the run. The 'Hits' field shows the total number of
303 times the event trigger was hit, the 'Entries' field shows the total
304 number of used entries in the hash table, and the 'Dropped' field
305 shows the number of hits that were dropped because the number of
306 used entries for the run exceeded the maximum number of entries
307 allowed for the table (normally 0, but if not a hint that you may
308 want to increase the size of the table using the 'size' parameter).
310 Notice in the above output that there's an extra field, 'hitcount',
311 which wasn't specified in the trigger. Also notice that in the
312 trigger info output, there's a parameter, 'sort=hitcount', which
313 wasn't specified in the trigger either. The reason for that is that
314 every trigger implicitly keeps a count of the total number of hits
315 attributed to a given entry, called the 'hitcount'. That hitcount
316 information is explicitly displayed in the output, and in the
317 absence of a user-specified sort parameter, is used as the default
320 The value 'hitcount' can be used in place of an explicit value in
321 the 'values' parameter if you don't really need to have any
322 particular field summed and are mainly interested in hit
325 To turn the hist trigger off, simply call up the trigger in the
326 command history and re-execute it with a '!' prepended::
328 # echo '!hist:key=call_site:val=bytes_req' > \
329 /sys/kernel/debug/tracing/events/kmem/kmalloc/trigger
331 Finally, notice that the call_site as displayed in the output above
332 isn't really very useful. It's an address, but normally addresses
333 are displayed in hex. To have a numeric field displayed as a hex
334 value, simply append '.hex' to the field name in the trigger::
336 # echo 'hist:key=call_site.hex:val=bytes_req' > \
337 /sys/kernel/debug/tracing/events/kmem/kmalloc/trigger
339 # cat /sys/kernel/debug/tracing/events/kmem/kmalloc/hist
340 # trigger info: hist:keys=call_site.hex:vals=bytes_req:sort=hitcount:size=2048 [active]
342 { call_site: ffffffffa026b291 } hitcount: 1 bytes_req: 433
343 { call_site: ffffffffa07186ff } hitcount: 1 bytes_req: 176
344 { call_site: ffffffff811ae721 } hitcount: 1 bytes_req: 16384
345 { call_site: ffffffff811c5134 } hitcount: 1 bytes_req: 8
346 { call_site: ffffffffa04a9ebb } hitcount: 1 bytes_req: 511
347 { call_site: ffffffff8122e0a6 } hitcount: 1 bytes_req: 12
348 { call_site: ffffffff8107da84 } hitcount: 1 bytes_req: 152
349 { call_site: ffffffff812d8246 } hitcount: 1 bytes_req: 24
350 { call_site: ffffffff811dc1e5 } hitcount: 3 bytes_req: 144
351 { call_site: ffffffffa02515e8 } hitcount: 3 bytes_req: 648
352 { call_site: ffffffff81258159 } hitcount: 3 bytes_req: 144
353 { call_site: ffffffff811c80f4 } hitcount: 4 bytes_req: 544
357 { call_site: ffffffffa06c7646 } hitcount: 106 bytes_req: 8024
358 { call_site: ffffffffa06cb246 } hitcount: 132 bytes_req: 31680
359 { call_site: ffffffffa06cef7a } hitcount: 132 bytes_req: 2112
360 { call_site: ffffffff8137e399 } hitcount: 132 bytes_req: 23232
361 { call_site: ffffffffa06c941c } hitcount: 185 bytes_req: 171360
362 { call_site: ffffffffa06f2a66 } hitcount: 185 bytes_req: 26640
363 { call_site: ffffffffa036a70e } hitcount: 265 bytes_req: 10600
364 { call_site: ffffffff81325447 } hitcount: 292 bytes_req: 584
365 { call_site: ffffffffa072da3c } hitcount: 446 bytes_req: 60656
366 { call_site: ffffffffa036b1f2 } hitcount: 526 bytes_req: 29456
367 { call_site: ffffffffa0099c06 } hitcount: 1780 bytes_req: 35600
374 Even that's only marginally more useful - while hex values do look
375 more like addresses, what users are typically more interested in
376 when looking at text addresses are the corresponding symbols
377 instead. To have an address displayed as symbolic value instead,
378 simply append '.sym' or '.sym-offset' to the field name in the
381 # echo 'hist:key=call_site.sym:val=bytes_req' > \
382 /sys/kernel/debug/tracing/events/kmem/kmalloc/trigger
384 # cat /sys/kernel/debug/tracing/events/kmem/kmalloc/hist
385 # trigger info: hist:keys=call_site.sym:vals=bytes_req:sort=hitcount:size=2048 [active]
387 { call_site: [ffffffff810adcb9] syslog_print_all } hitcount: 1 bytes_req: 1024
388 { call_site: [ffffffff8154bc62] usb_control_msg } hitcount: 1 bytes_req: 8
389 { call_site: [ffffffffa00bf6fe] hidraw_send_report [hid] } hitcount: 1 bytes_req: 7
390 { call_site: [ffffffff8154acbe] usb_alloc_urb } hitcount: 1 bytes_req: 192
391 { call_site: [ffffffffa00bf1ca] hidraw_report_event [hid] } hitcount: 1 bytes_req: 7
392 { call_site: [ffffffff811e3a25] __seq_open_private } hitcount: 1 bytes_req: 40
393 { call_site: [ffffffff8109524a] alloc_fair_sched_group } hitcount: 2 bytes_req: 128
394 { call_site: [ffffffff811febd5] fsnotify_alloc_group } hitcount: 2 bytes_req: 528
395 { call_site: [ffffffff81440f58] __tty_buffer_request_room } hitcount: 2 bytes_req: 2624
396 { call_site: [ffffffff81200ba6] inotify_new_group } hitcount: 2 bytes_req: 96
397 { call_site: [ffffffffa05e19af] ieee80211_start_tx_ba_session [mac80211] } hitcount: 2 bytes_req: 464
398 { call_site: [ffffffff81672406] tcp_get_metrics } hitcount: 2 bytes_req: 304
399 { call_site: [ffffffff81097ec2] alloc_rt_sched_group } hitcount: 2 bytes_req: 128
400 { call_site: [ffffffff81089b05] sched_create_group } hitcount: 2 bytes_req: 1424
404 { call_site: [ffffffffa04a580c] intel_crtc_page_flip [i915] } hitcount: 1185 bytes_req: 123240
405 { call_site: [ffffffffa0287592] drm_mode_page_flip_ioctl [drm] } hitcount: 1185 bytes_req: 104280
406 { call_site: [ffffffffa04c4a3c] intel_plane_duplicate_state [i915] } hitcount: 1402 bytes_req: 190672
407 { call_site: [ffffffff812891ca] ext4_find_extent } hitcount: 1518 bytes_req: 146208
408 { call_site: [ffffffffa029070e] drm_vma_node_allow [drm] } hitcount: 1746 bytes_req: 69840
409 { call_site: [ffffffffa045e7c4] i915_gem_do_execbuffer.isra.23 [i915] } hitcount: 2021 bytes_req: 792312
410 { call_site: [ffffffffa02911f2] drm_modeset_lock_crtc [drm] } hitcount: 2592 bytes_req: 145152
411 { call_site: [ffffffffa0489a66] intel_ring_begin [i915] } hitcount: 2629 bytes_req: 378576
412 { call_site: [ffffffffa046041c] i915_gem_execbuffer2 [i915] } hitcount: 2629 bytes_req: 3783248
413 { call_site: [ffffffff81325607] apparmor_file_alloc_security } hitcount: 5192 bytes_req: 10384
414 { call_site: [ffffffffa00b7c06] hid_report_raw_event [hid] } hitcount: 5529 bytes_req: 110584
415 { call_site: [ffffffff8131ebf7] aa_alloc_task_context } hitcount: 21943 bytes_req: 702176
416 { call_site: [ffffffff8125847d] ext4_htree_store_dirent } hitcount: 55759 bytes_req: 5074265
423 Because the default sort key above is 'hitcount', the above shows a
424 the list of call_sites by increasing hitcount, so that at the bottom
425 we see the functions that made the most kmalloc calls during the
426 run. If instead we we wanted to see the top kmalloc callers in
427 terms of the number of bytes requested rather than the number of
428 calls, and we wanted the top caller to appear at the top, we can use
429 the 'sort' parameter, along with the 'descending' modifier::
431 # echo 'hist:key=call_site.sym:val=bytes_req:sort=bytes_req.descending' > \
432 /sys/kernel/debug/tracing/events/kmem/kmalloc/trigger
434 # cat /sys/kernel/debug/tracing/events/kmem/kmalloc/hist
435 # trigger info: hist:keys=call_site.sym:vals=bytes_req:sort=bytes_req.descending:size=2048 [active]
437 { call_site: [ffffffffa046041c] i915_gem_execbuffer2 [i915] } hitcount: 2186 bytes_req: 3397464
438 { call_site: [ffffffffa045e7c4] i915_gem_do_execbuffer.isra.23 [i915] } hitcount: 1790 bytes_req: 712176
439 { call_site: [ffffffff8125847d] ext4_htree_store_dirent } hitcount: 8132 bytes_req: 513135
440 { call_site: [ffffffff811e2a1b] seq_buf_alloc } hitcount: 106 bytes_req: 440128
441 { call_site: [ffffffffa0489a66] intel_ring_begin [i915] } hitcount: 2186 bytes_req: 314784
442 { call_site: [ffffffff812891ca] ext4_find_extent } hitcount: 2174 bytes_req: 208992
443 { call_site: [ffffffff811ae8e1] __kmalloc } hitcount: 8 bytes_req: 131072
444 { call_site: [ffffffffa04c4a3c] intel_plane_duplicate_state [i915] } hitcount: 859 bytes_req: 116824
445 { call_site: [ffffffffa02911f2] drm_modeset_lock_crtc [drm] } hitcount: 1834 bytes_req: 102704
446 { call_site: [ffffffffa04a580c] intel_crtc_page_flip [i915] } hitcount: 972 bytes_req: 101088
447 { call_site: [ffffffffa0287592] drm_mode_page_flip_ioctl [drm] } hitcount: 972 bytes_req: 85536
448 { call_site: [ffffffffa00b7c06] hid_report_raw_event [hid] } hitcount: 3333 bytes_req: 66664
449 { call_site: [ffffffff8137e559] sg_kmalloc } hitcount: 209 bytes_req: 61632
453 { call_site: [ffffffff81095225] alloc_fair_sched_group } hitcount: 2 bytes_req: 128
454 { call_site: [ffffffff81097ec2] alloc_rt_sched_group } hitcount: 2 bytes_req: 128
455 { call_site: [ffffffff812d8406] copy_semundo } hitcount: 2 bytes_req: 48
456 { call_site: [ffffffff81200ba6] inotify_new_group } hitcount: 1 bytes_req: 48
457 { call_site: [ffffffffa027121a] drm_getmagic [drm] } hitcount: 1 bytes_req: 48
458 { call_site: [ffffffff811e3a25] __seq_open_private } hitcount: 1 bytes_req: 40
459 { call_site: [ffffffff811c52f4] bprm_change_interp } hitcount: 2 bytes_req: 16
460 { call_site: [ffffffff8154bc62] usb_control_msg } hitcount: 1 bytes_req: 8
461 { call_site: [ffffffffa00bf1ca] hidraw_report_event [hid] } hitcount: 1 bytes_req: 7
462 { call_site: [ffffffffa00bf6fe] hidraw_send_report [hid] } hitcount: 1 bytes_req: 7
469 To display the offset and size information in addition to the symbol
470 name, just use 'sym-offset' instead::
472 # echo 'hist:key=call_site.sym-offset:val=bytes_req:sort=bytes_req.descending' > \
473 /sys/kernel/debug/tracing/events/kmem/kmalloc/trigger
475 # cat /sys/kernel/debug/tracing/events/kmem/kmalloc/hist
476 # trigger info: hist:keys=call_site.sym-offset:vals=bytes_req:sort=bytes_req.descending:size=2048 [active]
478 { call_site: [ffffffffa046041c] i915_gem_execbuffer2+0x6c/0x2c0 [i915] } hitcount: 4569 bytes_req: 3163720
479 { call_site: [ffffffffa0489a66] intel_ring_begin+0xc6/0x1f0 [i915] } hitcount: 4569 bytes_req: 657936
480 { call_site: [ffffffffa045e7c4] i915_gem_do_execbuffer.isra.23+0x694/0x1020 [i915] } hitcount: 1519 bytes_req: 472936
481 { call_site: [ffffffffa045e646] i915_gem_do_execbuffer.isra.23+0x516/0x1020 [i915] } hitcount: 3050 bytes_req: 211832
482 { call_site: [ffffffff811e2a1b] seq_buf_alloc+0x1b/0x50 } hitcount: 34 bytes_req: 148384
483 { call_site: [ffffffffa04a580c] intel_crtc_page_flip+0xbc/0x870 [i915] } hitcount: 1385 bytes_req: 144040
484 { call_site: [ffffffff811ae8e1] __kmalloc+0x191/0x1b0 } hitcount: 8 bytes_req: 131072
485 { call_site: [ffffffffa0287592] drm_mode_page_flip_ioctl+0x282/0x360 [drm] } hitcount: 1385 bytes_req: 121880
486 { call_site: [ffffffffa02911f2] drm_modeset_lock_crtc+0x32/0x100 [drm] } hitcount: 1848 bytes_req: 103488
487 { call_site: [ffffffffa04c4a3c] intel_plane_duplicate_state+0x2c/0xa0 [i915] } hitcount: 461 bytes_req: 62696
488 { call_site: [ffffffffa029070e] drm_vma_node_allow+0x2e/0xd0 [drm] } hitcount: 1541 bytes_req: 61640
489 { call_site: [ffffffff815f8d7b] sk_prot_alloc+0xcb/0x1b0 } hitcount: 57 bytes_req: 57456
493 { call_site: [ffffffff8109524a] alloc_fair_sched_group+0x5a/0x1a0 } hitcount: 2 bytes_req: 128
494 { call_site: [ffffffffa027b921] drm_vm_open_locked+0x31/0xa0 [drm] } hitcount: 3 bytes_req: 96
495 { call_site: [ffffffff8122e266] proc_self_follow_link+0x76/0xb0 } hitcount: 8 bytes_req: 96
496 { call_site: [ffffffff81213e80] load_elf_binary+0x240/0x1650 } hitcount: 3 bytes_req: 84
497 { call_site: [ffffffff8154bc62] usb_control_msg+0x42/0x110 } hitcount: 1 bytes_req: 8
498 { call_site: [ffffffffa00bf6fe] hidraw_send_report+0x7e/0x1a0 [hid] } hitcount: 1 bytes_req: 7
499 { call_site: [ffffffffa00bf1ca] hidraw_report_event+0x8a/0x120 [hid] } hitcount: 1 bytes_req: 7
506 We can also add multiple fields to the 'values' parameter. For
507 example, we might want to see the total number of bytes allocated
508 alongside bytes requested, and display the result sorted by bytes
509 allocated in a descending order::
511 # echo 'hist:keys=call_site.sym:values=bytes_req,bytes_alloc:sort=bytes_alloc.descending' > \
512 /sys/kernel/debug/tracing/events/kmem/kmalloc/trigger
514 # cat /sys/kernel/debug/tracing/events/kmem/kmalloc/hist
515 # trigger info: hist:keys=call_site.sym:vals=bytes_req,bytes_alloc:sort=bytes_alloc.descending:size=2048 [active]
517 { call_site: [ffffffffa046041c] i915_gem_execbuffer2 [i915] } hitcount: 7403 bytes_req: 4084360 bytes_alloc: 5958016
518 { call_site: [ffffffff811e2a1b] seq_buf_alloc } hitcount: 541 bytes_req: 2213968 bytes_alloc: 2228224
519 { call_site: [ffffffffa0489a66] intel_ring_begin [i915] } hitcount: 7404 bytes_req: 1066176 bytes_alloc: 1421568
520 { call_site: [ffffffffa045e7c4] i915_gem_do_execbuffer.isra.23 [i915] } hitcount: 1565 bytes_req: 557368 bytes_alloc: 1037760
521 { call_site: [ffffffff8125847d] ext4_htree_store_dirent } hitcount: 9557 bytes_req: 595778 bytes_alloc: 695744
522 { call_site: [ffffffffa045e646] i915_gem_do_execbuffer.isra.23 [i915] } hitcount: 5839 bytes_req: 430680 bytes_alloc: 470400
523 { call_site: [ffffffffa04c4a3c] intel_plane_duplicate_state [i915] } hitcount: 2388 bytes_req: 324768 bytes_alloc: 458496
524 { call_site: [ffffffffa02911f2] drm_modeset_lock_crtc [drm] } hitcount: 3911 bytes_req: 219016 bytes_alloc: 250304
525 { call_site: [ffffffff815f8d7b] sk_prot_alloc } hitcount: 235 bytes_req: 236880 bytes_alloc: 240640
526 { call_site: [ffffffff8137e559] sg_kmalloc } hitcount: 557 bytes_req: 169024 bytes_alloc: 221760
527 { call_site: [ffffffffa00b7c06] hid_report_raw_event [hid] } hitcount: 9378 bytes_req: 187548 bytes_alloc: 206312
528 { call_site: [ffffffffa04a580c] intel_crtc_page_flip [i915] } hitcount: 1519 bytes_req: 157976 bytes_alloc: 194432
532 { call_site: [ffffffff8109bd3b] sched_autogroup_create_attach } hitcount: 2 bytes_req: 144 bytes_alloc: 192
533 { call_site: [ffffffff81097ee8] alloc_rt_sched_group } hitcount: 2 bytes_req: 128 bytes_alloc: 128
534 { call_site: [ffffffff8109524a] alloc_fair_sched_group } hitcount: 2 bytes_req: 128 bytes_alloc: 128
535 { call_site: [ffffffff81095225] alloc_fair_sched_group } hitcount: 2 bytes_req: 128 bytes_alloc: 128
536 { call_site: [ffffffff81097ec2] alloc_rt_sched_group } hitcount: 2 bytes_req: 128 bytes_alloc: 128
537 { call_site: [ffffffff81213e80] load_elf_binary } hitcount: 3 bytes_req: 84 bytes_alloc: 96
538 { call_site: [ffffffff81079a2e] kthread_create_on_node } hitcount: 1 bytes_req: 56 bytes_alloc: 64
539 { call_site: [ffffffffa00bf6fe] hidraw_send_report [hid] } hitcount: 1 bytes_req: 7 bytes_alloc: 8
540 { call_site: [ffffffff8154bc62] usb_control_msg } hitcount: 1 bytes_req: 8 bytes_alloc: 8
541 { call_site: [ffffffffa00bf1ca] hidraw_report_event [hid] } hitcount: 1 bytes_req: 7 bytes_alloc: 8
548 Finally, to finish off our kmalloc example, instead of simply having
549 the hist trigger display symbolic call_sites, we can have the hist
550 trigger additionally display the complete set of kernel stack traces
551 that led to each call_site. To do that, we simply use the special
552 value 'stacktrace' for the key parameter::
554 # echo 'hist:keys=stacktrace:values=bytes_req,bytes_alloc:sort=bytes_alloc' > \
555 /sys/kernel/debug/tracing/events/kmem/kmalloc/trigger
557 The above trigger will use the kernel stack trace in effect when an
558 event is triggered as the key for the hash table. This allows the
559 enumeration of every kernel callpath that led up to a particular
560 event, along with a running total of any of the event fields for
561 that event. Here we tally bytes requested and bytes allocated for
562 every callpath in the system that led up to a kmalloc (in this case
563 every callpath to a kmalloc for a kernel compile)::
565 # cat /sys/kernel/debug/tracing/events/kmem/kmalloc/hist
566 # trigger info: hist:keys=stacktrace:vals=bytes_req,bytes_alloc:sort=bytes_alloc:size=2048 [active]
569 __kmalloc_track_caller+0x10b/0x1a0
571 hidraw_report_event+0x8a/0x120 [hid]
572 hid_report_raw_event+0x3ea/0x440 [hid]
573 hid_input_report+0x112/0x190 [hid]
574 hid_irq_in+0xc2/0x260 [usbhid]
575 __usb_hcd_giveback_urb+0x72/0x120
576 usb_giveback_urb_bh+0x9e/0xe0
577 tasklet_hi_action+0xf8/0x100
578 __do_softirq+0x114/0x2c0
581 ret_from_intr+0x0/0x30
582 cpuidle_enter+0x17/0x20
583 cpu_startup_entry+0x315/0x3e0
585 } hitcount: 3 bytes_req: 21 bytes_alloc: 24
587 __kmalloc_track_caller+0x10b/0x1a0
589 hidraw_report_event+0x8a/0x120 [hid]
590 hid_report_raw_event+0x3ea/0x440 [hid]
591 hid_input_report+0x112/0x190 [hid]
592 hid_irq_in+0xc2/0x260 [usbhid]
593 __usb_hcd_giveback_urb+0x72/0x120
594 usb_giveback_urb_bh+0x9e/0xe0
595 tasklet_hi_action+0xf8/0x100
596 __do_softirq+0x114/0x2c0
599 ret_from_intr+0x0/0x30
600 } hitcount: 3 bytes_req: 21 bytes_alloc: 24
602 kmem_cache_alloc_trace+0xeb/0x150
603 aa_alloc_task_context+0x27/0x40
604 apparmor_cred_prepare+0x1f/0x50
605 security_prepare_creds+0x16/0x20
606 prepare_creds+0xdf/0x1a0
607 SyS_capset+0xb5/0x200
608 system_call_fastpath+0x12/0x6a
609 } hitcount: 1 bytes_req: 32 bytes_alloc: 32
614 __kmalloc+0x11b/0x1b0
615 i915_gem_execbuffer2+0x6c/0x2c0 [i915]
616 drm_ioctl+0x349/0x670 [drm]
617 do_vfs_ioctl+0x2f0/0x4f0
619 system_call_fastpath+0x12/0x6a
620 } hitcount: 17726 bytes_req: 13944120 bytes_alloc: 19593808
622 __kmalloc+0x11b/0x1b0
623 load_elf_phdrs+0x76/0xa0
624 load_elf_binary+0x102/0x1650
625 search_binary_handler+0x97/0x1d0
626 do_execveat_common.isra.34+0x551/0x6e0
628 return_from_execve+0x0/0x23
629 } hitcount: 33348 bytes_req: 17152128 bytes_alloc: 20226048
631 kmem_cache_alloc_trace+0xeb/0x150
632 apparmor_file_alloc_security+0x27/0x40
633 security_file_alloc+0x16/0x20
634 get_empty_filp+0x93/0x1c0
635 path_openat+0x31/0x5f0
636 do_filp_open+0x3a/0x90
637 do_sys_open+0x128/0x220
639 system_call_fastpath+0x12/0x6a
640 } hitcount: 4766422 bytes_req: 9532844 bytes_alloc: 38131376
642 __kmalloc+0x11b/0x1b0
643 seq_buf_alloc+0x1b/0x50
645 proc_reg_read+0x3d/0x80
649 system_call_fastpath+0x12/0x6a
650 } hitcount: 19133 bytes_req: 78368768 bytes_alloc: 78368768
657 If you key a hist trigger on common_pid, in order for example to
658 gather and display sorted totals for each process, you can use the
659 special .execname modifier to display the executable names for the
660 processes in the table rather than raw pids. The example below
661 keeps a per-process sum of total bytes read::
663 # echo 'hist:key=common_pid.execname:val=count:sort=count.descending' > \
664 /sys/kernel/debug/tracing/events/syscalls/sys_enter_read/trigger
666 # cat /sys/kernel/debug/tracing/events/syscalls/sys_enter_read/hist
667 # trigger info: hist:keys=common_pid.execname:vals=count:sort=count.descending:size=2048 [active]
669 { common_pid: gnome-terminal [ 3196] } hitcount: 280 count: 1093512
670 { common_pid: Xorg [ 1309] } hitcount: 525 count: 256640
671 { common_pid: compiz [ 2889] } hitcount: 59 count: 254400
672 { common_pid: bash [ 8710] } hitcount: 3 count: 66369
673 { common_pid: dbus-daemon-lau [ 8703] } hitcount: 49 count: 47739
674 { common_pid: irqbalance [ 1252] } hitcount: 27 count: 27648
675 { common_pid: 01ifupdown [ 8705] } hitcount: 3 count: 17216
676 { common_pid: dbus-daemon [ 772] } hitcount: 10 count: 12396
677 { common_pid: Socket Thread [ 8342] } hitcount: 11 count: 11264
678 { common_pid: nm-dhcp-client. [ 8701] } hitcount: 6 count: 7424
679 { common_pid: gmain [ 1315] } hitcount: 18 count: 6336
683 { common_pid: postgres [ 1892] } hitcount: 2 count: 32
684 { common_pid: postgres [ 1891] } hitcount: 2 count: 32
685 { common_pid: gmain [ 8704] } hitcount: 2 count: 32
686 { common_pid: upstart-dbus-br [ 2740] } hitcount: 21 count: 21
687 { common_pid: nm-dispatcher.a [ 8696] } hitcount: 1 count: 16
688 { common_pid: indicator-datet [ 2904] } hitcount: 1 count: 16
689 { common_pid: gdbus [ 2998] } hitcount: 1 count: 16
690 { common_pid: rtkit-daemon [ 2052] } hitcount: 1 count: 8
691 { common_pid: init [ 1] } hitcount: 2 count: 2
698 Similarly, if you key a hist trigger on syscall id, for example to
699 gather and display a list of systemwide syscall hits, you can use
700 the special .syscall modifier to display the syscall names rather
701 than raw ids. The example below keeps a running total of syscall
702 counts for the system during the run::
704 # echo 'hist:key=id.syscall:val=hitcount' > \
705 /sys/kernel/debug/tracing/events/raw_syscalls/sys_enter/trigger
707 # cat /sys/kernel/debug/tracing/events/raw_syscalls/sys_enter/hist
708 # trigger info: hist:keys=id.syscall:vals=hitcount:sort=hitcount:size=2048 [active]
710 { id: sys_fsync [ 74] } hitcount: 1
711 { id: sys_newuname [ 63] } hitcount: 1
712 { id: sys_prctl [157] } hitcount: 1
713 { id: sys_statfs [137] } hitcount: 1
714 { id: sys_symlink [ 88] } hitcount: 1
715 { id: sys_sendmmsg [307] } hitcount: 1
716 { id: sys_semctl [ 66] } hitcount: 1
717 { id: sys_readlink [ 89] } hitcount: 3
718 { id: sys_bind [ 49] } hitcount: 3
719 { id: sys_getsockname [ 51] } hitcount: 3
720 { id: sys_unlink [ 87] } hitcount: 3
721 { id: sys_rename [ 82] } hitcount: 4
722 { id: unknown_syscall [ 58] } hitcount: 4
723 { id: sys_connect [ 42] } hitcount: 4
724 { id: sys_getpid [ 39] } hitcount: 4
728 { id: sys_rt_sigprocmask [ 14] } hitcount: 952
729 { id: sys_futex [202] } hitcount: 1534
730 { id: sys_write [ 1] } hitcount: 2689
731 { id: sys_setitimer [ 38] } hitcount: 2797
732 { id: sys_read [ 0] } hitcount: 3202
733 { id: sys_select [ 23] } hitcount: 3773
734 { id: sys_writev [ 20] } hitcount: 4531
735 { id: sys_poll [ 7] } hitcount: 8314
736 { id: sys_recvmsg [ 47] } hitcount: 13738
737 { id: sys_ioctl [ 16] } hitcount: 21843
744 The syscall counts above provide a rough overall picture of system
745 call activity on the system; we can see for example that the most
746 popular system call on this system was the 'sys_ioctl' system call.
748 We can use 'compound' keys to refine that number and provide some
749 further insight as to which processes exactly contribute to the
752 The command below keeps a hitcount for every unique combination of
753 system call id and pid - the end result is essentially a table
754 that keeps a per-pid sum of system call hits. The results are
755 sorted using the system call id as the primary key, and the
756 hitcount sum as the secondary key::
758 # echo 'hist:key=id.syscall,common_pid.execname:val=hitcount:sort=id,hitcount' > \
759 /sys/kernel/debug/tracing/events/raw_syscalls/sys_enter/trigger
761 # cat /sys/kernel/debug/tracing/events/raw_syscalls/sys_enter/hist
762 # trigger info: hist:keys=id.syscall,common_pid.execname:vals=hitcount:sort=id.syscall,hitcount:size=2048 [active]
764 { id: sys_read [ 0], common_pid: rtkit-daemon [ 1877] } hitcount: 1
765 { id: sys_read [ 0], common_pid: gdbus [ 2976] } hitcount: 1
766 { id: sys_read [ 0], common_pid: console-kit-dae [ 3400] } hitcount: 1
767 { id: sys_read [ 0], common_pid: postgres [ 1865] } hitcount: 1
768 { id: sys_read [ 0], common_pid: deja-dup-monito [ 3543] } hitcount: 2
769 { id: sys_read [ 0], common_pid: NetworkManager [ 890] } hitcount: 2
770 { id: sys_read [ 0], common_pid: evolution-calen [ 3048] } hitcount: 2
771 { id: sys_read [ 0], common_pid: postgres [ 1864] } hitcount: 2
772 { id: sys_read [ 0], common_pid: nm-applet [ 3022] } hitcount: 2
773 { id: sys_read [ 0], common_pid: whoopsie [ 1212] } hitcount: 2
777 { id: sys_ioctl [ 16], common_pid: bash [ 8479] } hitcount: 1
778 { id: sys_ioctl [ 16], common_pid: bash [ 3472] } hitcount: 12
779 { id: sys_ioctl [ 16], common_pid: gnome-terminal [ 3199] } hitcount: 16
780 { id: sys_ioctl [ 16], common_pid: Xorg [ 1267] } hitcount: 1808
781 { id: sys_ioctl [ 16], common_pid: compiz [ 2994] } hitcount: 5580
785 { id: sys_waitid [247], common_pid: upstart-dbus-br [ 2690] } hitcount: 3
786 { id: sys_waitid [247], common_pid: upstart-dbus-br [ 2688] } hitcount: 16
787 { id: sys_inotify_add_watch [254], common_pid: gmain [ 975] } hitcount: 2
788 { id: sys_inotify_add_watch [254], common_pid: gmain [ 3204] } hitcount: 4
789 { id: sys_inotify_add_watch [254], common_pid: gmain [ 2888] } hitcount: 4
790 { id: sys_inotify_add_watch [254], common_pid: gmain [ 3003] } hitcount: 4
791 { id: sys_inotify_add_watch [254], common_pid: gmain [ 2873] } hitcount: 4
792 { id: sys_inotify_add_watch [254], common_pid: gmain [ 3196] } hitcount: 6
793 { id: sys_openat [257], common_pid: java [ 2623] } hitcount: 2
794 { id: sys_eventfd2 [290], common_pid: ibus-ui-gtk3 [ 2760] } hitcount: 4
795 { id: sys_eventfd2 [290], common_pid: compiz [ 2994] } hitcount: 6
802 The above list does give us a breakdown of the ioctl syscall by
803 pid, but it also gives us quite a bit more than that, which we
804 don't really care about at the moment. Since we know the syscall
805 id for sys_ioctl (16, displayed next to the sys_ioctl name), we
806 can use that to filter out all the other syscalls::
808 # echo 'hist:key=id.syscall,common_pid.execname:val=hitcount:sort=id,hitcount if id == 16' > \
809 /sys/kernel/debug/tracing/events/raw_syscalls/sys_enter/trigger
811 # cat /sys/kernel/debug/tracing/events/raw_syscalls/sys_enter/hist
812 # trigger info: hist:keys=id.syscall,common_pid.execname:vals=hitcount:sort=id.syscall,hitcount:size=2048 if id == 16 [active]
814 { id: sys_ioctl [ 16], common_pid: gmain [ 2769] } hitcount: 1
815 { id: sys_ioctl [ 16], common_pid: evolution-addre [ 8571] } hitcount: 1
816 { id: sys_ioctl [ 16], common_pid: gmain [ 3003] } hitcount: 1
817 { id: sys_ioctl [ 16], common_pid: gmain [ 2781] } hitcount: 1
818 { id: sys_ioctl [ 16], common_pid: gmain [ 2829] } hitcount: 1
819 { id: sys_ioctl [ 16], common_pid: bash [ 8726] } hitcount: 1
820 { id: sys_ioctl [ 16], common_pid: bash [ 8508] } hitcount: 1
821 { id: sys_ioctl [ 16], common_pid: gmain [ 2970] } hitcount: 1
822 { id: sys_ioctl [ 16], common_pid: gmain [ 2768] } hitcount: 1
826 { id: sys_ioctl [ 16], common_pid: pool [ 8559] } hitcount: 45
827 { id: sys_ioctl [ 16], common_pid: pool [ 8555] } hitcount: 48
828 { id: sys_ioctl [ 16], common_pid: pool [ 8551] } hitcount: 48
829 { id: sys_ioctl [ 16], common_pid: avahi-daemon [ 896] } hitcount: 66
830 { id: sys_ioctl [ 16], common_pid: Xorg [ 1267] } hitcount: 26674
831 { id: sys_ioctl [ 16], common_pid: compiz [ 2994] } hitcount: 73443
838 The above output shows that 'compiz' and 'Xorg' are far and away
839 the heaviest ioctl callers (which might lead to questions about
840 whether they really need to be making all those calls and to
841 possible avenues for further investigation.)
843 The compound key examples used a key and a sum value (hitcount) to
844 sort the output, but we can just as easily use two keys instead.
845 Here's an example where we use a compound key composed of the the
846 common_pid and size event fields. Sorting with pid as the primary
847 key and 'size' as the secondary key allows us to display an
848 ordered summary of the recvfrom sizes, with counts, received by
851 # echo 'hist:key=common_pid.execname,size:val=hitcount:sort=common_pid,size' > \
852 /sys/kernel/debug/tracing/events/syscalls/sys_enter_recvfrom/trigger
854 # cat /sys/kernel/debug/tracing/events/syscalls/sys_enter_recvfrom/hist
855 # trigger info: hist:keys=common_pid.execname,size:vals=hitcount:sort=common_pid.execname,size:size=2048 [active]
857 { common_pid: smbd [ 784], size: 4 } hitcount: 1
858 { common_pid: dnsmasq [ 1412], size: 4096 } hitcount: 672
859 { common_pid: postgres [ 1796], size: 1000 } hitcount: 6
860 { common_pid: postgres [ 1867], size: 1000 } hitcount: 10
861 { common_pid: bamfdaemon [ 2787], size: 28 } hitcount: 2
862 { common_pid: bamfdaemon [ 2787], size: 14360 } hitcount: 1
863 { common_pid: compiz [ 2994], size: 8 } hitcount: 1
864 { common_pid: compiz [ 2994], size: 20 } hitcount: 11
865 { common_pid: gnome-terminal [ 3199], size: 4 } hitcount: 2
866 { common_pid: firefox [ 8817], size: 4 } hitcount: 1
867 { common_pid: firefox [ 8817], size: 8 } hitcount: 5
868 { common_pid: firefox [ 8817], size: 588 } hitcount: 2
869 { common_pid: firefox [ 8817], size: 628 } hitcount: 1
870 { common_pid: firefox [ 8817], size: 6944 } hitcount: 1
871 { common_pid: firefox [ 8817], size: 408880 } hitcount: 2
872 { common_pid: firefox [ 8822], size: 8 } hitcount: 2
873 { common_pid: firefox [ 8822], size: 160 } hitcount: 2
874 { common_pid: firefox [ 8822], size: 320 } hitcount: 2
875 { common_pid: firefox [ 8822], size: 352 } hitcount: 1
879 { common_pid: pool [ 8923], size: 1960 } hitcount: 10
880 { common_pid: pool [ 8923], size: 2048 } hitcount: 10
881 { common_pid: pool [ 8924], size: 1960 } hitcount: 10
882 { common_pid: pool [ 8924], size: 2048 } hitcount: 10
883 { common_pid: pool [ 8928], size: 1964 } hitcount: 4
884 { common_pid: pool [ 8928], size: 1965 } hitcount: 2
885 { common_pid: pool [ 8928], size: 2048 } hitcount: 6
886 { common_pid: pool [ 8929], size: 1982 } hitcount: 1
887 { common_pid: pool [ 8929], size: 2048 } hitcount: 1
894 The above example also illustrates the fact that although a compound
895 key is treated as a single entity for hashing purposes, the sub-keys
896 it's composed of can be accessed independently.
898 The next example uses a string field as the hash key and
899 demonstrates how you can manually pause and continue a hist trigger.
900 In this example, we'll aggregate fork counts and don't expect a
901 large number of entries in the hash table, so we'll drop it to a
902 much smaller number, say 256::
904 # echo 'hist:key=child_comm:val=hitcount:size=256' > \
905 /sys/kernel/debug/tracing/events/sched/sched_process_fork/trigger
907 # cat /sys/kernel/debug/tracing/events/sched/sched_process_fork/hist
908 # trigger info: hist:keys=child_comm:vals=hitcount:sort=hitcount:size=256 [active]
910 { child_comm: dconf worker } hitcount: 1
911 { child_comm: ibus-daemon } hitcount: 1
912 { child_comm: whoopsie } hitcount: 1
913 { child_comm: smbd } hitcount: 1
914 { child_comm: gdbus } hitcount: 1
915 { child_comm: kthreadd } hitcount: 1
916 { child_comm: dconf worker } hitcount: 1
917 { child_comm: evolution-alarm } hitcount: 2
918 { child_comm: Socket Thread } hitcount: 2
919 { child_comm: postgres } hitcount: 2
920 { child_comm: bash } hitcount: 3
921 { child_comm: compiz } hitcount: 3
922 { child_comm: evolution-sourc } hitcount: 4
923 { child_comm: dhclient } hitcount: 4
924 { child_comm: pool } hitcount: 5
925 { child_comm: nm-dispatcher.a } hitcount: 8
926 { child_comm: firefox } hitcount: 8
927 { child_comm: dbus-daemon } hitcount: 8
928 { child_comm: glib-pacrunner } hitcount: 10
929 { child_comm: evolution } hitcount: 23
936 If we want to pause the hist trigger, we can simply append :pause to
937 the command that started the trigger. Notice that the trigger info
938 displays as [paused]::
940 # echo 'hist:key=child_comm:val=hitcount:size=256:pause' >> \
941 /sys/kernel/debug/tracing/events/sched/sched_process_fork/trigger
943 # cat /sys/kernel/debug/tracing/events/sched/sched_process_fork/hist
944 # trigger info: hist:keys=child_comm:vals=hitcount:sort=hitcount:size=256 [paused]
946 { child_comm: dconf worker } hitcount: 1
947 { child_comm: kthreadd } hitcount: 1
948 { child_comm: dconf worker } hitcount: 1
949 { child_comm: gdbus } hitcount: 1
950 { child_comm: ibus-daemon } hitcount: 1
951 { child_comm: Socket Thread } hitcount: 2
952 { child_comm: evolution-alarm } hitcount: 2
953 { child_comm: smbd } hitcount: 2
954 { child_comm: bash } hitcount: 3
955 { child_comm: whoopsie } hitcount: 3
956 { child_comm: compiz } hitcount: 3
957 { child_comm: evolution-sourc } hitcount: 4
958 { child_comm: pool } hitcount: 5
959 { child_comm: postgres } hitcount: 6
960 { child_comm: firefox } hitcount: 8
961 { child_comm: dhclient } hitcount: 10
962 { child_comm: emacs } hitcount: 12
963 { child_comm: dbus-daemon } hitcount: 20
964 { child_comm: nm-dispatcher.a } hitcount: 20
965 { child_comm: evolution } hitcount: 35
966 { child_comm: glib-pacrunner } hitcount: 59
973 To manually continue having the trigger aggregate events, append
974 :cont instead. Notice that the trigger info displays as [active]
975 again, and the data has changed::
977 # echo 'hist:key=child_comm:val=hitcount:size=256:cont' >> \
978 /sys/kernel/debug/tracing/events/sched/sched_process_fork/trigger
980 # cat /sys/kernel/debug/tracing/events/sched/sched_process_fork/hist
981 # trigger info: hist:keys=child_comm:vals=hitcount:sort=hitcount:size=256 [active]
983 { child_comm: dconf worker } hitcount: 1
984 { child_comm: dconf worker } hitcount: 1
985 { child_comm: kthreadd } hitcount: 1
986 { child_comm: gdbus } hitcount: 1
987 { child_comm: ibus-daemon } hitcount: 1
988 { child_comm: Socket Thread } hitcount: 2
989 { child_comm: evolution-alarm } hitcount: 2
990 { child_comm: smbd } hitcount: 2
991 { child_comm: whoopsie } hitcount: 3
992 { child_comm: compiz } hitcount: 3
993 { child_comm: evolution-sourc } hitcount: 4
994 { child_comm: bash } hitcount: 5
995 { child_comm: pool } hitcount: 5
996 { child_comm: postgres } hitcount: 6
997 { child_comm: firefox } hitcount: 8
998 { child_comm: dhclient } hitcount: 11
999 { child_comm: emacs } hitcount: 12
1000 { child_comm: dbus-daemon } hitcount: 22
1001 { child_comm: nm-dispatcher.a } hitcount: 22
1002 { child_comm: evolution } hitcount: 35
1003 { child_comm: glib-pacrunner } hitcount: 59
1010 The previous example showed how to start and stop a hist trigger by
1011 appending 'pause' and 'continue' to the hist trigger command. A
1012 hist trigger can also be started in a paused state by initially
1013 starting the trigger with ':pause' appended. This allows you to
1014 start the trigger only when you're ready to start collecting data
1015 and not before. For example, you could start the trigger in a
1016 paused state, then unpause it and do something you want to measure,
1017 then pause the trigger again when done.
1019 Of course, doing this manually can be difficult and error-prone, but
1020 it is possible to automatically start and stop a hist trigger based
1021 on some condition, via the enable_hist and disable_hist triggers.
1023 For example, suppose we wanted to take a look at the relative
1024 weights in terms of skb length for each callpath that leads to a
1025 netif_receieve_skb event when downloading a decent-sized file using
1028 First we set up an initially paused stacktrace trigger on the
1029 netif_receive_skb event::
1031 # echo 'hist:key=stacktrace:vals=len:pause' > \
1032 /sys/kernel/debug/tracing/events/net/netif_receive_skb/trigger
1034 Next, we set up an 'enable_hist' trigger on the sched_process_exec
1035 event, with an 'if filename==/usr/bin/wget' filter. The effect of
1036 this new trigger is that it will 'unpause' the hist trigger we just
1037 set up on netif_receive_skb if and only if it sees a
1038 sched_process_exec event with a filename of '/usr/bin/wget'. When
1039 that happens, all netif_receive_skb events are aggregated into a
1040 hash table keyed on stacktrace::
1042 # echo 'enable_hist:net:netif_receive_skb if filename==/usr/bin/wget' > \
1043 /sys/kernel/debug/tracing/events/sched/sched_process_exec/trigger
1045 The aggregation continues until the netif_receive_skb is paused
1046 again, which is what the following disable_hist event does by
1047 creating a similar setup on the sched_process_exit event, using the
1048 filter 'comm==wget'::
1050 # echo 'disable_hist:net:netif_receive_skb if comm==wget' > \
1051 /sys/kernel/debug/tracing/events/sched/sched_process_exit/trigger
1053 Whenever a process exits and the comm field of the disable_hist
1054 trigger filter matches 'comm==wget', the netif_receive_skb hist
1055 trigger is disabled.
1057 The overall effect is that netif_receive_skb events are aggregated
1058 into the hash table for only the duration of the wget. Executing a
1059 wget command and then listing the 'hist' file will display the
1060 output generated by the wget command::
1062 $ wget https://www.kernel.org/pub/linux/kernel/v3.x/patch-3.19.xz
1064 # cat /sys/kernel/debug/tracing/events/net/netif_receive_skb/hist
1065 # trigger info: hist:keys=stacktrace:vals=len:sort=hitcount:size=2048 [paused]
1068 __netif_receive_skb_core+0x46d/0x990
1069 __netif_receive_skb+0x18/0x60
1070 netif_receive_skb_internal+0x23/0x90
1071 napi_gro_receive+0xc8/0x100
1072 ieee80211_deliver_skb+0xd6/0x270 [mac80211]
1073 ieee80211_rx_handlers+0xccf/0x22f0 [mac80211]
1074 ieee80211_prepare_and_rx_handle+0x4e7/0xc40 [mac80211]
1075 ieee80211_rx+0x31d/0x900 [mac80211]
1076 iwlagn_rx_reply_rx+0x3db/0x6f0 [iwldvm]
1077 iwl_rx_dispatch+0x8e/0xf0 [iwldvm]
1078 iwl_pcie_irq_handler+0xe3c/0x12f0 [iwlwifi]
1079 irq_thread_fn+0x20/0x50
1080 irq_thread+0x11f/0x150
1082 ret_from_fork+0x42/0x70
1083 } hitcount: 85 len: 28884
1085 __netif_receive_skb_core+0x46d/0x990
1086 __netif_receive_skb+0x18/0x60
1087 netif_receive_skb_internal+0x23/0x90
1088 napi_gro_complete+0xa4/0xe0
1089 dev_gro_receive+0x23a/0x360
1090 napi_gro_receive+0x30/0x100
1091 ieee80211_deliver_skb+0xd6/0x270 [mac80211]
1092 ieee80211_rx_handlers+0xccf/0x22f0 [mac80211]
1093 ieee80211_prepare_and_rx_handle+0x4e7/0xc40 [mac80211]
1094 ieee80211_rx+0x31d/0x900 [mac80211]
1095 iwlagn_rx_reply_rx+0x3db/0x6f0 [iwldvm]
1096 iwl_rx_dispatch+0x8e/0xf0 [iwldvm]
1097 iwl_pcie_irq_handler+0xe3c/0x12f0 [iwlwifi]
1098 irq_thread_fn+0x20/0x50
1099 irq_thread+0x11f/0x150
1101 } hitcount: 98 len: 664329
1103 __netif_receive_skb_core+0x46d/0x990
1104 __netif_receive_skb+0x18/0x60
1105 process_backlog+0xa8/0x150
1106 net_rx_action+0x15d/0x340
1107 __do_softirq+0x114/0x2c0
1108 do_softirq_own_stack+0x1c/0x30
1109 do_softirq+0x65/0x70
1110 __local_bh_enable_ip+0xb5/0xc0
1111 ip_finish_output+0x1f4/0x840
1113 ip_local_out_sk+0x31/0x40
1114 ip_send_skb+0x1a/0x50
1115 udp_send_skb+0x173/0x2a0
1116 udp_sendmsg+0x2bf/0x9f0
1117 inet_sendmsg+0x64/0xa0
1118 sock_sendmsg+0x3d/0x50
1119 } hitcount: 115 len: 13030
1121 __netif_receive_skb_core+0x46d/0x990
1122 __netif_receive_skb+0x18/0x60
1123 netif_receive_skb_internal+0x23/0x90
1124 napi_gro_complete+0xa4/0xe0
1125 napi_gro_flush+0x6d/0x90
1126 iwl_pcie_irq_handler+0x92a/0x12f0 [iwlwifi]
1127 irq_thread_fn+0x20/0x50
1128 irq_thread+0x11f/0x150
1130 ret_from_fork+0x42/0x70
1131 } hitcount: 934 len: 5512212
1138 The above shows all the netif_receive_skb callpaths and their total
1139 lengths for the duration of the wget command.
1141 The 'clear' hist trigger param can be used to clear the hash table.
1142 Suppose we wanted to try another run of the previous example but
1143 this time also wanted to see the complete list of events that went
1144 into the histogram. In order to avoid having to set everything up
1145 again, we can just clear the histogram first::
1147 # echo 'hist:key=stacktrace:vals=len:clear' >> \
1148 /sys/kernel/debug/tracing/events/net/netif_receive_skb/trigger
1150 Just to verify that it is in fact cleared, here's what we now see in
1153 # cat /sys/kernel/debug/tracing/events/net/netif_receive_skb/hist
1154 # trigger info: hist:keys=stacktrace:vals=len:sort=hitcount:size=2048 [paused]
1161 Since we want to see the detailed list of every netif_receive_skb
1162 event occurring during the new run, which are in fact the same
1163 events being aggregated into the hash table, we add some additional
1164 'enable_event' events to the triggering sched_process_exec and
1165 sched_process_exit events as such::
1167 # echo 'enable_event:net:netif_receive_skb if filename==/usr/bin/wget' > \
1168 /sys/kernel/debug/tracing/events/sched/sched_process_exec/trigger
1170 # echo 'disable_event:net:netif_receive_skb if comm==wget' > \
1171 /sys/kernel/debug/tracing/events/sched/sched_process_exit/trigger
1173 If you read the trigger files for the sched_process_exec and
1174 sched_process_exit triggers, you should see two triggers for each:
1175 one enabling/disabling the hist aggregation and the other
1176 enabling/disabling the logging of events::
1178 # cat /sys/kernel/debug/tracing/events/sched/sched_process_exec/trigger
1179 enable_event:net:netif_receive_skb:unlimited if filename==/usr/bin/wget
1180 enable_hist:net:netif_receive_skb:unlimited if filename==/usr/bin/wget
1182 # cat /sys/kernel/debug/tracing/events/sched/sched_process_exit/trigger
1183 enable_event:net:netif_receive_skb:unlimited if comm==wget
1184 disable_hist:net:netif_receive_skb:unlimited if comm==wget
1186 In other words, whenever either of the sched_process_exec or
1187 sched_process_exit events is hit and matches 'wget', it enables or
1188 disables both the histogram and the event log, and what you end up
1189 with is a hash table and set of events just covering the specified
1190 duration. Run the wget command again::
1192 $ wget https://www.kernel.org/pub/linux/kernel/v3.x/patch-3.19.xz
1194 Displaying the 'hist' file should show something similar to what you
1195 saw in the last run, but this time you should also see the
1196 individual events in the trace file::
1198 # cat /sys/kernel/debug/tracing/trace
1202 # entries-in-buffer/entries-written: 183/1426 #P:4
1205 # / _----=> need-resched
1206 # | / _---=> hardirq/softirq
1207 # || / _--=> preempt-depth
1209 # TASK-PID CPU# |||| TIMESTAMP FUNCTION
1211 wget-15108 [000] ..s1 31769.606929: netif_receive_skb: dev=lo skbaddr=ffff88009c353100 len=60
1212 wget-15108 [000] ..s1 31769.606999: netif_receive_skb: dev=lo skbaddr=ffff88009c353200 len=60
1213 dnsmasq-1382 [000] ..s1 31769.677652: netif_receive_skb: dev=lo skbaddr=ffff88009c352b00 len=130
1214 dnsmasq-1382 [000] ..s1 31769.685917: netif_receive_skb: dev=lo skbaddr=ffff88009c352200 len=138
1215 ##### CPU 2 buffer started ####
1216 irq/29-iwlwifi-559 [002] ..s. 31772.031529: netif_receive_skb: dev=wlan0 skbaddr=ffff88009d433d00 len=2948
1217 irq/29-iwlwifi-559 [002] ..s. 31772.031572: netif_receive_skb: dev=wlan0 skbaddr=ffff88009d432200 len=1500
1218 irq/29-iwlwifi-559 [002] ..s. 31772.032196: netif_receive_skb: dev=wlan0 skbaddr=ffff88009d433100 len=2948
1219 irq/29-iwlwifi-559 [002] ..s. 31772.032761: netif_receive_skb: dev=wlan0 skbaddr=ffff88009d433000 len=2948
1220 irq/29-iwlwifi-559 [002] ..s. 31772.033220: netif_receive_skb: dev=wlan0 skbaddr=ffff88009d432e00 len=1500
1225 The following example demonstrates how multiple hist triggers can be
1226 attached to a given event. This capability can be useful for
1227 creating a set of different summaries derived from the same set of
1228 events, or for comparing the effects of different filters, among
1231 # echo 'hist:keys=skbaddr.hex:vals=len if len < 0' >> \
1232 /sys/kernel/debug/tracing/events/net/netif_receive_skb/trigger
1233 # echo 'hist:keys=skbaddr.hex:vals=len if len > 4096' >> \
1234 /sys/kernel/debug/tracing/events/net/netif_receive_skb/trigger
1235 # echo 'hist:keys=skbaddr.hex:vals=len if len == 256' >> \
1236 /sys/kernel/debug/tracing/events/net/netif_receive_skb/trigger
1237 # echo 'hist:keys=skbaddr.hex:vals=len' >> \
1238 /sys/kernel/debug/tracing/events/net/netif_receive_skb/trigger
1239 # echo 'hist:keys=len:vals=common_preempt_count' >> \
1240 /sys/kernel/debug/tracing/events/net/netif_receive_skb/trigger
1242 The above set of commands create four triggers differing only in
1243 their filters, along with a completely different though fairly
1244 nonsensical trigger. Note that in order to append multiple hist
1245 triggers to the same file, you should use the '>>' operator to
1246 append them ('>' will also add the new hist trigger, but will remove
1247 any existing hist triggers beforehand).
1249 Displaying the contents of the 'hist' file for the event shows the
1250 contents of all five histograms::
1252 # cat /sys/kernel/debug/tracing/events/net/netif_receive_skb/hist
1256 # trigger info: hist:keys=len:vals=hitcount,common_preempt_count:sort=hitcount:size=2048 [active]
1259 { len: 176 } hitcount: 1 common_preempt_count: 0
1260 { len: 223 } hitcount: 1 common_preempt_count: 0
1261 { len: 4854 } hitcount: 1 common_preempt_count: 0
1262 { len: 395 } hitcount: 1 common_preempt_count: 0
1263 { len: 177 } hitcount: 1 common_preempt_count: 0
1264 { len: 446 } hitcount: 1 common_preempt_count: 0
1265 { len: 1601 } hitcount: 1 common_preempt_count: 0
1269 { len: 1280 } hitcount: 66 common_preempt_count: 0
1270 { len: 116 } hitcount: 81 common_preempt_count: 40
1271 { len: 708 } hitcount: 112 common_preempt_count: 0
1272 { len: 46 } hitcount: 221 common_preempt_count: 0
1273 { len: 1264 } hitcount: 458 common_preempt_count: 0
1283 # trigger info: hist:keys=skbaddr.hex:vals=hitcount,len:sort=hitcount:size=2048 [active]
1286 { skbaddr: ffff8800baee5e00 } hitcount: 1 len: 130
1287 { skbaddr: ffff88005f3d5600 } hitcount: 1 len: 1280
1288 { skbaddr: ffff88005f3d4900 } hitcount: 1 len: 1280
1289 { skbaddr: ffff88009fed6300 } hitcount: 1 len: 115
1290 { skbaddr: ffff88009fe0ad00 } hitcount: 1 len: 115
1291 { skbaddr: ffff88008cdb1900 } hitcount: 1 len: 46
1292 { skbaddr: ffff880064b5ef00 } hitcount: 1 len: 118
1293 { skbaddr: ffff880044e3c700 } hitcount: 1 len: 60
1294 { skbaddr: ffff880100065900 } hitcount: 1 len: 46
1295 { skbaddr: ffff8800d46bd500 } hitcount: 1 len: 116
1296 { skbaddr: ffff88005f3d5f00 } hitcount: 1 len: 1280
1297 { skbaddr: ffff880100064700 } hitcount: 1 len: 365
1298 { skbaddr: ffff8800badb6f00 } hitcount: 1 len: 60
1302 { skbaddr: ffff88009fe0be00 } hitcount: 27 len: 24677
1303 { skbaddr: ffff88009fe0a400 } hitcount: 27 len: 23052
1304 { skbaddr: ffff88009fe0b700 } hitcount: 31 len: 25589
1305 { skbaddr: ffff88009fe0b600 } hitcount: 32 len: 27326
1306 { skbaddr: ffff88006a462800 } hitcount: 68 len: 71678
1307 { skbaddr: ffff88006a463700 } hitcount: 70 len: 72678
1308 { skbaddr: ffff88006a462b00 } hitcount: 71 len: 77589
1309 { skbaddr: ffff88006a463600 } hitcount: 73 len: 71307
1310 { skbaddr: ffff88006a462200 } hitcount: 81 len: 81032
1320 # trigger info: hist:keys=skbaddr.hex:vals=hitcount,len:sort=hitcount:size=2048 if len == 256 [active]
1332 # trigger info: hist:keys=skbaddr.hex:vals=hitcount,len:sort=hitcount:size=2048 if len > 4096 [active]
1335 { skbaddr: ffff88009fd2c300 } hitcount: 1 len: 7212
1336 { skbaddr: ffff8800d2bcce00 } hitcount: 1 len: 7212
1337 { skbaddr: ffff8800d2bcd700 } hitcount: 1 len: 7212
1338 { skbaddr: ffff8800d2bcda00 } hitcount: 1 len: 21492
1339 { skbaddr: ffff8800ae2e2d00 } hitcount: 1 len: 7212
1340 { skbaddr: ffff8800d2bcdb00 } hitcount: 1 len: 7212
1341 { skbaddr: ffff88006a4df500 } hitcount: 1 len: 4854
1342 { skbaddr: ffff88008ce47b00 } hitcount: 1 len: 18636
1343 { skbaddr: ffff8800ae2e2200 } hitcount: 1 len: 12924
1344 { skbaddr: ffff88005f3e1000 } hitcount: 1 len: 4356
1345 { skbaddr: ffff8800d2bcdc00 } hitcount: 2 len: 24420
1346 { skbaddr: ffff8800d2bcc200 } hitcount: 2 len: 12996
1356 # trigger info: hist:keys=skbaddr.hex:vals=hitcount,len:sort=hitcount:size=2048 if len < 0 [active]
1365 Named triggers can be used to have triggers share a common set of
1366 histogram data. This capability is mostly useful for combining the
1367 output of events generated by tracepoints contained inside inline
1368 functions, but names can be used in a hist trigger on any event.
1369 For example, these two triggers when hit will update the same 'len'
1370 field in the shared 'foo' histogram data::
1372 # echo 'hist:name=foo:keys=skbaddr.hex:vals=len' > \
1373 /sys/kernel/debug/tracing/events/net/netif_receive_skb/trigger
1374 # echo 'hist:name=foo:keys=skbaddr.hex:vals=len' > \
1375 /sys/kernel/debug/tracing/events/net/netif_rx/trigger
1377 You can see that they're updating common histogram data by reading
1378 each event's hist files at the same time::
1380 # cat /sys/kernel/debug/tracing/events/net/netif_receive_skb/hist;
1381 cat /sys/kernel/debug/tracing/events/net/netif_rx/hist
1385 # trigger info: hist:name=foo:keys=skbaddr.hex:vals=hitcount,len:sort=hitcount:size=2048 [active]
1388 { skbaddr: ffff88000ad53500 } hitcount: 1 len: 46
1389 { skbaddr: ffff8800af5a1500 } hitcount: 1 len: 76
1390 { skbaddr: ffff8800d62a1900 } hitcount: 1 len: 46
1391 { skbaddr: ffff8800d2bccb00 } hitcount: 1 len: 468
1392 { skbaddr: ffff8800d3c69900 } hitcount: 1 len: 46
1393 { skbaddr: ffff88009ff09100 } hitcount: 1 len: 52
1394 { skbaddr: ffff88010f13ab00 } hitcount: 1 len: 168
1395 { skbaddr: ffff88006a54f400 } hitcount: 1 len: 46
1396 { skbaddr: ffff8800d2bcc500 } hitcount: 1 len: 260
1397 { skbaddr: ffff880064505000 } hitcount: 1 len: 46
1398 { skbaddr: ffff8800baf24e00 } hitcount: 1 len: 32
1399 { skbaddr: ffff88009fe0ad00 } hitcount: 1 len: 46
1400 { skbaddr: ffff8800d3edff00 } hitcount: 1 len: 44
1401 { skbaddr: ffff88009fe0b400 } hitcount: 1 len: 168
1402 { skbaddr: ffff8800a1c55a00 } hitcount: 1 len: 40
1403 { skbaddr: ffff8800d2bcd100 } hitcount: 1 len: 40
1404 { skbaddr: ffff880064505f00 } hitcount: 1 len: 174
1405 { skbaddr: ffff8800a8bff200 } hitcount: 1 len: 160
1406 { skbaddr: ffff880044e3cc00 } hitcount: 1 len: 76
1407 { skbaddr: ffff8800a8bfe700 } hitcount: 1 len: 46
1408 { skbaddr: ffff8800d2bcdc00 } hitcount: 1 len: 32
1409 { skbaddr: ffff8800a1f64800 } hitcount: 1 len: 46
1410 { skbaddr: ffff8800d2bcde00 } hitcount: 1 len: 988
1411 { skbaddr: ffff88006a5dea00 } hitcount: 1 len: 46
1412 { skbaddr: ffff88002e37a200 } hitcount: 1 len: 44
1413 { skbaddr: ffff8800a1f32c00 } hitcount: 2 len: 676
1414 { skbaddr: ffff88000ad52600 } hitcount: 2 len: 107
1415 { skbaddr: ffff8800a1f91e00 } hitcount: 2 len: 92
1416 { skbaddr: ffff8800af5a0200 } hitcount: 2 len: 142
1417 { skbaddr: ffff8800d2bcc600 } hitcount: 2 len: 220
1418 { skbaddr: ffff8800ba36f500 } hitcount: 2 len: 92
1419 { skbaddr: ffff8800d021f800 } hitcount: 2 len: 92
1420 { skbaddr: ffff8800a1f33600 } hitcount: 2 len: 675
1421 { skbaddr: ffff8800a8bfff00 } hitcount: 3 len: 138
1422 { skbaddr: ffff8800d62a1300 } hitcount: 3 len: 138
1423 { skbaddr: ffff88002e37a100 } hitcount: 4 len: 184
1424 { skbaddr: ffff880064504400 } hitcount: 4 len: 184
1425 { skbaddr: ffff8800a8bfec00 } hitcount: 4 len: 184
1426 { skbaddr: ffff88000ad53700 } hitcount: 5 len: 230
1427 { skbaddr: ffff8800d2bcdb00 } hitcount: 5 len: 196
1428 { skbaddr: ffff8800a1f90000 } hitcount: 6 len: 276
1429 { skbaddr: ffff88006a54f900 } hitcount: 6 len: 276
1437 # trigger info: hist:name=foo:keys=skbaddr.hex:vals=hitcount,len:sort=hitcount:size=2048 [active]
1440 { skbaddr: ffff88000ad53500 } hitcount: 1 len: 46
1441 { skbaddr: ffff8800af5a1500 } hitcount: 1 len: 76
1442 { skbaddr: ffff8800d62a1900 } hitcount: 1 len: 46
1443 { skbaddr: ffff8800d2bccb00 } hitcount: 1 len: 468
1444 { skbaddr: ffff8800d3c69900 } hitcount: 1 len: 46
1445 { skbaddr: ffff88009ff09100 } hitcount: 1 len: 52
1446 { skbaddr: ffff88010f13ab00 } hitcount: 1 len: 168
1447 { skbaddr: ffff88006a54f400 } hitcount: 1 len: 46
1448 { skbaddr: ffff8800d2bcc500 } hitcount: 1 len: 260
1449 { skbaddr: ffff880064505000 } hitcount: 1 len: 46
1450 { skbaddr: ffff8800baf24e00 } hitcount: 1 len: 32
1451 { skbaddr: ffff88009fe0ad00 } hitcount: 1 len: 46
1452 { skbaddr: ffff8800d3edff00 } hitcount: 1 len: 44
1453 { skbaddr: ffff88009fe0b400 } hitcount: 1 len: 168
1454 { skbaddr: ffff8800a1c55a00 } hitcount: 1 len: 40
1455 { skbaddr: ffff8800d2bcd100 } hitcount: 1 len: 40
1456 { skbaddr: ffff880064505f00 } hitcount: 1 len: 174
1457 { skbaddr: ffff8800a8bff200 } hitcount: 1 len: 160
1458 { skbaddr: ffff880044e3cc00 } hitcount: 1 len: 76
1459 { skbaddr: ffff8800a8bfe700 } hitcount: 1 len: 46
1460 { skbaddr: ffff8800d2bcdc00 } hitcount: 1 len: 32
1461 { skbaddr: ffff8800a1f64800 } hitcount: 1 len: 46
1462 { skbaddr: ffff8800d2bcde00 } hitcount: 1 len: 988
1463 { skbaddr: ffff88006a5dea00 } hitcount: 1 len: 46
1464 { skbaddr: ffff88002e37a200 } hitcount: 1 len: 44
1465 { skbaddr: ffff8800a1f32c00 } hitcount: 2 len: 676
1466 { skbaddr: ffff88000ad52600 } hitcount: 2 len: 107
1467 { skbaddr: ffff8800a1f91e00 } hitcount: 2 len: 92
1468 { skbaddr: ffff8800af5a0200 } hitcount: 2 len: 142
1469 { skbaddr: ffff8800d2bcc600 } hitcount: 2 len: 220
1470 { skbaddr: ffff8800ba36f500 } hitcount: 2 len: 92
1471 { skbaddr: ffff8800d021f800 } hitcount: 2 len: 92
1472 { skbaddr: ffff8800a1f33600 } hitcount: 2 len: 675
1473 { skbaddr: ffff8800a8bfff00 } hitcount: 3 len: 138
1474 { skbaddr: ffff8800d62a1300 } hitcount: 3 len: 138
1475 { skbaddr: ffff88002e37a100 } hitcount: 4 len: 184
1476 { skbaddr: ffff880064504400 } hitcount: 4 len: 184
1477 { skbaddr: ffff8800a8bfec00 } hitcount: 4 len: 184
1478 { skbaddr: ffff88000ad53700 } hitcount: 5 len: 230
1479 { skbaddr: ffff8800d2bcdb00 } hitcount: 5 len: 196
1480 { skbaddr: ffff8800a1f90000 } hitcount: 6 len: 276
1481 { skbaddr: ffff88006a54f900 } hitcount: 6 len: 276
1488 And here's an example that shows how to combine histogram data from
1489 any two events even if they don't share any 'compatible' fields
1490 other than 'hitcount' and 'stacktrace'. These commands create a
1491 couple of triggers named 'bar' using those fields::
1493 # echo 'hist:name=bar:key=stacktrace:val=hitcount' > \
1494 /sys/kernel/debug/tracing/events/sched/sched_process_fork/trigger
1495 # echo 'hist:name=bar:key=stacktrace:val=hitcount' > \
1496 /sys/kernel/debug/tracing/events/net/netif_rx/trigger
1498 And displaying the output of either shows some interesting if
1499 somewhat confusing output::
1501 # cat /sys/kernel/debug/tracing/events/sched/sched_process_fork/hist
1502 # cat /sys/kernel/debug/tracing/events/net/netif_rx/hist
1506 # trigger info: hist:name=bar:keys=stacktrace:vals=hitcount:sort=hitcount:size=2048 [active]
1510 _do_fork+0x18e/0x330
1511 kernel_thread+0x29/0x30
1512 kthreadd+0x154/0x1b0
1513 ret_from_fork+0x3f/0x70
1516 netif_rx_internal+0xb2/0xd0
1517 netif_rx_ni+0x20/0x70
1518 dev_loopback_xmit+0xaa/0xd0
1519 ip_mc_output+0x126/0x240
1520 ip_local_out_sk+0x31/0x40
1521 igmp_send_report+0x1e9/0x230
1522 igmp_timer_expire+0xe9/0x120
1523 call_timer_fn+0x39/0xf0
1524 run_timer_softirq+0x1e1/0x290
1525 __do_softirq+0xfd/0x290
1527 smp_apic_timer_interrupt+0x4a/0x60
1528 apic_timer_interrupt+0x6d/0x80
1529 cpuidle_enter+0x17/0x20
1530 call_cpuidle+0x3b/0x60
1531 cpu_startup_entry+0x22d/0x310
1534 netif_rx_internal+0xb2/0xd0
1535 netif_rx_ni+0x20/0x70
1536 dev_loopback_xmit+0xaa/0xd0
1537 ip_mc_output+0x17f/0x240
1538 ip_local_out_sk+0x31/0x40
1539 ip_send_skb+0x1a/0x50
1540 udp_send_skb+0x13e/0x270
1541 udp_sendmsg+0x2bf/0x980
1542 inet_sendmsg+0x67/0xa0
1543 sock_sendmsg+0x38/0x50
1544 SYSC_sendto+0xef/0x170
1546 entry_SYSCALL_64_fastpath+0x12/0x6a
1549 netif_rx_internal+0xb2/0xd0
1551 loopback_xmit+0x6c/0xb0
1552 dev_hard_start_xmit+0x219/0x3a0
1553 __dev_queue_xmit+0x415/0x4f0
1554 dev_queue_xmit_sk+0x13/0x20
1555 ip_finish_output2+0x237/0x340
1556 ip_finish_output+0x113/0x1d0
1558 ip_local_out_sk+0x31/0x40
1559 ip_send_skb+0x1a/0x50
1560 udp_send_skb+0x16d/0x270
1561 udp_sendmsg+0x2bf/0x980
1562 inet_sendmsg+0x67/0xa0
1563 sock_sendmsg+0x38/0x50
1564 ___sys_sendmsg+0x14e/0x270
1567 netif_rx_internal+0xb2/0xd0
1569 loopback_xmit+0x6c/0xb0
1570 dev_hard_start_xmit+0x219/0x3a0
1571 __dev_queue_xmit+0x415/0x4f0
1572 dev_queue_xmit_sk+0x13/0x20
1573 ip_finish_output2+0x237/0x340
1574 ip_finish_output+0x113/0x1d0
1576 ip_local_out_sk+0x31/0x40
1577 ip_send_skb+0x1a/0x50
1578 udp_send_skb+0x16d/0x270
1579 udp_sendmsg+0x2bf/0x980
1580 inet_sendmsg+0x67/0xa0
1581 sock_sendmsg+0x38/0x50
1582 ___sys_sendmsg+0x269/0x270
1585 netif_rx_internal+0xb2/0xd0
1587 loopback_xmit+0x6c/0xb0
1588 dev_hard_start_xmit+0x219/0x3a0
1589 __dev_queue_xmit+0x415/0x4f0
1590 dev_queue_xmit_sk+0x13/0x20
1591 ip_finish_output2+0x237/0x340
1592 ip_finish_output+0x113/0x1d0
1594 ip_local_out_sk+0x31/0x40
1595 ip_send_skb+0x1a/0x50
1596 udp_send_skb+0x16d/0x270
1597 udp_sendmsg+0x2bf/0x980
1598 inet_sendmsg+0x67/0xa0
1599 sock_sendmsg+0x38/0x50
1600 SYSC_sendto+0xef/0x170
1603 _do_fork+0x18e/0x330
1605 entry_SYSCALL_64_fastpath+0x12/0x6a
1613 2.2 Inter-event hist triggers
1614 -----------------------------
1616 Inter-event hist triggers are hist triggers that combine values from
1617 one or more other events and create a histogram using that data. Data
1618 from an inter-event histogram can in turn become the source for
1619 further combined histograms, thus providing a chain of related
1620 histograms, which is important for some applications.
1622 The most important example of an inter-event quantity that can be used
1623 in this manner is latency, which is simply a difference in timestamps
1624 between two events. Although latency is the most important
1625 inter-event quantity, note that because the support is completely
1626 general across the trace event subsystem, any event field can be used
1627 in an inter-event quantity.
1629 An example of a histogram that combines data from other histograms
1630 into a useful chain would be a 'wakeupswitch latency' histogram that
1631 combines a 'wakeup latency' histogram and a 'switch latency'
1634 Normally, a hist trigger specification consists of a (possibly
1635 compound) key along with one or more numeric values, which are
1636 continually updated sums associated with that key. A histogram
1637 specification in this case consists of individual key and value
1638 specifications that refer to trace event fields associated with a
1641 The inter-event hist trigger extension allows fields from multiple
1642 events to be referenced and combined into a multi-event histogram
1643 specification. In support of this overall goal, a few enabling
1644 features have been added to the hist trigger support:
1646 - In order to compute an inter-event quantity, a value from one
1647 event needs to saved and then referenced from another event. This
1648 requires the introduction of support for histogram 'variables'.
1650 - The computation of inter-event quantities and their combination
1651 require some minimal amount of support for applying simple
1652 expressions to variables (+ and -).
1654 - A histogram consisting of inter-event quantities isn't logically a
1655 histogram on either event (so having the 'hist' file for either
1656 event host the histogram output doesn't really make sense). To
1657 address the idea that the histogram is associated with a
1658 combination of events, support is added allowing the creation of
1659 'synthetic' events that are events derived from other events.
1660 These synthetic events are full-fledged events just like any other
1661 and can be used as such, as for instance to create the
1662 'combination' histograms mentioned previously.
1664 - A set of 'actions' can be associated with histogram entries -
1665 these can be used to generate the previously mentioned synthetic
1666 events, but can also be used for other purposes, such as for
1667 example saving context when a 'max' latency has been hit.
1669 - Trace events don't have a 'timestamp' associated with them, but
1670 there is an implicit timestamp saved along with an event in the
1671 underlying ftrace ring buffer. This timestamp is now exposed as a
1672 a synthetic field named 'common_timestamp' which can be used in
1673 histograms as if it were any other event field; it isn't an actual
1674 field in the trace format but rather is a synthesized value that
1675 nonetheless can be used as if it were an actual field. By default
1676 it is in units of nanoseconds; appending '.usecs' to a
1677 common_timestamp field changes the units to microseconds.
1679 A note on inter-event timestamps: If common_timestamp is used in a
1680 histogram, the trace buffer is automatically switched over to using
1681 absolute timestamps and the "global" trace clock, in order to avoid
1682 bogus timestamp differences with other clocks that aren't coherent
1683 across CPUs. This can be overridden by specifying one of the other
1684 trace clocks instead, using the "clock=XXX" hist trigger attribute,
1685 where XXX is any of the clocks listed in the tracing/trace_clock
1688 These features are described in more detail in the following sections.
1690 2.2.1 Histogram Variables
1691 -------------------------
1693 Variables are simply named locations used for saving and retrieving
1694 values between matching events. A 'matching' event is defined as an
1695 event that has a matching key - if a variable is saved for a histogram
1696 entry corresponding to that key, any subsequent event with a matching
1697 key can access that variable.
1699 A variable's value is normally available to any subsequent event until
1700 it is set to something else by a subsequent event. The one exception
1701 to that rule is that any variable used in an expression is essentially
1702 'read-once' - once it's used by an expression in a subsequent event,
1703 it's reset to its 'unset' state, which means it can't be used again
1704 unless it's set again. This ensures not only that an event doesn't
1705 use an uninitialized variable in a calculation, but that that variable
1706 is used only once and not for any unrelated subsequent match.
1708 The basic syntax for saving a variable is to simply prefix a unique
1709 variable name not corresponding to any keyword along with an '=' sign
1712 Either keys or values can be saved and retrieved in this way. This
1713 creates a variable named 'ts0' for a histogram entry with the key
1716 # echo 'hist:keys=next_pid:vals=$ts0:ts0=common_timestamp ... >> \
1719 The ts0 variable can be accessed by any subsequent event having the
1720 same pid as 'next_pid'.
1722 Variable references are formed by prepending the variable name with
1723 the '$' sign. Thus for example, the ts0 variable above would be
1724 referenced as '$ts0' in expressions.
1726 Because 'vals=' is used, the common_timestamp variable value above
1727 will also be summed as a normal histogram value would (though for a
1728 timestamp it makes little sense).
1730 The below shows that a key value can also be saved in the same way::
1732 # echo 'hist:timer_pid=common_pid:key=timer_pid ...' >> event/trigger
1734 If a variable isn't a key variable or prefixed with 'vals=', the
1735 associated event field will be saved in a variable but won't be summed
1738 # echo 'hist:keys=next_pid:ts1=common_timestamp ...' >> event/trigger
1740 Multiple variables can be assigned at the same time. The below would
1741 result in both ts0 and b being created as variables, with both
1742 common_timestamp and field1 additionally being summed as values::
1744 # echo 'hist:keys=pid:vals=$ts0,$b:ts0=common_timestamp,b=field1 ...' >> \
1747 Note that variable assignments can appear either preceding or
1748 following their use. The command below behaves identically to the
1751 # echo 'hist:keys=pid:ts0=common_timestamp,b=field1:vals=$ts0,$b ...' >> \
1754 Any number of variables not bound to a 'vals=' prefix can also be
1755 assigned by simply separating them with colons. Below is the same
1756 thing but without the values being summed in the histogram::
1758 # echo 'hist:keys=pid:ts0=common_timestamp:b=field1 ...' >> event/trigger
1760 Variables set as above can be referenced and used in expressions on
1763 For example, here's how a latency can be calculated::
1765 # echo 'hist:keys=pid,prio:ts0=common_timestamp ...' >> event1/trigger
1766 # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp-$ts0 ...' >> event2/trigger
1768 In the first line above, the event's timetamp is saved into the
1769 variable ts0. In the next line, ts0 is subtracted from the second
1770 event's timestamp to produce the latency, which is then assigned into
1771 yet another variable, 'wakeup_lat'. The hist trigger below in turn
1772 makes use of the wakeup_lat variable to compute a combined latency
1773 using the same key and variable from yet another event::
1775 # echo 'hist:key=pid:wakeupswitch_lat=$wakeup_lat+$switchtime_lat ...' >> event3/trigger
1777 2.2.2 Synthetic Events
1778 ----------------------
1780 Synthetic events are user-defined events generated from hist trigger
1781 variables or fields associated with one or more other events. Their
1782 purpose is to provide a mechanism for displaying data spanning
1783 multiple events consistent with the existing and already familiar
1784 usage for normal events.
1786 To define a synthetic event, the user writes a simple specification
1787 consisting of the name of the new event along with one or more
1788 variables and their types, which can be any valid field type,
1789 separated by semicolons, to the tracing/synthetic_events file.
1791 For instance, the following creates a new event named 'wakeup_latency'
1792 with 3 fields: lat, pid, and prio. Each of those fields is simply a
1793 variable reference to a variable on another event::
1795 # echo 'wakeup_latency \
1799 /sys/kernel/debug/tracing/synthetic_events
1801 Reading the tracing/synthetic_events file lists all the currently
1802 defined synthetic events, in this case the event defined above::
1804 # cat /sys/kernel/debug/tracing/synthetic_events
1805 wakeup_latency u64 lat; pid_t pid; int prio
1807 An existing synthetic event definition can be removed by prepending
1808 the command that defined it with a '!'::
1810 # echo '!wakeup_latency u64 lat pid_t pid int prio' >> \
1811 /sys/kernel/debug/tracing/synthetic_events
1813 At this point, there isn't yet an actual 'wakeup_latency' event
1814 instantiated in the event subsytem - for this to happen, a 'hist
1815 trigger action' needs to be instantiated and bound to actual fields
1816 and variables defined on other events (see Section 2.2.3 below on
1817 how that is done using hist trigger 'onmatch' action). Once that is
1818 done, the 'wakeup_latency' synthetic event instance is created.
1820 A histogram can now be defined for the new synthetic event::
1822 # echo 'hist:keys=pid,prio,lat.log2:sort=pid,lat' >> \
1823 /sys/kernel/debug/tracing/events/synthetic/wakeup_latency/trigger
1825 The new event is created under the tracing/events/synthetic/ directory
1826 and looks and behaves just like any other event::
1828 # ls /sys/kernel/debug/tracing/events/synthetic/wakeup_latency
1829 enable filter format hist id trigger
1831 Like any other event, once a histogram is enabled for the event, the
1832 output can be displayed by reading the event's 'hist' file.
1834 2.2.3 Hist trigger 'actions'
1835 ----------------------------
1837 A hist trigger 'action' is a function that's executed whenever a
1838 histogram entry is added or updated.
1840 The default 'action' if no special function is explicity specified is
1841 as it always has been, to simply update the set of values associated
1842 with an entry. Some applications, however, may want to perform
1843 additional actions at that point, such as generate another event, or
1844 compare and save a maximum.
1846 The following additional actions are available. To specify an action
1847 for a given event, simply specify the action between colons in the
1848 hist trigger specification.
1850 - onmatch(matching.event).<synthetic_event_name>(param list)
1852 The 'onmatch(matching.event).<synthetic_event_name>(params)' hist
1853 trigger action is invoked whenever an event matches and the
1854 histogram entry would be added or updated. It causes the named
1855 synthetic event to be generated with the values given in the
1856 'param list'. The result is the generation of a synthetic event
1857 that consists of the values contained in those variables at the
1858 time the invoking event was hit.
1860 The 'param list' consists of one or more parameters which may be
1861 either variables or fields defined on either the 'matching.event'
1862 or the target event. The variables or fields specified in the
1863 param list may be either fully-qualified or unqualified. If a
1864 variable is specified as unqualified, it must be unique between
1865 the two events. A field name used as a param can be unqualified
1866 if it refers to the target event, but must be fully qualified if
1867 it refers to the matching event. A fully-qualified name is of the
1868 form 'system.event_name.$var_name' or 'system.event_name.field'.
1870 The 'matching.event' specification is simply the fully qualified
1871 event name of the event that matches the target event for the
1872 onmatch() functionality, in the form 'system.event_name'.
1874 Finally, the number and type of variables/fields in the 'param
1875 list' must match the number and types of the fields in the
1876 synthetic event being generated.
1878 As an example the below defines a simple synthetic event and uses
1879 a variable defined on the sched_wakeup_new event as a parameter
1880 when invoking the synthetic event. Here we define the synthetic
1883 # echo 'wakeup_new_test pid_t pid' >> \
1884 /sys/kernel/debug/tracing/synthetic_events
1886 # cat /sys/kernel/debug/tracing/synthetic_events
1887 wakeup_new_test pid_t pid
1889 The following hist trigger both defines the missing testpid
1890 variable and specifies an onmatch() action that generates a
1891 wakeup_new_test synthetic event whenever a sched_wakeup_new event
1892 occurs, which because of the 'if comm == "cyclictest"' filter only
1893 happens when the executable is cyclictest::
1895 # echo 'hist:keys=$testpid:testpid=pid:onmatch(sched.sched_wakeup_new).\
1896 wakeup_new_test($testpid) if comm=="cyclictest"' >> \
1897 /sys/kernel/debug/tracing/events/sched/sched_wakeup_new/trigger
1899 Creating and displaying a histogram based on those events is now
1900 just a matter of using the fields and new synthetic event in the
1901 tracing/events/synthetic directory, as usual::
1903 # echo 'hist:keys=pid:sort=pid' >> \
1904 /sys/kernel/debug/tracing/events/synthetic/wakeup_new_test/trigger
1906 Running 'cyclictest' should cause wakeup_new events to generate
1907 wakeup_new_test synthetic events which should result in histogram
1908 output in the wakeup_new_test event's hist file::
1910 # cat /sys/kernel/debug/tracing/events/synthetic/wakeup_new_test/hist
1912 A more typical usage would be to use two events to calculate a
1913 latency. The following example uses a set of hist triggers to
1914 produce a 'wakeup_latency' histogram.
1916 First, we define a 'wakeup_latency' synthetic event::
1918 # echo 'wakeup_latency u64 lat; pid_t pid; int prio' >> \
1919 /sys/kernel/debug/tracing/synthetic_events
1921 Next, we specify that whenever we see a sched_waking event for a
1922 cyclictest thread, save the timestamp in a 'ts0' variable::
1924 # echo 'hist:keys=$saved_pid:saved_pid=pid:ts0=common_timestamp.usecs \
1925 if comm=="cyclictest"' >> \
1926 /sys/kernel/debug/tracing/events/sched/sched_waking/trigger
1928 Then, when the corresponding thread is actually scheduled onto the
1929 CPU by a sched_switch event, calculate the latency and use that
1930 along with another variable and an event field to generate a
1931 wakeup_latency synthetic event::
1933 # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:\
1934 onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,\
1935 $saved_pid,next_prio) if next_comm=="cyclictest"' >> \
1936 /sys/kernel/debug/tracing/events/sched/sched_switch/trigger
1938 We also need to create a histogram on the wakeup_latency synthetic
1939 event in order to aggregate the generated synthetic event data::
1941 # echo 'hist:keys=pid,prio,lat:sort=pid,lat' >> \
1942 /sys/kernel/debug/tracing/events/synthetic/wakeup_latency/trigger
1944 Finally, once we've run cyclictest to actually generate some
1945 events, we can see the output by looking at the wakeup_latency
1946 synthetic event's hist file::
1948 # cat /sys/kernel/debug/tracing/events/synthetic/wakeup_latency/hist
1950 - onmax(var).save(field,.. .)
1952 The 'onmax(var).save(field,...)' hist trigger action is invoked
1953 whenever the value of 'var' associated with a histogram entry
1954 exceeds the current maximum contained in that variable.
1956 The end result is that the trace event fields specified as the
1957 onmax.save() params will be saved if 'var' exceeds the current
1958 maximum for that hist trigger entry. This allows context from the
1959 event that exhibited the new maximum to be saved for later
1960 reference. When the histogram is displayed, additional fields
1961 displaying the saved values will be printed.
1963 As an example the below defines a couple of hist triggers, one for
1964 sched_waking and another for sched_switch, keyed on pid. Whenever
1965 a sched_waking occurs, the timestamp is saved in the entry
1966 corresponding to the current pid, and when the scheduler switches
1967 back to that pid, the timestamp difference is calculated. If the
1968 resulting latency, stored in wakeup_lat, exceeds the current
1969 maximum latency, the values specified in the save() fields are
1972 # echo 'hist:keys=pid:ts0=common_timestamp.usecs \
1973 if comm=="cyclictest"' >> \
1974 /sys/kernel/debug/tracing/events/sched/sched_waking/trigger
1976 # echo 'hist:keys=next_pid:\
1977 wakeup_lat=common_timestamp.usecs-$ts0:\
1978 onmax($wakeup_lat).save(next_comm,prev_pid,prev_prio,prev_comm) \
1979 if next_comm=="cyclictest"' >> \
1980 /sys/kernel/debug/tracing/events/sched/sched_switch/trigger
1982 When the histogram is displayed, the max value and the saved
1983 values corresponding to the max are displayed following the rest
1986 # cat /sys/kernel/debug/tracing/events/sched/sched_switch/hist
1987 { next_pid: 2255 } hitcount: 239
1988 common_timestamp-ts0: 0
1990 next_comm: cyclictest
1991 prev_pid: 0 prev_prio: 120 prev_comm: swapper/1
1993 { next_pid: 2256 } hitcount: 2355
1994 common_timestamp-ts0: 0
1995 max: 49 next_comm: cyclictest
1996 prev_pid: 0 prev_prio: 120 prev_comm: swapper/0
2003 3. User space creating a trigger
2004 --------------------------------
2006 Writing into /sys/kernel/tracing/trace_marker writes into the ftrace
2007 ring buffer. This can also act like an event, by writing into the trigger
2008 file located in /sys/kernel/tracing/events/ftrace/print/
2010 Modifying cyclictest to write into the trace_marker file before it sleeps
2011 and after it wakes up, something like this::
2013 static void traceputs(char *str)
2015 /* tracemark_fd is the trace_marker file descriptor */
2016 if (tracemark_fd < 0)
2018 /* write the tracemark message */
2019 write(tracemark_fd, str, strlen(str));
2022 And later add something like::
2025 clock_nanosleep(...);
2028 We can make a histogram from this::
2030 # cd /sys/kernel/tracing
2031 # echo 'latency u64 lat' > synthetic_events
2032 # echo 'hist:keys=common_pid:ts0=common_timestamp.usecs if buf == "start"' > events/ftrace/print/trigger
2033 # echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"' >> events/ftrace/print/trigger
2034 # echo 'hist:keys=lat,common_pid:sort=lat' > events/synthetic/latency/trigger
2036 The above created a synthetic event called "latency" and two histograms
2037 against the trace_marker, one gets triggered when "start" is written into the
2038 trace_marker file and the other when "end" is written. If the pids match, then
2039 it will call the "latency" synthetic event with the calculated latency as its
2040 parameter. Finally, a histogram is added to the latency synthetic event to
2041 record the calculated latency along with the pid.
2043 Now running cyclictest with::
2045 # ./cyclictest -p80 -d0 -i250 -n -a -t --tracemark -b 1000
2047 -p80 : run threads at priority 80
2048 -d0 : have all threads run at the same interval
2049 -i250 : start the interval at 250 microseconds (all threads will do this)
2050 -n : sleep with nanosleep
2051 -a : affine all threads to a separate CPU
2052 -t : one thread per available CPU
2053 --tracemark : enable trace mark writing
2054 -b 1000 : stop if any latency is greater than 1000 microseconds
2056 Note, the -b 1000 is used just to make --tracemark available.
2058 Then we can see the histogram created by this with::
2060 # cat events/synthetic/latency/hist
2063 # trigger info: hist:keys=lat,common_pid:vals=hitcount:sort=lat:size=2048 [active]
2066 { lat: 107, common_pid: 2039 } hitcount: 1
2067 { lat: 122, common_pid: 2041 } hitcount: 1
2068 { lat: 166, common_pid: 2039 } hitcount: 1
2069 { lat: 174, common_pid: 2039 } hitcount: 1
2070 { lat: 194, common_pid: 2041 } hitcount: 1
2071 { lat: 196, common_pid: 2036 } hitcount: 1
2072 { lat: 197, common_pid: 2038 } hitcount: 1
2073 { lat: 198, common_pid: 2039 } hitcount: 1
2074 { lat: 199, common_pid: 2039 } hitcount: 1
2075 { lat: 200, common_pid: 2041 } hitcount: 1
2076 { lat: 201, common_pid: 2039 } hitcount: 2
2077 { lat: 202, common_pid: 2038 } hitcount: 1
2078 { lat: 202, common_pid: 2043 } hitcount: 1
2079 { lat: 203, common_pid: 2039 } hitcount: 1
2080 { lat: 203, common_pid: 2036 } hitcount: 1
2081 { lat: 203, common_pid: 2041 } hitcount: 1
2082 { lat: 206, common_pid: 2038 } hitcount: 2
2083 { lat: 207, common_pid: 2039 } hitcount: 1
2084 { lat: 207, common_pid: 2036 } hitcount: 1
2085 { lat: 208, common_pid: 2040 } hitcount: 1
2086 { lat: 209, common_pid: 2043 } hitcount: 1
2087 { lat: 210, common_pid: 2039 } hitcount: 1
2088 { lat: 211, common_pid: 2039 } hitcount: 4
2089 { lat: 212, common_pid: 2043 } hitcount: 1
2090 { lat: 212, common_pid: 2039 } hitcount: 2
2091 { lat: 213, common_pid: 2039 } hitcount: 1
2092 { lat: 214, common_pid: 2038 } hitcount: 1
2093 { lat: 214, common_pid: 2039 } hitcount: 2
2094 { lat: 214, common_pid: 2042 } hitcount: 1
2095 { lat: 215, common_pid: 2039 } hitcount: 1
2096 { lat: 217, common_pid: 2036 } hitcount: 1
2097 { lat: 217, common_pid: 2040 } hitcount: 1
2098 { lat: 217, common_pid: 2039 } hitcount: 1
2099 { lat: 218, common_pid: 2039 } hitcount: 6
2100 { lat: 219, common_pid: 2039 } hitcount: 9
2101 { lat: 220, common_pid: 2039 } hitcount: 11
2102 { lat: 221, common_pid: 2039 } hitcount: 5
2103 { lat: 221, common_pid: 2042 } hitcount: 1
2104 { lat: 222, common_pid: 2039 } hitcount: 7
2105 { lat: 223, common_pid: 2036 } hitcount: 1
2106 { lat: 223, common_pid: 2039 } hitcount: 3
2107 { lat: 224, common_pid: 2039 } hitcount: 4
2108 { lat: 224, common_pid: 2037 } hitcount: 1
2109 { lat: 224, common_pid: 2036 } hitcount: 2
2110 { lat: 225, common_pid: 2039 } hitcount: 5
2111 { lat: 225, common_pid: 2042 } hitcount: 1
2112 { lat: 226, common_pid: 2039 } hitcount: 7
2113 { lat: 226, common_pid: 2036 } hitcount: 4
2114 { lat: 227, common_pid: 2039 } hitcount: 6
2115 { lat: 227, common_pid: 2036 } hitcount: 12
2116 { lat: 227, common_pid: 2043 } hitcount: 1
2117 { lat: 228, common_pid: 2039 } hitcount: 7
2118 { lat: 228, common_pid: 2036 } hitcount: 14
2119 { lat: 229, common_pid: 2039 } hitcount: 9
2120 { lat: 229, common_pid: 2036 } hitcount: 8
2121 { lat: 229, common_pid: 2038 } hitcount: 1
2122 { lat: 230, common_pid: 2039 } hitcount: 11
2123 { lat: 230, common_pid: 2036 } hitcount: 6
2124 { lat: 230, common_pid: 2043 } hitcount: 1
2125 { lat: 230, common_pid: 2042 } hitcount: 2
2126 { lat: 231, common_pid: 2041 } hitcount: 1
2127 { lat: 231, common_pid: 2036 } hitcount: 6
2128 { lat: 231, common_pid: 2043 } hitcount: 1
2129 { lat: 231, common_pid: 2039 } hitcount: 8
2130 { lat: 232, common_pid: 2037 } hitcount: 1
2131 { lat: 232, common_pid: 2039 } hitcount: 6
2132 { lat: 232, common_pid: 2040 } hitcount: 2
2133 { lat: 232, common_pid: 2036 } hitcount: 5
2134 { lat: 232, common_pid: 2043 } hitcount: 1
2135 { lat: 233, common_pid: 2036 } hitcount: 5
2136 { lat: 233, common_pid: 2039 } hitcount: 11
2137 { lat: 234, common_pid: 2039 } hitcount: 4
2138 { lat: 234, common_pid: 2038 } hitcount: 2
2139 { lat: 234, common_pid: 2043 } hitcount: 2
2140 { lat: 234, common_pid: 2036 } hitcount: 11
2141 { lat: 234, common_pid: 2040 } hitcount: 1
2142 { lat: 235, common_pid: 2037 } hitcount: 2
2143 { lat: 235, common_pid: 2036 } hitcount: 8
2144 { lat: 235, common_pid: 2043 } hitcount: 2
2145 { lat: 235, common_pid: 2039 } hitcount: 5
2146 { lat: 235, common_pid: 2042 } hitcount: 2
2147 { lat: 235, common_pid: 2040 } hitcount: 4
2148 { lat: 235, common_pid: 2041 } hitcount: 1
2149 { lat: 236, common_pid: 2036 } hitcount: 7
2150 { lat: 236, common_pid: 2037 } hitcount: 1
2151 { lat: 236, common_pid: 2041 } hitcount: 5
2152 { lat: 236, common_pid: 2039 } hitcount: 3
2153 { lat: 236, common_pid: 2043 } hitcount: 9
2154 { lat: 236, common_pid: 2040 } hitcount: 7
2155 { lat: 237, common_pid: 2037 } hitcount: 1
2156 { lat: 237, common_pid: 2040 } hitcount: 1
2157 { lat: 237, common_pid: 2036 } hitcount: 9
2158 { lat: 237, common_pid: 2039 } hitcount: 3
2159 { lat: 237, common_pid: 2043 } hitcount: 8
2160 { lat: 237, common_pid: 2042 } hitcount: 2
2161 { lat: 237, common_pid: 2041 } hitcount: 2
2162 { lat: 238, common_pid: 2043 } hitcount: 10
2163 { lat: 238, common_pid: 2040 } hitcount: 1
2164 { lat: 238, common_pid: 2037 } hitcount: 9
2165 { lat: 238, common_pid: 2038 } hitcount: 1
2166 { lat: 238, common_pid: 2039 } hitcount: 1
2167 { lat: 238, common_pid: 2042 } hitcount: 3
2168 { lat: 238, common_pid: 2036 } hitcount: 7
2169 { lat: 239, common_pid: 2041 } hitcount: 1
2170 { lat: 239, common_pid: 2043 } hitcount: 11
2171 { lat: 239, common_pid: 2037 } hitcount: 11
2172 { lat: 239, common_pid: 2038 } hitcount: 6
2173 { lat: 239, common_pid: 2036 } hitcount: 7
2174 { lat: 239, common_pid: 2040 } hitcount: 1
2175 { lat: 239, common_pid: 2042 } hitcount: 9
2176 { lat: 240, common_pid: 2037 } hitcount: 29
2177 { lat: 240, common_pid: 2043 } hitcount: 15
2178 { lat: 240, common_pid: 2040 } hitcount: 44
2179 { lat: 240, common_pid: 2039 } hitcount: 1
2180 { lat: 240, common_pid: 2041 } hitcount: 2
2181 { lat: 240, common_pid: 2038 } hitcount: 1
2182 { lat: 240, common_pid: 2036 } hitcount: 10
2183 { lat: 240, common_pid: 2042 } hitcount: 13
2184 { lat: 241, common_pid: 2036 } hitcount: 21
2185 { lat: 241, common_pid: 2041 } hitcount: 36
2186 { lat: 241, common_pid: 2037 } hitcount: 34
2187 { lat: 241, common_pid: 2042 } hitcount: 14
2188 { lat: 241, common_pid: 2040 } hitcount: 94
2189 { lat: 241, common_pid: 2039 } hitcount: 12
2190 { lat: 241, common_pid: 2038 } hitcount: 2
2191 { lat: 241, common_pid: 2043 } hitcount: 28
2192 { lat: 242, common_pid: 2040 } hitcount: 109
2193 { lat: 242, common_pid: 2041 } hitcount: 506
2194 { lat: 242, common_pid: 2039 } hitcount: 155
2195 { lat: 242, common_pid: 2042 } hitcount: 21
2196 { lat: 242, common_pid: 2037 } hitcount: 52
2197 { lat: 242, common_pid: 2043 } hitcount: 21
2198 { lat: 242, common_pid: 2036 } hitcount: 16
2199 { lat: 242, common_pid: 2038 } hitcount: 156
2200 { lat: 243, common_pid: 2037 } hitcount: 46
2201 { lat: 243, common_pid: 2039 } hitcount: 40
2202 { lat: 243, common_pid: 2042 } hitcount: 119
2203 { lat: 243, common_pid: 2041 } hitcount: 611
2204 { lat: 243, common_pid: 2036 } hitcount: 69
2205 { lat: 243, common_pid: 2038 } hitcount: 784
2206 { lat: 243, common_pid: 2040 } hitcount: 323
2207 { lat: 243, common_pid: 2043 } hitcount: 14
2208 { lat: 244, common_pid: 2043 } hitcount: 35
2209 { lat: 244, common_pid: 2042 } hitcount: 305
2210 { lat: 244, common_pid: 2039 } hitcount: 8
2211 { lat: 244, common_pid: 2040 } hitcount: 4515
2212 { lat: 244, common_pid: 2038 } hitcount: 371
2213 { lat: 244, common_pid: 2037 } hitcount: 31
2214 { lat: 244, common_pid: 2036 } hitcount: 114
2215 { lat: 244, common_pid: 2041 } hitcount: 3396
2216 { lat: 245, common_pid: 2036 } hitcount: 700
2217 { lat: 245, common_pid: 2041 } hitcount: 2772
2218 { lat: 245, common_pid: 2037 } hitcount: 268
2219 { lat: 245, common_pid: 2039 } hitcount: 472
2220 { lat: 245, common_pid: 2038 } hitcount: 2758
2221 { lat: 245, common_pid: 2042 } hitcount: 3833
2222 { lat: 245, common_pid: 2040 } hitcount: 3105
2223 { lat: 245, common_pid: 2043 } hitcount: 645
2224 { lat: 246, common_pid: 2038 } hitcount: 3451
2225 { lat: 246, common_pid: 2041 } hitcount: 142
2226 { lat: 246, common_pid: 2037 } hitcount: 5101
2227 { lat: 246, common_pid: 2040 } hitcount: 68
2228 { lat: 246, common_pid: 2043 } hitcount: 5099
2229 { lat: 246, common_pid: 2039 } hitcount: 5608
2230 { lat: 246, common_pid: 2042 } hitcount: 3723
2231 { lat: 246, common_pid: 2036 } hitcount: 4738
2232 { lat: 247, common_pid: 2042 } hitcount: 312
2233 { lat: 247, common_pid: 2043 } hitcount: 2385
2234 { lat: 247, common_pid: 2041 } hitcount: 452
2235 { lat: 247, common_pid: 2038 } hitcount: 792
2236 { lat: 247, common_pid: 2040 } hitcount: 78
2237 { lat: 247, common_pid: 2036 } hitcount: 2375
2238 { lat: 247, common_pid: 2039 } hitcount: 1834
2239 { lat: 247, common_pid: 2037 } hitcount: 2655
2240 { lat: 248, common_pid: 2037 } hitcount: 36
2241 { lat: 248, common_pid: 2042 } hitcount: 11
2242 { lat: 248, common_pid: 2038 } hitcount: 122
2243 { lat: 248, common_pid: 2036 } hitcount: 135
2244 { lat: 248, common_pid: 2039 } hitcount: 26
2245 { lat: 248, common_pid: 2041 } hitcount: 503
2246 { lat: 248, common_pid: 2043 } hitcount: 66
2247 { lat: 248, common_pid: 2040 } hitcount: 46
2248 { lat: 249, common_pid: 2037 } hitcount: 29
2249 { lat: 249, common_pid: 2038 } hitcount: 1
2250 { lat: 249, common_pid: 2043 } hitcount: 29
2251 { lat: 249, common_pid: 2039 } hitcount: 8
2252 { lat: 249, common_pid: 2042 } hitcount: 56
2253 { lat: 249, common_pid: 2040 } hitcount: 27
2254 { lat: 249, common_pid: 2041 } hitcount: 11
2255 { lat: 249, common_pid: 2036 } hitcount: 27
2256 { lat: 250, common_pid: 2038 } hitcount: 1
2257 { lat: 250, common_pid: 2036 } hitcount: 30
2258 { lat: 250, common_pid: 2040 } hitcount: 19
2259 { lat: 250, common_pid: 2043 } hitcount: 22
2260 { lat: 250, common_pid: 2042 } hitcount: 20
2261 { lat: 250, common_pid: 2041 } hitcount: 1
2262 { lat: 250, common_pid: 2039 } hitcount: 6
2263 { lat: 250, common_pid: 2037 } hitcount: 48
2264 { lat: 251, common_pid: 2037 } hitcount: 43
2265 { lat: 251, common_pid: 2039 } hitcount: 1
2266 { lat: 251, common_pid: 2036 } hitcount: 12
2267 { lat: 251, common_pid: 2042 } hitcount: 2
2268 { lat: 251, common_pid: 2041 } hitcount: 1
2269 { lat: 251, common_pid: 2043 } hitcount: 15
2270 { lat: 251, common_pid: 2040 } hitcount: 3
2271 { lat: 252, common_pid: 2040 } hitcount: 1
2272 { lat: 252, common_pid: 2036 } hitcount: 12
2273 { lat: 252, common_pid: 2037 } hitcount: 21
2274 { lat: 252, common_pid: 2043 } hitcount: 14
2275 { lat: 253, common_pid: 2037 } hitcount: 21
2276 { lat: 253, common_pid: 2039 } hitcount: 2
2277 { lat: 253, common_pid: 2036 } hitcount: 9
2278 { lat: 253, common_pid: 2043 } hitcount: 6
2279 { lat: 253, common_pid: 2040 } hitcount: 1
2280 { lat: 254, common_pid: 2036 } hitcount: 8
2281 { lat: 254, common_pid: 2043 } hitcount: 3
2282 { lat: 254, common_pid: 2041 } hitcount: 1
2283 { lat: 254, common_pid: 2042 } hitcount: 1
2284 { lat: 254, common_pid: 2039 } hitcount: 1
2285 { lat: 254, common_pid: 2037 } hitcount: 12
2286 { lat: 255, common_pid: 2043 } hitcount: 1
2287 { lat: 255, common_pid: 2037 } hitcount: 2
2288 { lat: 255, common_pid: 2036 } hitcount: 2
2289 { lat: 255, common_pid: 2039 } hitcount: 8
2290 { lat: 256, common_pid: 2043 } hitcount: 1
2291 { lat: 256, common_pid: 2036 } hitcount: 4
2292 { lat: 256, common_pid: 2039 } hitcount: 6
2293 { lat: 257, common_pid: 2039 } hitcount: 5
2294 { lat: 257, common_pid: 2036 } hitcount: 4
2295 { lat: 258, common_pid: 2039 } hitcount: 5
2296 { lat: 258, common_pid: 2036 } hitcount: 2
2297 { lat: 259, common_pid: 2036 } hitcount: 7
2298 { lat: 259, common_pid: 2039 } hitcount: 7
2299 { lat: 260, common_pid: 2036 } hitcount: 8
2300 { lat: 260, common_pid: 2039 } hitcount: 6
2301 { lat: 261, common_pid: 2036 } hitcount: 5
2302 { lat: 261, common_pid: 2039 } hitcount: 7
2303 { lat: 262, common_pid: 2039 } hitcount: 5
2304 { lat: 262, common_pid: 2036 } hitcount: 5
2305 { lat: 263, common_pid: 2039 } hitcount: 7
2306 { lat: 263, common_pid: 2036 } hitcount: 7
2307 { lat: 264, common_pid: 2039 } hitcount: 9
2308 { lat: 264, common_pid: 2036 } hitcount: 9
2309 { lat: 265, common_pid: 2036 } hitcount: 5
2310 { lat: 265, common_pid: 2039 } hitcount: 1
2311 { lat: 266, common_pid: 2036 } hitcount: 1
2312 { lat: 266, common_pid: 2039 } hitcount: 3
2313 { lat: 267, common_pid: 2036 } hitcount: 1
2314 { lat: 267, common_pid: 2039 } hitcount: 3
2315 { lat: 268, common_pid: 2036 } hitcount: 1
2316 { lat: 268, common_pid: 2039 } hitcount: 6
2317 { lat: 269, common_pid: 2036 } hitcount: 1
2318 { lat: 269, common_pid: 2043 } hitcount: 1
2319 { lat: 269, common_pid: 2039 } hitcount: 2
2320 { lat: 270, common_pid: 2040 } hitcount: 1
2321 { lat: 270, common_pid: 2039 } hitcount: 6
2322 { lat: 271, common_pid: 2041 } hitcount: 1
2323 { lat: 271, common_pid: 2039 } hitcount: 5
2324 { lat: 272, common_pid: 2039 } hitcount: 10
2325 { lat: 273, common_pid: 2039 } hitcount: 8
2326 { lat: 274, common_pid: 2039 } hitcount: 2
2327 { lat: 275, common_pid: 2039 } hitcount: 1
2328 { lat: 276, common_pid: 2039 } hitcount: 2
2329 { lat: 276, common_pid: 2037 } hitcount: 1
2330 { lat: 276, common_pid: 2038 } hitcount: 1
2331 { lat: 277, common_pid: 2039 } hitcount: 1
2332 { lat: 277, common_pid: 2042 } hitcount: 1
2333 { lat: 278, common_pid: 2039 } hitcount: 1
2334 { lat: 279, common_pid: 2039 } hitcount: 4
2335 { lat: 279, common_pid: 2043 } hitcount: 1
2336 { lat: 280, common_pid: 2039 } hitcount: 3
2337 { lat: 283, common_pid: 2036 } hitcount: 2
2338 { lat: 284, common_pid: 2039 } hitcount: 1
2339 { lat: 284, common_pid: 2043 } hitcount: 1
2340 { lat: 288, common_pid: 2039 } hitcount: 1
2341 { lat: 289, common_pid: 2039 } hitcount: 1
2342 { lat: 300, common_pid: 2039 } hitcount: 1
2343 { lat: 384, common_pid: 2039 } hitcount: 1
2350 Note, the writes are around the sleep, so ideally they will all be of 250
2351 microseconds. If you are wondering how there are several that are under
2352 250 microseconds, that is because the way cyclictest works, is if one
2353 iteration comes in late, the next one will set the timer to wake up less that
2354 250. That is, if an iteration came in 50 microseconds late, the next wake up
2355 will be at 200 microseconds.
2357 But this could easily be done in userspace. To make this even more
2358 interesting, we can mix the histogram between events that happened in the
2359 kernel with trace_marker::
2361 # cd /sys/kernel/tracing
2362 # echo 'latency u64 lat' > synthetic_events
2363 # echo 'hist:keys=pid:ts0=common_timestamp.usecs' > events/sched/sched_waking/trigger
2364 # echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).latency($lat) if buf == "end"' > events/ftrace/print/trigger
2365 # echo 'hist:keys=lat,common_pid:sort=lat' > events/synthetic/latency/trigger
2367 The difference this time is that instead of using the trace_marker to start
2368 the latency, the sched_waking event is used, matching the common_pid for the
2369 trace_marker write with the pid that is being woken by sched_waking.
2371 After running cyclictest again with the same parameters, we now have::
2373 # cat events/synthetic/latency/hist
2376 # trigger info: hist:keys=lat,common_pid:vals=hitcount:sort=lat:size=2048 [active]
2379 { lat: 7, common_pid: 2302 } hitcount: 640
2380 { lat: 7, common_pid: 2299 } hitcount: 42
2381 { lat: 7, common_pid: 2303 } hitcount: 18
2382 { lat: 7, common_pid: 2305 } hitcount: 166
2383 { lat: 7, common_pid: 2306 } hitcount: 1
2384 { lat: 7, common_pid: 2301 } hitcount: 91
2385 { lat: 7, common_pid: 2300 } hitcount: 17
2386 { lat: 8, common_pid: 2303 } hitcount: 8296
2387 { lat: 8, common_pid: 2304 } hitcount: 6864
2388 { lat: 8, common_pid: 2305 } hitcount: 9464
2389 { lat: 8, common_pid: 2301 } hitcount: 9213
2390 { lat: 8, common_pid: 2306 } hitcount: 6246
2391 { lat: 8, common_pid: 2302 } hitcount: 8797
2392 { lat: 8, common_pid: 2299 } hitcount: 8771
2393 { lat: 8, common_pid: 2300 } hitcount: 8119
2394 { lat: 9, common_pid: 2305 } hitcount: 1519
2395 { lat: 9, common_pid: 2299 } hitcount: 2346
2396 { lat: 9, common_pid: 2303 } hitcount: 2841
2397 { lat: 9, common_pid: 2301 } hitcount: 1846
2398 { lat: 9, common_pid: 2304 } hitcount: 3861
2399 { lat: 9, common_pid: 2302 } hitcount: 1210
2400 { lat: 9, common_pid: 2300 } hitcount: 2762
2401 { lat: 9, common_pid: 2306 } hitcount: 4247
2402 { lat: 10, common_pid: 2299 } hitcount: 16
2403 { lat: 10, common_pid: 2306 } hitcount: 333
2404 { lat: 10, common_pid: 2303 } hitcount: 16
2405 { lat: 10, common_pid: 2304 } hitcount: 168
2406 { lat: 10, common_pid: 2302 } hitcount: 240
2407 { lat: 10, common_pid: 2301 } hitcount: 28
2408 { lat: 10, common_pid: 2300 } hitcount: 95
2409 { lat: 10, common_pid: 2305 } hitcount: 18
2410 { lat: 11, common_pid: 2303 } hitcount: 5
2411 { lat: 11, common_pid: 2305 } hitcount: 8
2412 { lat: 11, common_pid: 2306 } hitcount: 221
2413 { lat: 11, common_pid: 2302 } hitcount: 76
2414 { lat: 11, common_pid: 2304 } hitcount: 26
2415 { lat: 11, common_pid: 2300 } hitcount: 125
2416 { lat: 11, common_pid: 2299 } hitcount: 2
2417 { lat: 12, common_pid: 2305 } hitcount: 3
2418 { lat: 12, common_pid: 2300 } hitcount: 6
2419 { lat: 12, common_pid: 2306 } hitcount: 90
2420 { lat: 12, common_pid: 2302 } hitcount: 4
2421 { lat: 12, common_pid: 2303 } hitcount: 1
2422 { lat: 12, common_pid: 2304 } hitcount: 122
2423 { lat: 13, common_pid: 2300 } hitcount: 12
2424 { lat: 13, common_pid: 2301 } hitcount: 1
2425 { lat: 13, common_pid: 2306 } hitcount: 32
2426 { lat: 13, common_pid: 2302 } hitcount: 5
2427 { lat: 13, common_pid: 2305 } hitcount: 1
2428 { lat: 13, common_pid: 2303 } hitcount: 1
2429 { lat: 13, common_pid: 2304 } hitcount: 61
2430 { lat: 14, common_pid: 2303 } hitcount: 4
2431 { lat: 14, common_pid: 2306 } hitcount: 5
2432 { lat: 14, common_pid: 2305 } hitcount: 4
2433 { lat: 14, common_pid: 2304 } hitcount: 62
2434 { lat: 14, common_pid: 2302 } hitcount: 19
2435 { lat: 14, common_pid: 2300 } hitcount: 33
2436 { lat: 14, common_pid: 2299 } hitcount: 1
2437 { lat: 14, common_pid: 2301 } hitcount: 4
2438 { lat: 15, common_pid: 2305 } hitcount: 1
2439 { lat: 15, common_pid: 2302 } hitcount: 25
2440 { lat: 15, common_pid: 2300 } hitcount: 11
2441 { lat: 15, common_pid: 2299 } hitcount: 5
2442 { lat: 15, common_pid: 2301 } hitcount: 1
2443 { lat: 15, common_pid: 2304 } hitcount: 8
2444 { lat: 15, common_pid: 2303 } hitcount: 1
2445 { lat: 15, common_pid: 2306 } hitcount: 6
2446 { lat: 16, common_pid: 2302 } hitcount: 31
2447 { lat: 16, common_pid: 2306 } hitcount: 3
2448 { lat: 16, common_pid: 2300 } hitcount: 5
2449 { lat: 17, common_pid: 2302 } hitcount: 6
2450 { lat: 17, common_pid: 2303 } hitcount: 1
2451 { lat: 18, common_pid: 2304 } hitcount: 1
2452 { lat: 18, common_pid: 2302 } hitcount: 8
2453 { lat: 18, common_pid: 2299 } hitcount: 1
2454 { lat: 18, common_pid: 2301 } hitcount: 1
2455 { lat: 19, common_pid: 2303 } hitcount: 4
2456 { lat: 19, common_pid: 2304 } hitcount: 5
2457 { lat: 19, common_pid: 2302 } hitcount: 4
2458 { lat: 19, common_pid: 2299 } hitcount: 3
2459 { lat: 19, common_pid: 2306 } hitcount: 1
2460 { lat: 19, common_pid: 2300 } hitcount: 4
2461 { lat: 19, common_pid: 2305 } hitcount: 5
2462 { lat: 20, common_pid: 2299 } hitcount: 2
2463 { lat: 20, common_pid: 2302 } hitcount: 3
2464 { lat: 20, common_pid: 2305 } hitcount: 1
2465 { lat: 20, common_pid: 2300 } hitcount: 2
2466 { lat: 20, common_pid: 2301 } hitcount: 2
2467 { lat: 20, common_pid: 2303 } hitcount: 3
2468 { lat: 21, common_pid: 2305 } hitcount: 1
2469 { lat: 21, common_pid: 2299 } hitcount: 5
2470 { lat: 21, common_pid: 2303 } hitcount: 4
2471 { lat: 21, common_pid: 2302 } hitcount: 7
2472 { lat: 21, common_pid: 2300 } hitcount: 1
2473 { lat: 21, common_pid: 2301 } hitcount: 5
2474 { lat: 21, common_pid: 2304 } hitcount: 2
2475 { lat: 22, common_pid: 2302 } hitcount: 5
2476 { lat: 22, common_pid: 2303 } hitcount: 1
2477 { lat: 22, common_pid: 2306 } hitcount: 3
2478 { lat: 22, common_pid: 2301 } hitcount: 2
2479 { lat: 22, common_pid: 2300 } hitcount: 1
2480 { lat: 22, common_pid: 2299 } hitcount: 1
2481 { lat: 22, common_pid: 2305 } hitcount: 1
2482 { lat: 22, common_pid: 2304 } hitcount: 1
2483 { lat: 23, common_pid: 2299 } hitcount: 1
2484 { lat: 23, common_pid: 2306 } hitcount: 2
2485 { lat: 23, common_pid: 2302 } hitcount: 6
2486 { lat: 24, common_pid: 2302 } hitcount: 3
2487 { lat: 24, common_pid: 2300 } hitcount: 1
2488 { lat: 24, common_pid: 2306 } hitcount: 2
2489 { lat: 24, common_pid: 2305 } hitcount: 1
2490 { lat: 24, common_pid: 2299 } hitcount: 1
2491 { lat: 25, common_pid: 2300 } hitcount: 1
2492 { lat: 25, common_pid: 2302 } hitcount: 4
2493 { lat: 26, common_pid: 2302 } hitcount: 2
2494 { lat: 27, common_pid: 2305 } hitcount: 1
2495 { lat: 27, common_pid: 2300 } hitcount: 1
2496 { lat: 27, common_pid: 2302 } hitcount: 3
2497 { lat: 28, common_pid: 2306 } hitcount: 1
2498 { lat: 28, common_pid: 2302 } hitcount: 4
2499 { lat: 29, common_pid: 2302 } hitcount: 1
2500 { lat: 29, common_pid: 2300 } hitcount: 2
2501 { lat: 29, common_pid: 2306 } hitcount: 1
2502 { lat: 29, common_pid: 2304 } hitcount: 1
2503 { lat: 30, common_pid: 2302 } hitcount: 4
2504 { lat: 31, common_pid: 2302 } hitcount: 6
2505 { lat: 32, common_pid: 2302 } hitcount: 1
2506 { lat: 33, common_pid: 2299 } hitcount: 1
2507 { lat: 33, common_pid: 2302 } hitcount: 3
2508 { lat: 34, common_pid: 2302 } hitcount: 2
2509 { lat: 35, common_pid: 2302 } hitcount: 1
2510 { lat: 35, common_pid: 2304 } hitcount: 1
2511 { lat: 36, common_pid: 2302 } hitcount: 4
2512 { lat: 37, common_pid: 2302 } hitcount: 6
2513 { lat: 38, common_pid: 2302 } hitcount: 2
2514 { lat: 39, common_pid: 2302 } hitcount: 2
2515 { lat: 39, common_pid: 2304 } hitcount: 1
2516 { lat: 40, common_pid: 2304 } hitcount: 2
2517 { lat: 40, common_pid: 2302 } hitcount: 5
2518 { lat: 41, common_pid: 2304 } hitcount: 1
2519 { lat: 41, common_pid: 2302 } hitcount: 8
2520 { lat: 42, common_pid: 2302 } hitcount: 6
2521 { lat: 42, common_pid: 2304 } hitcount: 1
2522 { lat: 43, common_pid: 2302 } hitcount: 3
2523 { lat: 43, common_pid: 2304 } hitcount: 4
2524 { lat: 44, common_pid: 2302 } hitcount: 6
2525 { lat: 45, common_pid: 2302 } hitcount: 5
2526 { lat: 46, common_pid: 2302 } hitcount: 5
2527 { lat: 47, common_pid: 2302 } hitcount: 7
2528 { lat: 48, common_pid: 2301 } hitcount: 1
2529 { lat: 48, common_pid: 2302 } hitcount: 9
2530 { lat: 49, common_pid: 2302 } hitcount: 3
2531 { lat: 50, common_pid: 2302 } hitcount: 1
2532 { lat: 50, common_pid: 2301 } hitcount: 1
2533 { lat: 51, common_pid: 2302 } hitcount: 2
2534 { lat: 51, common_pid: 2301 } hitcount: 1
2535 { lat: 61, common_pid: 2302 } hitcount: 1
2536 { lat: 110, common_pid: 2302 } hitcount: 1
2543 This doesn't tell us any information about how late cyclictest may have
2544 woken up, but it does show us a nice histogram of how long it took from
2545 the time that cyclictest was woken to the time it made it into user space.