CCTLib
Calling-context and data-object attribution library for Intel Pin
rec_baseline_nonrec.cpp
Go to the documentation of this file.
1 // Control: purely iterative workload, no recursion. Locks in the
2 // zero-overhead-on-non-recursive-path contract from constraint #1 of
3 // the design. If this test's report diverges from the pre-change
4 // baseline for any of the three clients, we introduced runtime cost
5 // (or worse, a correctness bug) on code that doesn't recurse at all.
6 //
7 // The test that consumes this victim compares only "runs cleanly"
8 // today; byte-identical report validation across the whole suite is
9 // covered by the deadspy/redspy/loadspy integration tests already in
10 // the tree -- adding one more recursion-free workload here ensures
11 // the recursion classifier's presence doesn't shift attribution for
12 // non-recursive code.
13 #include <cstdint>
14 #include <cstdio>
15 
16 static volatile uint64_t sink;
17 static uint64_t buf[4096];
18 
19 int main(int argc, char** argv) {
20  (void)argc; (void)argv;
21  for (int outer = 0; outer < 1000; ++outer) {
22  for (int i = 0; i < 4096; ++i) {
23  buf[i] = (uint64_t)outer * (uint64_t)i;
24  }
25  for (int i = 0; i < 4096; ++i) {
26  sink ^= buf[i];
27  }
28  }
29  fprintf(stderr, "rec_baseline_nonrec: sink=%llx\n",
30  (unsigned long long)sink);
31  return 0;
32 }
static void outer(int i)
int main(int argc, char **argv)
static uint64_t buf[4096]
static volatile uint64_t sink