summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/esan/TestCases/workingset-memset.cpp
diff options
context:
space:
mode:
authorDerek Bruening <bruening@google.com>2016-05-25 02:04:04 +0000
committerDerek Bruening <bruening@google.com>2016-05-25 02:04:04 +0000
commit88639859dbd9a62267d949d3fd1eae3028d802c6 (patch)
tree6106ff216dc95342639cd8d1f1f6abc3301c1b64 /compiler-rt/test/esan/TestCases/workingset-memset.cpp
parentdc8842eb7f60ee4033520c82ad415961ce23aae6 (diff)
downloadbcm5719-llvm-88639859dbd9a62267d949d3fd1eae3028d802c6.tar.gz
bcm5719-llvm-88639859dbd9a62267d949d3fd1eae3028d802c6.zip
Add working set base runtime library
Summary: Adds the base runtime library for the working set tool. Adds slowpath code for updating the shadow memory. To be added in the future: + Scan memory and report the total size. + Take samples for intermediate values. Reviewers: aizatsky Subscribers: kubabrecka, vitalybuka, zhaoqin, kcc, eugenis, llvm-commits Differential Revision: http://reviews.llvm.org/D20485 llvm-svn: 270650
Diffstat (limited to 'compiler-rt/test/esan/TestCases/workingset-memset.cpp')
-rw-r--r--compiler-rt/test/esan/TestCases/workingset-memset.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler-rt/test/esan/TestCases/workingset-memset.cpp b/compiler-rt/test/esan/TestCases/workingset-memset.cpp
new file mode 100644
index 00000000000..a0c36e3aebc
--- /dev/null
+++ b/compiler-rt/test/esan/TestCases/workingset-memset.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_esan_wset -O0 %s -o %t 2>&1
+// RUN: %run %t 2>&1 | FileCheck %s
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <assert.h>
+#include <string.h>
+
+int main(int argc, char **argv) {
+ const int size = 128*1024*1024;
+ char *p = (char *)mmap(0, size, PROT_READ | PROT_WRITE,
+ MAP_ANON | MAP_PRIVATE, -1, 0);
+ // Test the slowpath at different cache line boundaries.
+ for (int i = 0; i < 630; i++)
+ memset((char *)p + 63*i, i, 63*i);
+ munmap(p, size);
+ return 0;
+ // FIXME: once the memory scan and size report is in place add it here.
+ // CHECK: {{.*}}EfficiencySanitizer is not finished: nothing yet to report
+}
OpenPOWER on IntegriCloud