aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/Documentation/perf-probe.txt10
-rw-r--r--tools/perf/util/probe-event.c23
2 files changed, 20 insertions, 13 deletions
diff --git a/tools/perf/Documentation/perf-probe.txt b/tools/perf/Documentation/perf-probe.txt
index 8d091734d02c..7a258e953252 100644
--- a/tools/perf/Documentation/perf-probe.txt
+++ b/tools/perf/Documentation/perf-probe.txt
@@ -143,16 +143,18 @@ PROBE SYNTAX
143Probe points are defined by following syntax. 143Probe points are defined by following syntax.
144 144
145 1) Define event based on function name 145 1) Define event based on function name
146 [EVENT=]FUNC[@SRC][:RLN|+OFFS|%return|;PTN] [ARG ...] 146 [[GROUP:]EVENT=]FUNC[@SRC][:RLN|+OFFS|%return|;PTN] [ARG ...]
147 147
148 2) Define event based on source file with line number 148 2) Define event based on source file with line number
149 [EVENT=]SRC:ALN [ARG ...] 149 [[GROUP:]EVENT=]SRC:ALN [ARG ...]
150 150
151 3) Define event based on source file with lazy pattern 151 3) Define event based on source file with lazy pattern
152 [EVENT=]SRC;PTN [ARG ...] 152 [[GROUP:]EVENT=]SRC;PTN [ARG ...]
153 153
154 154
155'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'. 155'EVENT' specifies the name of new event, if omitted, it will be set the name of the probed function. You can also specify a group name by 'GROUP', if omitted, set 'probe' is used for kprobe and 'probe_<bin>' is used for uprobe.
156Note that using existing group name can conflict with other events. Especially, using the group name reserved for kernel modules can hide embedded events in the
157modules.
156'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. 158'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.
157It 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. 159It 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.
158'ARG' specifies the arguments of this probe point, (see PROBE ARGUMENT). 160'ARG' specifies the arguments of this probe point, (see PROBE ARGUMENT).
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index f81b5dd7f1b1..0201f661ccb8 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1206,10 +1206,8 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
1206 bool file_spec = false; 1206 bool file_spec = false;
1207 /* 1207 /*
1208 * <Syntax> 1208 * <Syntax>
1209 * perf probe [EVENT=]SRC[:LN|;PTN] 1209 * perf probe [GRP:][EVENT=]SRC[:LN|;PTN]
1210 * perf probe [EVENT=]FUNC[@SRC][+OFFS|%return|:LN|;PAT] 1210 * perf probe [GRP:][EVENT=]FUNC[@SRC][+OFFS|%return|:LN|;PAT]
1211 *
1212 * TODO:Group name support
1213 */ 1211 */
1214 if (!arg) 1212 if (!arg)
1215 return -EINVAL; 1213 return -EINVAL;
@@ -1218,11 +1216,19 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
1218 if (ptr && *ptr == '=') { /* Event name */ 1216 if (ptr && *ptr == '=') { /* Event name */
1219 *ptr = '\0'; 1217 *ptr = '\0';
1220 tmp = ptr + 1; 1218 tmp = ptr + 1;
1221 if (strchr(arg, ':')) { 1219 ptr = strchr(arg, ':');
1222 semantic_error("Group name is not supported yet.\n"); 1220 if (ptr) {
1223 return -ENOTSUP; 1221 *ptr = '\0';
1224 } 1222 if (!is_c_func_name(arg))
1223 goto not_fname;
1224 pev->group = strdup(arg);
1225 if (!pev->group)
1226 return -ENOMEM;
1227 arg = ptr + 1;
1228 } else
1229 pev->group = NULL;
1225 if (!is_c_func_name(arg)) { 1230 if (!is_c_func_name(arg)) {
1231not_fname:
1226 semantic_error("%s is bad for event name -it must " 1232 semantic_error("%s is bad for event name -it must "
1227 "follow C symbol-naming rule.\n", arg); 1233 "follow C symbol-naming rule.\n", arg);
1228 return -EINVAL; 1234 return -EINVAL;
@@ -1230,7 +1236,6 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
1230 pev->event = strdup(arg); 1236 pev->event = strdup(arg);
1231 if (pev->event == NULL) 1237 if (pev->event == NULL)
1232 return -ENOMEM; 1238 return -ENOMEM;
1233 pev->group = NULL;
1234 arg = tmp; 1239 arg = tmp;
1235 } 1240 }
1236 1241