4 #include <linux/types.h>
14 enum perf_stat_evsel_id {
15 PERF_STAT_EVSEL_ID__NONE = 0,
16 PERF_STAT_EVSEL_ID__CYCLES_IN_TX,
17 PERF_STAT_EVSEL_ID__TRANSACTION_START,
18 PERF_STAT_EVSEL_ID__ELISION_START,
19 PERF_STAT_EVSEL_ID__CYCLES_IN_TX_CP,
20 PERF_STAT_EVSEL_ID__TOPDOWN_TOTAL_SLOTS,
21 PERF_STAT_EVSEL_ID__TOPDOWN_SLOTS_ISSUED,
22 PERF_STAT_EVSEL_ID__TOPDOWN_SLOTS_RETIRED,
23 PERF_STAT_EVSEL_ID__TOPDOWN_FETCH_BUBBLES,
24 PERF_STAT_EVSEL_ID__TOPDOWN_RECOVERY_BUBBLES,
25 PERF_STAT_EVSEL_ID__SMI_NUM,
26 PERF_STAT_EVSEL_ID__APERF,
27 PERF_STAT_EVSEL_ID__MAX,
30 struct perf_stat_evsel {
31 struct stats res_stats[3];
32 enum perf_stat_evsel_id id;
45 struct perf_stat_config {
46 enum aggr_mode aggr_mode;
49 unsigned int interval;
52 void update_stats(struct stats *stats, u64 val);
53 double avg_stats(struct stats *stats);
54 double stddev_stats(struct stats *stats);
55 double rel_stddev_stats(double stddev, double avg);
57 static inline void init_stats(struct stats *stats)
62 stats->min = (u64) -1;
69 bool __perf_evsel_stat__is(struct perf_evsel *evsel,
70 enum perf_stat_evsel_id id);
72 #define perf_stat_evsel__is(evsel, id) \
73 __perf_evsel_stat__is(evsel, PERF_STAT_EVSEL_ID__ ## id)
75 void perf_stat_evsel_id_init(struct perf_evsel *evsel);
77 extern struct stats walltime_nsecs_stats;
79 typedef void (*print_metric_t)(void *ctx, const char *color, const char *unit,
80 const char *fmt, double val);
81 typedef void (*new_line_t )(void *ctx);
83 void perf_stat__init_shadow_stats(void);
84 void perf_stat__reset_shadow_stats(void);
85 void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 *count,
87 struct perf_stat_output_ctx {
89 print_metric_t print_metric;
94 void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
96 struct perf_stat_output_ctx *out);
97 void perf_stat__collect_metric_expr(struct perf_evlist *);
99 int perf_evlist__alloc_stats(struct perf_evlist *evlist, bool alloc_raw);
100 void perf_evlist__free_stats(struct perf_evlist *evlist);
101 void perf_evlist__reset_stats(struct perf_evlist *evlist);
103 int perf_stat_process_counter(struct perf_stat_config *config,
104 struct perf_evsel *counter);
108 int perf_event__process_stat_event(struct perf_tool *tool,
109 union perf_event *event,
110 struct perf_session *session);
112 size_t perf_event__fprintf_stat(union perf_event *event, FILE *fp);
113 size_t perf_event__fprintf_stat_round(union perf_event *event, FILE *fp);
114 size_t perf_event__fprintf_stat_config(union perf_event *event, FILE *fp);