Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
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;               /* count of 'lock' transactions */
0061     u32 store;               /* count of all stores in trace */
0062     u32 st_uncache;          /* stores to uncacheable address */
0063     u32 st_noadrs;           /* cacheable store with no address */
0064     u32 st_l1hit;            /* count of stores that hit L1D */
0065     u32 st_l1miss;           /* count of stores that miss L1D */
0066     u32 st_na;               /* count of stores with memory level is not available */
0067     u32 load;                /* count of all loads in trace */
0068     u32 ld_excl;             /* exclusive loads, rmt/lcl DRAM - snp none/miss */
0069     u32 ld_shared;           /* shared loads, rmt/lcl DRAM - snp hit */
0070     u32 ld_uncache;          /* loads to uncacheable address */
0071     u32 ld_io;               /* loads to io address */
0072     u32 ld_miss;             /* loads miss */
0073     u32 ld_noadrs;           /* cacheable load with no address */
0074     u32 ld_fbhit;            /* count of loads hitting Fill Buffer */
0075     u32 ld_l1hit;            /* count of loads that hit L1D */
0076     u32 ld_l2hit;            /* count of loads that hit L2D */
0077     u32 ld_llchit;           /* count of loads that hit LLC */
0078     u32 lcl_hitm;            /* count of loads with local HITM  */
0079     u32 rmt_hitm;            /* count of loads with remote HITM */
0080     u32 tot_hitm;            /* count of loads with local and remote HITM */
0081     u32 lcl_peer;            /* count of loads with local peer cache */
0082     u32 rmt_peer;            /* count of loads with remote peer cache */
0083     u32 tot_peer;            /* count of loads with local and remote peer cache */
0084     u32 rmt_hit;             /* count of loads with remote hit clean; */
0085     u32 lcl_dram;            /* count of loads miss to local DRAM */
0086     u32 rmt_dram;            /* count of loads miss to remote DRAM */
0087     u32 blk_data;            /* count of loads blocked by data */
0088     u32 blk_addr;            /* count of loads blocked by address conflict */
0089     u32 nomap;               /* count of load/stores with no phys addrs */
0090     u32 noparse;             /* count of unparsable data sources */
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 /* __PERF_MEM_EVENTS_H */