Messages in this thread | | | Date | Tue, 24 Mar 2020 11:27:17 +0100 | From | Jiri Olsa <> | Subject | Re: [PATCH v5] perf tools: add support for libpfm4 |
| |
On Mon, Mar 23, 2020 at 04:58:46PM -0700, Ian Rogers wrote:
SNIP
> + > +int parse_libpfm_events_option(const struct option *opt, const char *str, > + int unset __maybe_unused) > +{ > + struct evlist *evlist = *(struct evlist **)opt->value; > + struct perf_event_attr attr; > + struct perf_pmu *pmu; > + struct evsel *evsel, *grp_leader = NULL; > + char *p, *q, *p_orig; > + const char *sep; > + int grp_evt = -1; > + int ret; > + > + p_orig = p = strdup(str); > + if (!p) > + return -1; > + /* > + * force loading of the PMU list > + */ > + perf_pmu__scan(NULL); > + > + for (q = p; strsep(&p, ",{}"); q = p) {
it seems like this code could be really easily testtable, could you please write simple test for this?
thanks, jirka
| |