perf evsel: Restore evsel->priv as a tool private area
When we started using it for stats and did it not just in
builtin-stat.c, but also for builtin-script.c, then it stopped being a
tool private area, so introduce a new pointer for these stats and leave
->priv to its original purpose.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: yuzhoujian <yuzhoujian@didichuxing.com>
Fixes: cfc8874a48
("perf script: Process cpu/threads maps")
Link: http://lkml.kernel.org/n/tip-jtpzx3rjqo78snmmsdzwb2eb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
894f3f1732
commit
e669e833da
3 changed files with 13 additions and 10 deletions
|
@ -845,7 +845,7 @@ static void print_noise(struct perf_evsel *evsel, double avg)
|
||||||
if (run_count == 1)
|
if (run_count == 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ps = evsel->priv;
|
ps = evsel->stats;
|
||||||
print_noise_pct(stddev_stats(&ps->res_stats[0]), avg);
|
print_noise_pct(stddev_stats(&ps->res_stats[0]), avg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1432,7 +1432,7 @@ static void counter_aggr_cb(struct perf_evsel *counter, void *data,
|
||||||
bool first __maybe_unused)
|
bool first __maybe_unused)
|
||||||
{
|
{
|
||||||
struct caggr_data *cd = data;
|
struct caggr_data *cd = data;
|
||||||
struct perf_stat_evsel *ps = counter->priv;
|
struct perf_stat_evsel *ps = counter->stats;
|
||||||
|
|
||||||
cd->avg += avg_stats(&ps->res_stats[0]);
|
cd->avg += avg_stats(&ps->res_stats[0]);
|
||||||
cd->avg_enabled += avg_stats(&ps->res_stats[1]);
|
cd->avg_enabled += avg_stats(&ps->res_stats[1]);
|
||||||
|
|
|
@ -68,6 +68,8 @@ struct perf_evsel_config_term {
|
||||||
} val;
|
} val;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct perf_stat_evsel;
|
||||||
|
|
||||||
/** struct perf_evsel - event selector
|
/** struct perf_evsel - event selector
|
||||||
*
|
*
|
||||||
* @evlist - evlist this evsel is in, if it is in one.
|
* @evlist - evlist this evsel is in, if it is in one.
|
||||||
|
@ -101,6 +103,7 @@ struct perf_evsel {
|
||||||
const char *unit;
|
const char *unit;
|
||||||
struct event_format *tp_format;
|
struct event_format *tp_format;
|
||||||
off_t id_offset;
|
off_t id_offset;
|
||||||
|
struct perf_stat_evsel *stats;
|
||||||
void *priv;
|
void *priv;
|
||||||
u64 db_id;
|
u64 db_id;
|
||||||
struct cgroup_sel *cgrp;
|
struct cgroup_sel *cgrp;
|
||||||
|
|
|
@ -69,7 +69,7 @@ double rel_stddev_stats(double stddev, double avg)
|
||||||
bool __perf_evsel_stat__is(struct perf_evsel *evsel,
|
bool __perf_evsel_stat__is(struct perf_evsel *evsel,
|
||||||
enum perf_stat_evsel_id id)
|
enum perf_stat_evsel_id id)
|
||||||
{
|
{
|
||||||
struct perf_stat_evsel *ps = evsel->priv;
|
struct perf_stat_evsel *ps = evsel->stats;
|
||||||
|
|
||||||
return ps->id == id;
|
return ps->id == id;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ static const char *id_str[PERF_STAT_EVSEL_ID__MAX] = {
|
||||||
|
|
||||||
void perf_stat_evsel_id_init(struct perf_evsel *evsel)
|
void perf_stat_evsel_id_init(struct perf_evsel *evsel)
|
||||||
{
|
{
|
||||||
struct perf_stat_evsel *ps = evsel->priv;
|
struct perf_stat_evsel *ps = evsel->stats;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* ps->id is 0 hence PERF_STAT_EVSEL_ID__NONE by default */
|
/* ps->id is 0 hence PERF_STAT_EVSEL_ID__NONE by default */
|
||||||
|
@ -109,7 +109,7 @@ void perf_stat_evsel_id_init(struct perf_evsel *evsel)
|
||||||
static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
|
static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct perf_stat_evsel *ps = evsel->priv;
|
struct perf_stat_evsel *ps = evsel->stats;
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
init_stats(&ps->res_stats[i]);
|
init_stats(&ps->res_stats[i]);
|
||||||
|
@ -119,8 +119,8 @@ static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
|
||||||
|
|
||||||
static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
|
static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
|
||||||
{
|
{
|
||||||
evsel->priv = zalloc(sizeof(struct perf_stat_evsel));
|
evsel->stats = zalloc(sizeof(struct perf_stat_evsel));
|
||||||
if (evsel->priv == NULL)
|
if (evsel->stats == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
perf_evsel__reset_stat_priv(evsel);
|
perf_evsel__reset_stat_priv(evsel);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -128,11 +128,11 @@ static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
|
||||||
|
|
||||||
static void perf_evsel__free_stat_priv(struct perf_evsel *evsel)
|
static void perf_evsel__free_stat_priv(struct perf_evsel *evsel)
|
||||||
{
|
{
|
||||||
struct perf_stat_evsel *ps = evsel->priv;
|
struct perf_stat_evsel *ps = evsel->stats;
|
||||||
|
|
||||||
if (ps)
|
if (ps)
|
||||||
free(ps->group_data);
|
free(ps->group_data);
|
||||||
zfree(&evsel->priv);
|
zfree(&evsel->stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel,
|
static int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel,
|
||||||
|
@ -318,7 +318,7 @@ int perf_stat_process_counter(struct perf_stat_config *config,
|
||||||
struct perf_evsel *counter)
|
struct perf_evsel *counter)
|
||||||
{
|
{
|
||||||
struct perf_counts_values *aggr = &counter->counts->aggr;
|
struct perf_counts_values *aggr = &counter->counts->aggr;
|
||||||
struct perf_stat_evsel *ps = counter->priv;
|
struct perf_stat_evsel *ps = counter->stats;
|
||||||
u64 *count = counter->counts->aggr.values;
|
u64 *count = counter->counts->aggr.values;
|
||||||
u64 val;
|
u64 val;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
Loading…
Add table
Reference in a new issue