histogram.rst 134 KB

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