Linux Perf
mem-events.c File Reference
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <api/fs/fs.h>
#include <linux/kernel.h>
#include "mem-events.h"
#include "debug.h"
#include "symbol.h"
#include "sort.h"
Include dependency graph for mem-events.c:

Go to the source code of this file.

Macros

#define E(t, n, s)   { .tag = t, .name = n, .sysfs_name = s }
 
#define HITM_INC(__f)
 
#define P(a, b)   PERF_MEM_##a##_##b
 

Functions

char * perf_mem_events__name (int i)
 
int perf_mem_events__parse (const char *str)
 
int perf_mem_events__init (void)
 
int perf_mem__tlb_scnprintf (char *out, size_t sz, struct mem_info *mem_info)
 
int perf_mem__lvl_scnprintf (char *out, size_t sz, struct mem_info *mem_info)
 
int perf_mem__snp_scnprintf (char *out, size_t sz, struct mem_info *mem_info)
 
int perf_mem__lck_scnprintf (char *out, size_t sz, struct mem_info *mem_info)
 
int perf_script__meminfo_scnprintf (char *out, size_t sz, struct mem_info *mem_info)
 
int c2c_decode_stats (struct c2c_stats *stats, struct mem_info *mi)
 
void c2c_add_stats (struct c2c_stats *stats, struct c2c_stats *add)
 

Variables

unsigned int perf_mem_events__loads_ldlat = 30
 
struct perf_mem_event perf_mem_events [PERF_MEM_EVENTS__MAX]
 
static char mem_loads_name [100]
 
static bool mem_loads_name__init
 
static const char *const tlb_access []
 
static const char *const mem_lvl []
 
static const char *const mem_lvlnum []
 
static const char *const snoop_access []
 

Macro Definition Documentation

◆ E

#define E (   t,
  n,
 
)    { .tag = t, .name = n, .sysfs_name = s }

Definition at line 18 of file mem-events.c.

◆ HITM_INC

#define HITM_INC (   __f)
Value:
do { \
stats->__f++; \
stats->tot_hitm++; \
} while (0)

◆ P

#define P (   a,
 
)    PERF_MEM_##a##_##b

Function Documentation

◆ c2c_add_stats()

void c2c_add_stats ( struct c2c_stats stats,
struct c2c_stats add 
)

Definition at line 423 of file mem-events.c.

◆ c2c_decode_stats()

int c2c_decode_stats ( struct c2c_stats stats,
struct mem_info mi 
)

Definition at line 312 of file mem-events.c.

◆ perf_mem__lck_scnprintf()

int perf_mem__lck_scnprintf ( char *  out,
size_t  sz,
struct mem_info mem_info 
)

Definition at line 279 of file mem-events.c.

◆ perf_mem__lvl_scnprintf()

int perf_mem__lvl_scnprintf ( char *  out,
size_t  sz,
struct mem_info mem_info 
)

Definition at line 178 of file mem-events.c.

◆ perf_mem__snp_scnprintf()

int perf_mem__snp_scnprintf ( char *  out,
size_t  sz,
struct mem_info mem_info 
)

Definition at line 244 of file mem-events.c.

◆ perf_mem__tlb_scnprintf()

int perf_mem__tlb_scnprintf ( char *  out,
size_t  sz,
struct mem_info mem_info 
)

Definition at line 116 of file mem-events.c.

◆ perf_mem_events__init()

int perf_mem_events__init ( void  )

Definition at line 82 of file mem-events.c.

◆ perf_mem_events__name()

char* perf_mem_events__name ( int  i)

Definition at line 31 of file mem-events.c.

◆ perf_mem_events__parse()

int perf_mem_events__parse ( const char *  str)

Definition at line 46 of file mem-events.c.

Here is the call graph for this function:

◆ perf_script__meminfo_scnprintf()

int perf_script__meminfo_scnprintf ( char *  out,
size_t  sz,
struct mem_info mem_info 
)

Definition at line 297 of file mem-events.c.

Here is the call graph for this function:

Variable Documentation

◆ mem_loads_name

char mem_loads_name[100]
static

Definition at line 28 of file mem-events.c.

◆ mem_loads_name__init

bool mem_loads_name__init
static

Definition at line 29 of file mem-events.c.

◆ mem_lvl

const char* const mem_lvl[]
static
Initial value:
= {
"N/A",
"HIT",
"MISS",
"L1",
"LFB",
"L2",
"L3",
"Local RAM",
"Remote RAM (1 hop)",
"Remote RAM (2 hops)",
"Remote Cache (1 hop)",
"Remote Cache (2 hops)",
"I/O",
"Uncached",
}

Definition at line 153 of file mem-events.c.

◆ mem_lvlnum

const char* const mem_lvlnum[]
static
Initial value:
= {
[PERF_MEM_LVLNUM_ANY_CACHE] = "Any cache",
[PERF_MEM_LVLNUM_LFB] = "LFB",
[PERF_MEM_LVLNUM_RAM] = "RAM",
[PERF_MEM_LVLNUM_PMEM] = "PMEM",
[PERF_MEM_LVLNUM_NA] = "N/A",
}

Definition at line 170 of file mem-events.c.

◆ perf_mem_events

struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX]
Initial value:
= {
E("ldlat-loads", "cpu/mem-loads,ldlat=%u/P", "mem-loads"),
E("ldlat-stores", "cpu/mem-stores/P", "mem-stores"),
}
#define E(t, n, s)
Definition: mem-events.c:18

Definition at line 20 of file mem-events.c.

◆ perf_mem_events__loads_ldlat

unsigned int perf_mem_events__loads_ldlat = 30

Definition at line 16 of file mem-events.c.

◆ snoop_access

const char* const snoop_access[]
static
Initial value:
= {
"N/A",
"None",
"Hit",
"Miss",
"HitM",
}

Definition at line 236 of file mem-events.c.

◆ tlb_access

const char* const tlb_access[]
static
Initial value:
= {
"N/A",
"HIT",
"MISS",
"L1",
"L2",
"Walker",
"Fault",
}

Definition at line 106 of file mem-events.c.