2012-09-17 08:31:14 +00:00
|
|
|
#ifndef __PERF_STATS_H
|
|
|
|
#define __PERF_STATS_H
|
|
|
|
|
2014-04-25 19:31:02 +00:00
|
|
|
#include <linux/types.h>
|
2012-09-17 08:31:14 +00:00
|
|
|
|
|
|
|
struct stats
|
|
|
|
{
|
|
|
|
double n, mean, M2;
|
2013-08-02 20:05:40 +00:00
|
|
|
u64 max, min;
|
2012-09-17 08:31:14 +00:00
|
|
|
};
|
|
|
|
|
2015-06-04 13:50:55 +00:00
|
|
|
enum perf_stat_evsel_id {
|
|
|
|
PERF_STAT_EVSEL_ID__NONE = 0,
|
|
|
|
PERF_STAT_EVSEL_ID__MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct perf_stat {
|
|
|
|
struct stats res_stats[3];
|
|
|
|
enum perf_stat_evsel_id id;
|
|
|
|
};
|
|
|
|
|
2012-09-17 08:31:14 +00:00
|
|
|
void update_stats(struct stats *stats, u64 val);
|
|
|
|
double avg_stats(struct stats *stats);
|
|
|
|
double stddev_stats(struct stats *stats);
|
|
|
|
double rel_stddev_stats(double stddev, double avg);
|
|
|
|
|
2013-08-02 20:05:40 +00:00
|
|
|
static inline void init_stats(struct stats *stats)
|
|
|
|
{
|
|
|
|
stats->n = 0.0;
|
|
|
|
stats->mean = 0.0;
|
|
|
|
stats->M2 = 0.0;
|
|
|
|
stats->min = (u64) -1;
|
|
|
|
stats->max = 0;
|
|
|
|
}
|
2015-06-04 13:50:55 +00:00
|
|
|
|
|
|
|
struct perf_evsel;
|
|
|
|
bool __perf_evsel_stat__is(struct perf_evsel *evsel,
|
|
|
|
enum perf_stat_evsel_id id);
|
|
|
|
|
|
|
|
#define perf_stat_evsel__is(evsel, id) \
|
|
|
|
__perf_evsel_stat__is(evsel, PERF_STAT_EVSEL_ID__ ## id)
|
|
|
|
|
|
|
|
void perf_stat_evsel_id_init(struct perf_evsel *evsel);
|
|
|
|
|
2012-09-17 08:31:14 +00:00
|
|
|
#endif
|