[compiler-rt] r274669 - [esan|wset] Further reduce flakiness of sampling test

Derek Bruening via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 6 13:27:45 PDT 2016


Author: bruening
Date: Wed Jul  6 15:27:44 2016
New Revision: 274669

URL: http://llvm.org/viewvc/llvm-project?rev=274669&view=rev
Log:
[esan|wset] Further reduce flakiness of sampling test

Enhances the sampling test to try and reduce flakiness further by
increasing the workload to ensure a few samples are gathered.

Modified:
    compiler-rt/trunk/test/esan/TestCases/workingset-samples.cpp

Modified: compiler-rt/trunk/test/esan/TestCases/workingset-samples.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/esan/TestCases/workingset-samples.cpp?rev=274669&r1=274668&r2=274669&view=diff
==============================================================================
--- compiler-rt/trunk/test/esan/TestCases/workingset-samples.cpp (original)
+++ compiler-rt/trunk/test/esan/TestCases/workingset-samples.cpp Wed Jul  6 15:27:44 2016
@@ -7,6 +7,7 @@
 #include <sys/mman.h>
 
 const int size = 0x1 << 25; // 523288 cache lines
+const int iters = 6;
 
 int main(int argc, char **argv) {
   char *buf = (char *)mmap(0, size, PROT_READ | PROT_WRITE,
@@ -15,9 +16,12 @@ int main(int argc, char **argv) {
   // scheduled.  Unfortunately we can't do proper synchronization
   // without some form of annotation or something.
   sched_yield();
-  // Do enough work to get at least 2 samples.
-  for (int i = 0; i < size; ++i)
-    buf[i] = i;
+  // Do enough work to get at least 4 samples.
+  for (int j = 0; j < iters; ++j) {
+    for (int i = 0; i < size; ++i)
+      buf[i] = i;
+    sched_yield();
+  }
   munmap(buf, size);
   // We only check for a few samples here to reduce the chance of flakiness.
   // CHECK:      =={{[0-9]+}}== Total number of samples: {{[0-9]+}}




More information about the llvm-commits mailing list