perf stat: Add 'walltime_nsecs_stats' pointer to 'struct perf_stat_config'
Add 'walltime_nsecs_stats' pointer to 'struct perf_stat_config', so that it can be passed around and used outside the 'perf stat' command. It's initialized to point to stat's walltime_nsecs_stats value. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20180830063252.23729-32-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
77e0faf855
commit
26893a6018
@@ -195,11 +195,12 @@ static struct perf_stat perf_stat;
|
|||||||
static volatile int done = 0;
|
static volatile int done = 0;
|
||||||
|
|
||||||
static struct perf_stat_config stat_config = {
|
static struct perf_stat_config stat_config = {
|
||||||
.aggr_mode = AGGR_GLOBAL,
|
.aggr_mode = AGGR_GLOBAL,
|
||||||
.scale = true,
|
.scale = true,
|
||||||
.unit_width = 4, /* strlen("unit") */
|
.unit_width = 4, /* strlen("unit") */
|
||||||
.run_count = 1,
|
.run_count = 1,
|
||||||
.metric_only_len = METRIC_ONLY_LEN,
|
.metric_only_len = METRIC_ONLY_LEN,
|
||||||
|
.walltime_nsecs_stats = &walltime_nsecs_stats,
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool is_duration_time(struct perf_evsel *evsel)
|
static bool is_duration_time(struct perf_evsel *evsel)
|
||||||
@@ -1671,7 +1672,7 @@ static double timeval2double(struct timeval *t)
|
|||||||
|
|
||||||
static void print_footer(struct perf_stat_config *config)
|
static void print_footer(struct perf_stat_config *config)
|
||||||
{
|
{
|
||||||
double avg = avg_stats(&walltime_nsecs_stats) / NSEC_PER_SEC;
|
double avg = avg_stats(config->walltime_nsecs_stats) / NSEC_PER_SEC;
|
||||||
FILE *output = config->output;
|
FILE *output = config->output;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
@@ -1690,7 +1691,7 @@ static void print_footer(struct perf_stat_config *config)
|
|||||||
fprintf(output, " %17.9f seconds sys\n", ru_stime);
|
fprintf(output, " %17.9f seconds sys\n", ru_stime);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
double sd = stddev_stats(&walltime_nsecs_stats) / NSEC_PER_SEC;
|
double sd = stddev_stats(config->walltime_nsecs_stats) / NSEC_PER_SEC;
|
||||||
/*
|
/*
|
||||||
* Display at most 2 more significant
|
* Display at most 2 more significant
|
||||||
* digits than the stddev inaccuracy.
|
* digits than the stddev inaccuracy.
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ struct perf_stat_config {
|
|||||||
struct runtime_stat *stats;
|
struct runtime_stat *stats;
|
||||||
int stats_num;
|
int stats_num;
|
||||||
const char *csv_sep;
|
const char *csv_sep;
|
||||||
|
struct stats *walltime_nsecs_stats;
|
||||||
};
|
};
|
||||||
|
|
||||||
void update_stats(struct stats *stats, u64 val);
|
void update_stats(struct stats *stats, u64 val);
|
||||||
|
|||||||
Reference in New Issue
Block a user