1 #ifndef __PERF_KVM_STAT_H
2 #define __PERF_KVM_STAT_H
12 #define INVALID_KEY (~0ULL)
17 struct kvm_event_stats
{
23 struct list_head hash_entry
;
28 struct kvm_event_stats total
;
30 #define DEFAULT_VCPU_NUM 8
32 struct kvm_event_stats
*vcpu
;
35 typedef int (*key_cmp_fun
)(struct kvm_event
*, struct kvm_event
*, int);
37 struct kvm_event_key
{
44 struct kvm_events_ops
{
45 bool (*is_begin_event
)(struct perf_evsel
*evsel
,
46 struct perf_sample
*sample
,
47 struct event_key
*key
);
48 bool (*is_end_event
)(struct perf_evsel
*evsel
,
49 struct perf_sample
*sample
, struct event_key
*key
);
50 void (*decode_key
)(struct perf_kvm_stat
*kvm
, struct event_key
*key
,
55 struct exit_reasons_table
{
56 unsigned long exit_code
;
60 #define EVENTS_BITS 12
61 #define EVENTS_CACHE_SIZE (1UL << EVENTS_BITS)
63 struct perf_kvm_stat
{
64 struct perf_tool tool
;
65 struct record_opts opts
;
66 struct perf_evlist
*evlist
;
67 struct perf_session
*session
;
69 const char *file_name
;
70 const char *report_event
;
74 struct exit_reasons_table
*exit_reasons
;
75 const char *exit_reasons_isa
;
77 struct kvm_events_ops
*events_ops
;
79 struct list_head kvm_events_cache
[EVENTS_CACHE_SIZE
];
87 struct intlist
*pid_list
;
89 struct rb_root result
;
92 unsigned int display_time
;
96 struct kvm_reg_events_ops
{
98 struct kvm_events_ops
*ops
;
101 void exit_event_get_key(struct perf_evsel
*evsel
,
102 struct perf_sample
*sample
,
103 struct event_key
*key
);
104 bool exit_event_begin(struct perf_evsel
*evsel
,
105 struct perf_sample
*sample
,
106 struct event_key
*key
);
107 bool exit_event_end(struct perf_evsel
*evsel
,
108 struct perf_sample
*sample
,
109 struct event_key
*key
);
110 void exit_event_decode_key(struct perf_kvm_stat
*kvm
,
111 struct event_key
*key
,
114 bool kvm_exit_event(struct perf_evsel
*evsel
);
115 bool kvm_entry_event(struct perf_evsel
*evsel
);
117 #define define_exit_reasons_table(name, symbols) \
118 static struct exit_reasons_table name[] = { \
119 symbols, { -1, NULL } \
123 * arch specific callbacks and data structures
125 int cpu_isa_init(struct perf_kvm_stat
*kvm
, const char *cpuid
);
127 extern const char * const kvm_events_tp
[];
128 extern struct kvm_reg_events_ops kvm_reg_events_ops
[];
130 #endif /* __PERF_KVM_STAT_H */