Jiri Olsa | acbe613 | 2016-02-15 09:34:34 +0100 | [diff] [blame] | 1 | #ifndef __PERF_MEM_EVENTS_H |
| 2 | #define __PERF_MEM_EVENTS_H |
| 3 | |
| 4 | #include <stdbool.h> |
Jiri Olsa | aadddd6 | 2016-09-22 17:36:30 +0200 | [diff] [blame] | 5 | #include <stdint.h> |
| 6 | #include <stdio.h> |
| 7 | #include <linux/types.h> |
| 8 | #include "stat.h" |
Jiri Olsa | acbe613 | 2016-02-15 09:34:34 +0100 | [diff] [blame] | 9 | |
| 10 | struct perf_mem_event { |
| 11 | bool record; |
Jiri Olsa | 54fbad5 | 2016-02-24 09:46:42 +0100 | [diff] [blame] | 12 | bool supported; |
Jiri Olsa | ce1e22b | 2016-02-15 09:34:35 +0100 | [diff] [blame] | 13 | const char *tag; |
Jiri Olsa | acbe613 | 2016-02-15 09:34:34 +0100 | [diff] [blame] | 14 | const char *name; |
Jiri Olsa | 54fbad5 | 2016-02-24 09:46:42 +0100 | [diff] [blame] | 15 | const char *sysfs_name; |
Jiri Olsa | acbe613 | 2016-02-15 09:34:34 +0100 | [diff] [blame] | 16 | }; |
| 17 | |
| 18 | enum { |
| 19 | PERF_MEM_EVENTS__LOAD, |
| 20 | PERF_MEM_EVENTS__STORE, |
| 21 | PERF_MEM_EVENTS__MAX, |
| 22 | }; |
| 23 | |
| 24 | extern struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX]; |
Jiri Olsa | b0d745b | 2016-06-14 20:19:11 +0200 | [diff] [blame] | 25 | extern unsigned int perf_mem_events__loads_ldlat; |
Jiri Olsa | acbe613 | 2016-02-15 09:34:34 +0100 | [diff] [blame] | 26 | |
Jiri Olsa | ce1e22b | 2016-02-15 09:34:35 +0100 | [diff] [blame] | 27 | int perf_mem_events__parse(const char *str); |
Jiri Olsa | 54fbad5 | 2016-02-24 09:46:42 +0100 | [diff] [blame] | 28 | int perf_mem_events__init(void); |
Jiri Olsa | ce1e22b | 2016-02-15 09:34:35 +0100 | [diff] [blame] | 29 | |
Jiri Olsa | 2ba7ac5 | 2016-02-24 09:46:43 +0100 | [diff] [blame] | 30 | char *perf_mem_events__name(int i); |
Jiri Olsa | 0c877d7 | 2016-02-24 09:46:46 +0100 | [diff] [blame] | 31 | |
| 32 | struct mem_info; |
Jiri Olsa | b1a5fbea | 2016-02-24 09:46:50 +0100 | [diff] [blame] | 33 | int perf_mem__tlb_scnprintf(char *out, size_t sz, struct mem_info *mem_info); |
Jiri Olsa | 9690756 | 2016-02-24 09:46:51 +0100 | [diff] [blame] | 34 | int perf_mem__lvl_scnprintf(char *out, size_t sz, struct mem_info *mem_info); |
Jiri Olsa | 149d750 | 2016-02-24 09:46:52 +0100 | [diff] [blame] | 35 | int perf_mem__snp_scnprintf(char *out, size_t sz, struct mem_info *mem_info); |
Jiri Olsa | 8b0819c | 2016-02-24 09:46:53 +0100 | [diff] [blame] | 36 | int perf_mem__lck_scnprintf(char *out, size_t sz, struct mem_info *mem_info); |
Jiri Olsa | 69a7727 | 2016-02-24 09:46:49 +0100 | [diff] [blame] | 37 | |
Jiri Olsa | c19ac91 | 2016-02-24 09:46:54 +0100 | [diff] [blame] | 38 | int perf_script__meminfo_scnprintf(char *bf, size_t size, struct mem_info *mem_info); |
| 39 | |
Jiri Olsa | aadddd6 | 2016-09-22 17:36:30 +0200 | [diff] [blame] | 40 | struct c2c_stats { |
| 41 | u32 nr_entries; |
| 42 | |
| 43 | u32 locks; /* count of 'lock' transactions */ |
| 44 | u32 store; /* count of all stores in trace */ |
| 45 | u32 st_uncache; /* stores to uncacheable address */ |
| 46 | u32 st_noadrs; /* cacheable store with no address */ |
| 47 | u32 st_l1hit; /* count of stores that hit L1D */ |
| 48 | u32 st_l1miss; /* count of stores that miss L1D */ |
| 49 | u32 load; /* count of all loads in trace */ |
| 50 | u32 ld_excl; /* exclusive loads, rmt/lcl DRAM - snp none/miss */ |
| 51 | u32 ld_shared; /* shared loads, rmt/lcl DRAM - snp hit */ |
| 52 | u32 ld_uncache; /* loads to uncacheable address */ |
| 53 | u32 ld_io; /* loads to io address */ |
| 54 | u32 ld_miss; /* loads miss */ |
| 55 | u32 ld_noadrs; /* cacheable load with no address */ |
| 56 | u32 ld_fbhit; /* count of loads hitting Fill Buffer */ |
| 57 | u32 ld_l1hit; /* count of loads that hit L1D */ |
| 58 | u32 ld_l2hit; /* count of loads that hit L2D */ |
| 59 | u32 ld_llchit; /* count of loads that hit LLC */ |
| 60 | u32 lcl_hitm; /* count of loads with local HITM */ |
| 61 | u32 rmt_hitm; /* count of loads with remote HITM */ |
| 62 | u32 rmt_hit; /* count of loads with remote hit clean; */ |
| 63 | u32 lcl_dram; /* count of loads miss to local DRAM */ |
| 64 | u32 rmt_dram; /* count of loads miss to remote DRAM */ |
| 65 | u32 nomap; /* count of load/stores with no phys adrs */ |
| 66 | u32 noparse; /* count of unparsable data sources */ |
| 67 | }; |
| 68 | |
| 69 | struct hist_entry; |
| 70 | int c2c_decode_stats(struct c2c_stats *stats, struct mem_info *mi); |
Jiri Olsa | 0a9a24c | 2016-09-22 17:36:31 +0200 | [diff] [blame^] | 71 | void c2c_add_stats(struct c2c_stats *stats, struct c2c_stats *add); |
Jiri Olsa | aadddd6 | 2016-09-22 17:36:30 +0200 | [diff] [blame] | 72 | |
Jiri Olsa | acbe613 | 2016-02-15 09:34:34 +0100 | [diff] [blame] | 73 | #endif /* __PERF_MEM_EVENTS_H */ |