perf evsel: Add evsel__clone() function
authorNamhyung Kim <namhyung@kernel.org>
Thu, 24 Sep 2020 12:44:51 +0000 (21:44 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 28 Sep 2020 11:55:48 +0000 (08:55 -0300)
commit7fedd9b84bf8288ccb7a88aadedffdc9221f31e6
tree4f1ddd38c4b2aa528d49e5545be6d056fdb08428
parentb5ff7f2799a4191eb9d91479db59c855ddeaf81e
perf evsel: Add evsel__clone() function

The evsel__clone() is to create an exactly same evsel from same
attributes.  The function assumes the given evsel is not configured
yet so it cares fields set during event parsing.  Those fields are now
moved together as Jiri suggested.  Note that metric events will be
handled by later patch.

It will be used by perf stat to generate separate events for each
cgroup.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20200924124455.336326-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/evsel.c
tools/perf/util/evsel.h