perf record: Fix -c/-F options for cpu event aliases
authorAndi Kleen <ak@linux.intel.com>
Fri, 20 Oct 2017 20:27:55 +0000 (13:27 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 28 Nov 2017 17:19:39 +0000 (14:19 -0300)
commit59622fd496a3175c7bf549046e091d81c303ecff
tree2e5083d49399cb18fadca963f48b47d72fad2258
parentdffdcbdbb0205ac10daec64f7fa519f1904f5481
perf record: Fix -c/-F options for cpu event aliases

The Intel PMU event aliases have a implicit period= specifier to set the
default period.

Unfortunately this breaks overriding these periods with -c or -F,
because the alias terms look like they are user specified to the
internal parser, and user specified event qualifiers override the
command line options.

Track that they are coming from aliases by adding a "weak" state to the
term. Any weak terms don't override command line options.

I only did it for -c/-F for now, I think that's the only case that's
broken currently.

Before:

$ perf record -c 1000 -vv -e uops_issued.any
...
  { sample_period, sample_freq }   2000003

After:

$ perf record -c 1000 -vv -e uops_issued.any
...
  { sample_period, sample_freq }   1000

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20171020202755.21410-2-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/evsel.c
tools/perf/util/evsel.h
tools/perf/util/parse-events.c
tools/perf/util/parse-events.h
tools/perf/util/pmu.c