]>
git.proxmox.com Git - rustc.git/blob - src/libcompiler_builtins/compiler-rt/test/esan/TestCases/workingset-simple.cpp
1 // RUN: %clang_esan_wset -O0 %s -o %t 2>&1
2 // RUN: %run %t 2>&1 | FileCheck %s
4 // FIXME: Re-enable once PR33590 is fixed.
12 const int size
= 0x1 << 25; // 523288 cache lines
13 const int line_size
= 64;
15 int main(int argc
, char **argv
) {
16 char *bufA
= (char *)malloc(sizeof(char) * line_size
);
18 char *bufC
= (char *)mmap(0, size
, PROT_READ
| PROT_WRITE
,
19 MAP_PRIVATE
| MAP_ANONYMOUS
, -1, 0);
21 // This additional access to the same line should not increase the line
22 // count: but it's difficult to make a non-flaky test that measures the
23 // lines down to the ones digit so right now we're not really testing that.
24 // If we add a heap-only mode we may be able to be more precise.
27 for (int i
= 0; i
< size
; i
+= line_size
)
31 // CHECK: {{.*}} EfficiencySanitizer: the total working set size: 32 MB (524{{[0-9][0-9][0-9]}} cache lines)