History

tools/perf: Add mem_hops field in perf_mem_data_src structure

Going forward, future generation systems can have more hierarchy within the node/package level but currently we don't have any data source encoding field in perf, which can be used to represent this level of data. Add a new field called 'mem_hops' in the perf_mem_data_src structure which can be used to represent intra-node/package or inter-node/off-package details. This field is of size 3 bits where PERF_MEM_HOPS_{NA, 0..6} value can be used to present different hop levels data. Also add corresponding macros to define mem_hop field values and shift value. Currently we define macro for HOPS_0 which corresponds to data coming from another core but same node. Add functionality to represent mem_hop field data in perf_mem__lvl_scnprintf function with the help of added string array called mem_hops. For ex: Encodings for mem_hops fields with L2 cache: L2 - local L2 L2 | REMOTE | HOPS_0 - remote core, same node L2 Since with the addition of HOPS field, now remote can be used to denote cache access from the same node but different core, a check is added in the c2c_decode_stats function to set mrem only when HOPS is zero along with set remote field.

Kajol Jain committed 5 years ago

Commit cae1d751 parent fec9cc62 files · +27 −3Browse files

Showing the changes to tools/include/uapi/linux (1 of 2 files). Show all

Unified · Split

tools/include/uapi/linux/perf_event.h+9−2
@@ -1210,14 +1210,16 @@ union perf_mem_data_src { · 1209 unmodified lines
12101210 mem_remote:1, /* remote */
12111211 mem_snoopx:2, /* snoop mode, ext */
12121212 mem_blk:3, /* access blocked */
1213− mem_rsvd:21;
1213+ mem_hops:3, /* hop level */
1214+ mem_rsvd:18;
12141215 };
12151216 };
12161217 #elif defined(__BIG_ENDIAN_BITFIELD)
12171218 union perf_mem_data_src {
12181219 __u64 val;
12191220 struct {
1220− __u64 mem_rsvd:21,
1221+ __u64 mem_rsvd:18,
1222+ mem_hops:3, /* hop level */
12211223 mem_blk:3, /* access blocked */
12221224 mem_snoopx:2, /* snoop mode, ext */
12231225 mem_remote:1, /* remote */
@@ -1313,6 +1315,11 @@ union perf_mem_data_src { · 89 unmodified lines
13131315 #define PERF_MEM_BLK_ADDR 0x04 /* address conflict */
13141316 #define PERF_MEM_BLK_SHIFT 40
13151317
1318+/* hop level */
1319+#define PERF_MEM_HOPS_0 0x01 /* remote core, same node */
1320+/* 2-7 available */
1321+#define PERF_MEM_HOPS_SHIFT 43
1322+
13161323 #define PERF_MEM_S(a, s) \
13171324 (((__u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT)
13181325