1595c3649SMasami Hiramatsuperf-probe(1) 2595c3649SMasami Hiramatsu============= 3595c3649SMasami Hiramatsu 4595c3649SMasami HiramatsuNAME 5595c3649SMasami Hiramatsu---- 6595c3649SMasami Hiramatsuperf-probe - Define new dynamic tracepoints 7595c3649SMasami Hiramatsu 8595c3649SMasami HiramatsuSYNOPSIS 9595c3649SMasami Hiramatsu-------- 10595c3649SMasami Hiramatsu[verse] 11c937fe20SMasami Hiramatsu'perf probe' [options] --add='PROBE' [...] 12c43f9d1eSMasami Hiramatsuor 13c937fe20SMasami Hiramatsu'perf probe' [options] PROBE 14c937fe20SMasami Hiramatsuor 15c937fe20SMasami Hiramatsu'perf probe' [options] --del='[GROUP:]EVENT' [...] 16c937fe20SMasami Hiramatsuor 17c937fe20SMasami Hiramatsu'perf probe' --list 18631c9defSMasami Hiramatsuor 19631c9defSMasami Hiramatsu'perf probe' --line='FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]' 20595c3649SMasami Hiramatsu 21595c3649SMasami HiramatsuDESCRIPTION 22595c3649SMasami Hiramatsu----------- 23595c3649SMasami HiramatsuThis command defines dynamic tracepoint events, by symbol and registers 24595c3649SMasami Hiramatsuwithout debuginfo, or by C expressions (C line numbers, C function names, 25595c3649SMasami Hiramatsuand C local variables) with debuginfo. 26595c3649SMasami Hiramatsu 27595c3649SMasami Hiramatsu 28595c3649SMasami HiramatsuOPTIONS 29595c3649SMasami Hiramatsu------- 30595c3649SMasami Hiramatsu-k:: 31c43f9d1eSMasami Hiramatsu--vmlinux=PATH:: 32595c3649SMasami Hiramatsu Specify vmlinux path which has debuginfo (Dwarf binary). 33595c3649SMasami Hiramatsu 34*9ed7e1b8SChase Douglas-s:: 35*9ed7e1b8SChase Douglas--source=PATH:: 36*9ed7e1b8SChase Douglas Specify path to kernel source. 37*9ed7e1b8SChase Douglas 38595c3649SMasami Hiramatsu-v:: 39595c3649SMasami Hiramatsu--verbose:: 40595c3649SMasami Hiramatsu Be more verbose (show parsed arguments, etc). 41595c3649SMasami Hiramatsu 42c43f9d1eSMasami Hiramatsu-a:: 43c937fe20SMasami Hiramatsu--add=:: 44c937fe20SMasami Hiramatsu Define a probe event (see PROBE SYNTAX for detail). 45c937fe20SMasami Hiramatsu 46c937fe20SMasami Hiramatsu-d:: 47c937fe20SMasami Hiramatsu--del=:: 48ee391de8SMasami Hiramatsu Delete probe events. This accepts glob wildcards('*', '?') and character 49ee391de8SMasami Hiramatsu classes(e.g. [a-z], [!A-Z]). 50c937fe20SMasami Hiramatsu 51c937fe20SMasami Hiramatsu-l:: 52c937fe20SMasami Hiramatsu--list:: 53c937fe20SMasami Hiramatsu List up current probe events. 54595c3649SMasami Hiramatsu 55631c9defSMasami Hiramatsu-L:: 56631c9defSMasami Hiramatsu--line=:: 57631c9defSMasami Hiramatsu Show source code lines which can be probed. This needs an argument 58ee391de8SMasami Hiramatsu which specifies a range of the source code. (see LINE SYNTAX for detail) 59ee391de8SMasami Hiramatsu 60ee391de8SMasami Hiramatsu-f:: 61ee391de8SMasami Hiramatsu--force:: 62ee391de8SMasami Hiramatsu Forcibly add events with existing name. 63631c9defSMasami Hiramatsu 64f4d7da49SMasami Hiramatsu-n:: 65f4d7da49SMasami Hiramatsu--dry-run:: 66f4d7da49SMasami Hiramatsu Dry run. With this option, --add and --del doesn't execute actual 67f4d7da49SMasami Hiramatsu adding and removal operations. 68f4d7da49SMasami Hiramatsu 69ef4a3565SMasami Hiramatsu--max-probes:: 70ef4a3565SMasami Hiramatsu Set the maximum number of probe points for an event. Default is 128. 71ef4a3565SMasami Hiramatsu 72595c3649SMasami HiramatsuPROBE SYNTAX 73595c3649SMasami Hiramatsu------------ 74595c3649SMasami HiramatsuProbe points are defined by following syntax. 75595c3649SMasami Hiramatsu 762a9c8c36SMasami Hiramatsu 1) Define event based on function name 772a9c8c36SMasami Hiramatsu [EVENT=]FUNC[@SRC][:RLN|+OFFS|%return|;PTN] [ARG ...] 782a9c8c36SMasami Hiramatsu 792a9c8c36SMasami Hiramatsu 2) Define event based on source file with line number 802a9c8c36SMasami Hiramatsu [EVENT=]SRC:ALN [ARG ...] 812a9c8c36SMasami Hiramatsu 822a9c8c36SMasami Hiramatsu 3) Define event based on source file with lazy pattern 832a9c8c36SMasami Hiramatsu [EVENT=]SRC;PTN [ARG ...] 842a9c8c36SMasami Hiramatsu 85595c3649SMasami Hiramatsu 86af663d75SMasami Hiramatsu'EVENT' specifies the name of new event, if omitted, it will be set the name of the probed function. Currently, event group name is set as 'probe'. 872a9c8c36SMasami Hiramatsu'FUNC' specifies a probed function name, and it may have one of the following options; '+OFFS' is the offset from function entry address in bytes, ':RLN' is the relative-line number from function entry line, and '%return' means that it probes function return. And ';PTN' means lazy matching pattern (see LAZY MATCHING). Note that ';PTN' must be the end of the probe point definition. In addition, '@SRC' specifies a source file which has that function. 882a9c8c36SMasami HiramatsuIt is also possible to specify a probe point by the source line number or lazy matching by using 'SRC:ALN' or 'SRC;PTN' syntax, where 'SRC' is the source file path, ':ALN' is the line number and ';PTN' is the lazy matching pattern. 8948481938SMasami Hiramatsu'ARG' specifies the arguments of this probe point, (see PROBE ARGUMENT). 9048481938SMasami Hiramatsu 9148481938SMasami HiramatsuPROBE ARGUMENT 9248481938SMasami Hiramatsu-------------- 9348481938SMasami HiramatsuEach probe argument follows below syntax. 9448481938SMasami Hiramatsu 9511a1ca35SMasami Hiramatsu [NAME=]LOCALVAR|$retval|%REG|@SYMBOL[:TYPE] 9648481938SMasami Hiramatsu 97df0faf4bSMasami Hiramatsu'NAME' specifies the name of this argument (optional). You can use the name of local variable, local data structure member (e.g. var->field, var.field2), or kprobe-tracer argument format (e.g. $retval, %ax, etc). Note that the name of this argument will be set as the last member name if you specify a local data structure member (e.g. field2 for 'var->field1.field2'.) 9811a1ca35SMasami Hiramatsu'TYPE' casts the type of this argument (optional). If omitted, perf probe automatically set the type based on debuginfo. 99595c3649SMasami Hiramatsu 100631c9defSMasami HiramatsuLINE SYNTAX 101631c9defSMasami Hiramatsu----------- 102631c9defSMasami HiramatsuLine range is descripted by following syntax. 103631c9defSMasami Hiramatsu 104085ea739SMasami Hiramatsu "FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]" 105631c9defSMasami Hiramatsu 106631c9defSMasami HiramatsuFUNC specifies the function name of showing lines. 'RLN' is the start line 107631c9defSMasami Hiramatsunumber from function entry line, and 'RLN2' is the end line number. As same as 108631c9defSMasami Hiramatsuprobe syntax, 'SRC' means the source file path, 'ALN' is start line number, 109631c9defSMasami Hiramatsuand 'ALN2' is end line number in the file. It is also possible to specify how 110631c9defSMasami Hiramatsumany lines to show by using 'NUM'. 111631c9defSMasami HiramatsuSo, "source.c:100-120" shows lines between 100th to l20th in source.c file. And "func:10+20" shows 20 lines from 10th line of func function. 112631c9defSMasami Hiramatsu 1132a9c8c36SMasami HiramatsuLAZY MATCHING 1142a9c8c36SMasami Hiramatsu------------- 1152a9c8c36SMasami Hiramatsu The lazy line matching is similar to glob matching but ignoring spaces in both of pattern and target. So this accepts wildcards('*', '?') and character classes(e.g. [a-z], [!A-Z]). 1162a9c8c36SMasami Hiramatsu 1172a9c8c36SMasami Hiramatsue.g. 1182a9c8c36SMasami Hiramatsu 'a=*' can matches 'a=b', 'a = b', 'a == b' and so on. 1192a9c8c36SMasami Hiramatsu 1202a9c8c36SMasami HiramatsuThis provides some sort of flexibility and robustness to probe point definitions against minor code changes. For example, actual 10th line of schedule() can be moved easily by modifying schedule(), but the same line matching 'rq=cpu_rq*' may still exist in the function.) 1212a9c8c36SMasami Hiramatsu 1222a9c8c36SMasami Hiramatsu 123ee391de8SMasami HiramatsuEXAMPLES 124ee391de8SMasami Hiramatsu-------- 125ee391de8SMasami HiramatsuDisplay which lines in schedule() can be probed: 126ee391de8SMasami Hiramatsu 127ee391de8SMasami Hiramatsu ./perf probe --line schedule 128ee391de8SMasami Hiramatsu 129ee391de8SMasami HiramatsuAdd a probe on schedule() function 12th line with recording cpu local variable: 130ee391de8SMasami Hiramatsu 131ee391de8SMasami Hiramatsu ./perf probe schedule:12 cpu 132ee391de8SMasami Hiramatsu or 133ee391de8SMasami Hiramatsu ./perf probe --add='schedule:12 cpu' 134ee391de8SMasami Hiramatsu 135ee391de8SMasami Hiramatsu this will add one or more probes which has the name start with "schedule". 136ee391de8SMasami Hiramatsu 1372a9c8c36SMasami Hiramatsu Add probes on lines in schedule() function which calls update_rq_clock(). 1382a9c8c36SMasami Hiramatsu 1392a9c8c36SMasami Hiramatsu ./perf probe 'schedule;update_rq_clock*' 1402a9c8c36SMasami Hiramatsu or 1412a9c8c36SMasami Hiramatsu ./perf probe --add='schedule;update_rq_clock*' 1422a9c8c36SMasami Hiramatsu 143ee391de8SMasami HiramatsuDelete all probes on schedule(). 144ee391de8SMasami Hiramatsu 145ee391de8SMasami Hiramatsu ./perf probe --del='schedule*' 146ee391de8SMasami Hiramatsu 147ee391de8SMasami Hiramatsu 148595c3649SMasami HiramatsuSEE ALSO 149595c3649SMasami Hiramatsu-------- 150595c3649SMasami Hiramatsulinkperf:perf-trace[1], linkperf:perf-record[1] 151