0001
0002 #ifndef __PERF_MEM_EVENTS_H
0003 #define __PERF_MEM_EVENTS_H
0004
0005 #include <stdbool.h>
0006 #include <stdint.h>
0007 #include <stdio.h>
0008 #include <linux/types.h>
0009 #include <linux/refcount.h>
0010 #include <linux/perf_event.h>
0011 #include "stat.h"
0012 #include "evsel.h"
0013
0014 struct perf_mem_event {
0015 bool record;
0016 bool supported;
0017 const char *tag;
0018 const char *name;
0019 const char *sysfs_name;
0020 };
0021
0022 struct mem_info {
0023 struct addr_map_symbol iaddr;
0024 struct addr_map_symbol daddr;
0025 union perf_mem_data_src data_src;
0026 refcount_t refcnt;
0027 };
0028
0029 enum {
0030 PERF_MEM_EVENTS__LOAD,
0031 PERF_MEM_EVENTS__STORE,
0032 PERF_MEM_EVENTS__LOAD_STORE,
0033 PERF_MEM_EVENTS__MAX,
0034 };
0035
0036 extern unsigned int perf_mem_events__loads_ldlat;
0037
0038 int perf_mem_events__parse(const char *str);
0039 int perf_mem_events__init(void);
0040
0041 char *perf_mem_events__name(int i, char *pmu_name);
0042 struct perf_mem_event *perf_mem_events__ptr(int i);
0043 bool is_mem_loads_aux_event(struct evsel *leader);
0044
0045 void perf_mem_events__list(void);
0046 int perf_mem_events__record_args(const char **rec_argv, int *argv_nr,
0047 char **rec_tmp, int *tmp_nr);
0048
0049 int perf_mem__tlb_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
0050 int perf_mem__lvl_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
0051 int perf_mem__snp_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
0052 int perf_mem__lck_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
0053 int perf_mem__blk_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
0054
0055 int perf_script__meminfo_scnprintf(char *bf, size_t size, struct mem_info *mem_info);
0056
0057 struct c2c_stats {
0058 u32 nr_entries;
0059
0060 u32 locks;
0061 u32 store;
0062 u32 st_uncache;
0063 u32 st_noadrs;
0064 u32 st_l1hit;
0065 u32 st_l1miss;
0066 u32 st_na;
0067 u32 load;
0068 u32 ld_excl;
0069 u32 ld_shared;
0070 u32 ld_uncache;
0071 u32 ld_io;
0072 u32 ld_miss;
0073 u32 ld_noadrs;
0074 u32 ld_fbhit;
0075 u32 ld_l1hit;
0076 u32 ld_l2hit;
0077 u32 ld_llchit;
0078 u32 lcl_hitm;
0079 u32 rmt_hitm;
0080 u32 tot_hitm;
0081 u32 lcl_peer;
0082 u32 rmt_peer;
0083 u32 tot_peer;
0084 u32 rmt_hit;
0085 u32 lcl_dram;
0086 u32 rmt_dram;
0087 u32 blk_data;
0088 u32 blk_addr;
0089 u32 nomap;
0090 u32 noparse;
0091 };
0092
0093 struct hist_entry;
0094 int c2c_decode_stats(struct c2c_stats *stats, struct mem_info *mi);
0095 void c2c_add_stats(struct c2c_stats *stats, struct c2c_stats *add);
0096
0097 #endif