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__MAX
,
23 struct perf_stat_evsel
{
24 struct stats res_stats
[3];
25 enum perf_stat_evsel_id id
;
37 struct perf_stat_config
{
38 enum aggr_mode aggr_mode
;
41 unsigned int interval
;
44 void update_stats(struct stats
*stats
, u64 val
);
45 double avg_stats(struct stats
*stats
);
46 double stddev_stats(struct stats
*stats
);
47 double rel_stddev_stats(double stddev
, double avg
);
49 static inline void init_stats(struct stats
*stats
)
54 stats
->min
= (u64
) -1;
61 bool __perf_evsel_stat__is(struct perf_evsel
*evsel
,
62 enum perf_stat_evsel_id id
);
64 #define perf_stat_evsel__is(evsel, id) \
65 __perf_evsel_stat__is(evsel, PERF_STAT_EVSEL_ID__ ## id)
67 void perf_stat_evsel_id_init(struct perf_evsel
*evsel
);
69 extern struct stats walltime_nsecs_stats
;
71 typedef void (*print_metric_t
)(void *ctx
, const char *color
, const char *unit
,
72 const char *fmt
, double val
);
73 typedef void (*new_line_t
)(void *ctx
);
75 void perf_stat__init_shadow_stats(void);
76 void perf_stat__reset_shadow_stats(void);
77 void perf_stat__update_shadow_stats(struct perf_evsel
*counter
, u64
*count
,
79 struct perf_stat_output_ctx
{
81 print_metric_t print_metric
;
85 void perf_stat__print_shadow_stats(struct perf_evsel
*evsel
,
87 struct perf_stat_output_ctx
*out
);
89 int perf_evlist__alloc_stats(struct perf_evlist
*evlist
, bool alloc_raw
);
90 void perf_evlist__free_stats(struct perf_evlist
*evlist
);
91 void perf_evlist__reset_stats(struct perf_evlist
*evlist
);
93 int perf_stat_process_counter(struct perf_stat_config
*config
,
94 struct perf_evsel
*counter
);
98 int perf_event__process_stat_event(struct perf_tool
*tool
,
99 union perf_event
*event
,
100 struct perf_session
*session
);
102 size_t perf_event__fprintf_stat(union perf_event
*event
, FILE *fp
);
103 size_t perf_event__fprintf_stat_round(union perf_event
*event
, FILE *fp
);
104 size_t perf_event__fprintf_stat_config(union perf_event
*event
, FILE *fp
);