const struct option record_options[] = {
OPT_CALLBACK('e', "event", &evsel_list, "event",
"event selector. use 'perf list' to list available events",
- parse_events),
+ parse_events_option),
OPT_CALLBACK(0, "filter", &evsel_list, "filter",
"event filter", parse_filter),
OPT_INTEGER('p', "pid", &target_pid,
static const struct option options[] = {
OPT_CALLBACK('e', "event", &evsel_list, "event",
"event selector. use 'perf list' to list available events",
- parse_events),
+ parse_events_option),
OPT_CALLBACK(0, "filter", &evsel_list, "filter",
"event filter", parse_filter),
OPT_BOOLEAN('i', "no-inherit", &no_inherit,
static const struct option options[] = {
OPT_CALLBACK('e', "event", &top.evlist, "event",
"event selector. use 'perf list' to list available events",
- parse_events),
+ parse_events_option),
OPT_INTEGER('c', "count", &default_interval,
"event period to sample"),
OPT_INTEGER('p', "pid", &top.target_pid,
/* sys + ':' + event + ':' + flags*/
#define MAX_EVOPT_LEN (MAX_EVENT_LENGTH * 2 + 2 + 128)
static enum event_result
-parse_multiple_tracepoint_event(const struct option *opt, char *sys_name,
+parse_multiple_tracepoint_event(struct perf_evlist *evlist, char *sys_name,
const char *evt_exp, char *flags)
{
char evt_path[MAXPATHLEN];
if (len < 0)
return EVT_FAILED;
- if (parse_events(opt, event_opt, 0))
+ if (parse_events(evlist, event_opt, 0))
return EVT_FAILED;
}
}
static enum event_result
-parse_tracepoint_event(const struct option *opt, const char **strp,
+parse_tracepoint_event(struct perf_evlist *evlist, const char **strp,
struct perf_event_attr *attr)
{
const char *evt_name;
return EVT_FAILED;
if (strpbrk(evt_name, "*?")) {
*strp += strlen(sys_name) + evt_length + 1; /* 1 == the ':' */
- return parse_multiple_tracepoint_event(opt, sys_name, evt_name,
- flags);
+ return parse_multiple_tracepoint_event(evlist, sys_name,
+ evt_name, flags);
} else {
return parse_single_tracepoint_event(sys_name, evt_name,
evt_length, attr, strp);
* Symbolic names are (almost) exactly matched.
*/
static enum event_result
-parse_event_symbols(const struct option *opt, const char **str,
+parse_event_symbols(struct perf_evlist *evlist, const char **str,
struct perf_event_attr *attr)
{
enum event_result ret;
- ret = parse_tracepoint_event(opt, str, attr);
+ ret = parse_tracepoint_event(evlist, str, attr);
if (ret != EVT_FAILED)
goto modifier;
return ret;
}
-int parse_events(const struct option *opt, const char *str, int unset __used)
+int parse_events(struct perf_evlist *evlist , const char *str, int unset __used)
{
- struct perf_evlist *evlist = *(struct perf_evlist **)opt->value;
struct perf_event_attr attr;
enum event_result ret;
const char *ostr;
for (;;) {
ostr = str;
memset(&attr, 0, sizeof(attr));
- ret = parse_event_symbols(opt, &str, &attr);
+ ret = parse_event_symbols(evlist, &str, &attr);
if (ret == EVT_FAILED)
return -1;
return 0;
}
+int parse_events_option(const struct option *opt, const char *str,
+ int unset __used)
+{
+ struct perf_evlist *evlist = *(struct perf_evlist **)opt->value;
+ return parse_events(evlist, str, unset);
+}
+
int parse_filter(const struct option *opt, const char *str,
int unset __used)
{
struct list_head;
struct perf_evsel;
+struct perf_evlist;
struct option;
const char *event_name(struct perf_evsel *event);
extern const char *__event_name(int type, u64 config);
-extern int parse_events(const struct option *opt, const char *str, int unset);
+extern int parse_events_option(const struct option *opt, const char *str,
+ int unset);
+extern int parse_events(struct perf_evlist *evlist, const char *str,
+ int unset);
extern int parse_filter(const struct option *opt, const char *str, int unset);
#define EVENTS_HELP_MAX (128*1024)