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__MAX,
28 struct perf_stat_evsel {
29 struct stats res_stats[3];
30 enum perf_stat_evsel_id id;
42 struct perf_stat_config {
43 enum aggr_mode aggr_mode;
46 unsigned int interval;
49 void update_stats(struct stats *stats, u64 val);
50 double avg_stats(struct stats *stats);
51 double stddev_stats(struct stats *stats);
52 double rel_stddev_stats(double stddev, double avg);
54 static inline void init_stats(struct stats *stats)
59 stats->min = (u64) -1;
66 bool __perf_evsel_stat__is(struct perf_evsel *evsel,
67 enum perf_stat_evsel_id id);
69 #define perf_stat_evsel__is(evsel, id) \
70 __perf_evsel_stat__is(evsel, PERF_STAT_EVSEL_ID__ ## id)
72 void perf_stat_evsel_id_init(struct perf_evsel *evsel);
74 extern struct stats walltime_nsecs_stats;
76 typedef void (*print_metric_t)(void *ctx, const char *color, const char *unit,
77 const char *fmt, double val);
78 typedef void (*new_line_t )(void *ctx);
80 void perf_stat__init_shadow_stats(void);
81 void perf_stat__reset_shadow_stats(void);
82 void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 *count,
84 struct perf_stat_output_ctx {
86 print_metric_t print_metric;
90 void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
92 struct perf_stat_output_ctx *out);
94 int perf_evlist__alloc_stats(struct perf_evlist *evlist, bool alloc_raw);
95 void perf_evlist__free_stats(struct perf_evlist *evlist);
96 void perf_evlist__reset_stats(struct perf_evlist *evlist);
98 int perf_stat_process_counter(struct perf_stat_config *config,
99 struct perf_evsel *counter);
103 int perf_event__process_stat_event(struct perf_tool *tool,
104 union perf_event *event,
105 struct perf_session *session);
107 size_t perf_event__fprintf_stat(union perf_event *event, FILE *fp);
108 size_t perf_event__fprintf_stat_round(union perf_event *event, FILE *fp);
109 size_t perf_event__fprintf_stat_config(union perf_event *event, FILE *fp);