clk: samsung: Add bus clock for GPU/G3D on Exynos4412
[linux/fpc-iii.git] / tools / perf / tests / mem.c
blob0f82ee9fd3f722b9b59c45b9b5152e0696661aca
1 #include "util/mem-events.h"
2 #include "util/symbol.h"
3 #include "linux/perf_event.h"
4 #include "util/debug.h"
5 #include "tests.h"
6 #include <string.h>
8 static int check(union perf_mem_data_src data_src,
9 const char *string)
11 char out[100];
12 char failure[100];
13 struct mem_info mi = { .data_src = data_src };
15 int n;
17 n = perf_mem__snp_scnprintf(out, sizeof out, &mi);
18 n += perf_mem__lvl_scnprintf(out + n, sizeof out - n, &mi);
19 scnprintf(failure, sizeof failure, "unexpected %s", out);
20 TEST_ASSERT_VAL(failure, !strcmp(string, out));
21 return 0;
24 int test__mem(struct test *text __maybe_unused, int subtest __maybe_unused)
26 int ret = 0;
27 union perf_mem_data_src src;
29 memset(&src, 0, sizeof(src));
31 src.mem_lvl = PERF_MEM_LVL_HIT;
32 src.mem_lvl_num = 4;
34 ret |= check(src, "N/AL4 hit");
36 src.mem_remote = 1;
38 ret |= check(src, "N/ARemote L4 hit");
40 src.mem_lvl = PERF_MEM_LVL_MISS;
41 src.mem_lvl_num = PERF_MEM_LVLNUM_PMEM;
42 src.mem_remote = 0;
44 ret |= check(src, "N/APMEM miss");
46 src.mem_remote = 1;
48 ret |= check(src, "N/ARemote PMEM miss");
50 src.mem_snoopx = PERF_MEM_SNOOPX_FWD;
51 src.mem_lvl_num = PERF_MEM_LVLNUM_RAM;
53 ret |= check(src , "FwdRemote RAM miss");
55 return ret;