CCTLib
Calling-context and data-object attribution library for Intel Pin
footprint_large.c
Go to the documentation of this file.
1 // Footprint victim: LARGE footprint. Load from N distinct addresses in a
2 // stride-1 sweep so each iteration touches a fresh 8-byte slot.
3 #include <stdint.h>
4 
5 #define N 100000
6 
7 static volatile uint64_t sink;
8 static uint64_t buf[N];
9 
10 int main(int argc, char** argv) {
11  (void)argc; (void)argv;
12  // Prime.
13  for (int i = 0; i < N; ++i) buf[i] = (uint64_t)i;
14 
15  uint64_t acc = 0;
16  for (int i = 0; i < N; ++i) {
17  volatile uint64_t* p = &buf[i];
18  uint64_t v;
19  __asm__ __volatile__ ("movq (%1), %0" : "=r"(v) : "r"(p) : "memory");
20  acc += v;
21  }
22  sink = acc;
23  return 0;
24 }
#define N
int main(int argc, char **argv)
static uint64_t buf[N]
static volatile uint64_t sink