1
2 #ifndef __PERF_MEM_EVENTS_H
3 #define __PERF_MEM_EVENTS_H
4
5 #include <stdbool.h>
6 #include <stdint.h>
7 #include <stdio.h>
8 #include <linux/types.h>
9 #include <linux/refcount.h>
10 #include <linux/perf_event.h>
11 #include "stat.h"
12
13 struct perf_mem_event {
14 bool record;
15 bool supported;
16 const char *tag;
17 const char *name;
18 const char *sysfs_name;
19 };
20
21 struct mem_info {
22 struct addr_map_symbol iaddr;
23 struct addr_map_symbol daddr;
24 union perf_mem_data_src data_src;
25 refcount_t refcnt;
26 };
27
28 enum {
29 PERF_MEM_EVENTS__LOAD,
30 PERF_MEM_EVENTS__STORE,
31 PERF_MEM_EVENTS__MAX,
32 };
33
34 extern struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX];
35 extern unsigned int perf_mem_events__loads_ldlat;
36
37 int perf_mem_events__parse(const char *str);
38 int perf_mem_events__init(void);
39
40 char *perf_mem_events__name(int i);
41
42 struct mem_info;
43 int perf_mem__tlb_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
44 int perf_mem__lvl_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
45 int perf_mem__snp_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
46 int perf_mem__lck_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
47
48 int perf_script__meminfo_scnprintf(char *bf, size_t size, struct mem_info *mem_info);
49
50 struct c2c_stats {
51 u32 nr_entries;
52
53 u32 locks;
54 u32 store;
55 u32 st_uncache;
56 u32 st_noadrs;
57 u32 st_l1hit;
58 u32 st_l1miss;
59 u32 load;
60 u32 ld_excl;
61 u32 ld_shared;
62 u32 ld_uncache;
63 u32 ld_io;
64 u32 ld_miss;
65 u32 ld_noadrs;
66 u32 ld_fbhit;
67 u32 ld_l1hit;
68 u32 ld_l2hit;
69 u32 ld_llchit;
70 u32 lcl_hitm;
71 u32 rmt_hitm;
72 u32 tot_hitm;
73 u32 rmt_hit;
74 u32 lcl_dram;
75 u32 rmt_dram;
76 u32 nomap;
77 u32 noparse;
78 };
79
80 struct hist_entry;
81 int c2c_decode_stats(struct c2c_stats *stats, struct mem_info *mi);
82 void c2c_add_stats(struct c2c_stats *stats, struct c2c_stats *add);
83
84 #endif