[compiler-rt] r202366 - tsan: add another deadlock detector benchmark
Dmitry Vyukov
dvyukov at google.com
Thu Feb 27 01:05:11 PST 2014
Author: dvyukov
Date: Thu Feb 27 03:05:07 2014
New Revision: 202366
URL: http://llvm.org/viewvc/llvm-project?rev=202366&view=rev
Log:
tsan: add another deadlock detector benchmark
Modified:
compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc
Modified: compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc?rev=202366&r1=202365&r2=202366&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc (original)
+++ compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc Thu Feb 27 03:05:07 2014
@@ -313,6 +313,34 @@ class LockTest {
}
}
+ void Test11() {
+ if (test_number > 0 && test_number != 11) return;
+ fprintf(stderr, "Starting Test11: 4 threads lock/unlock 4 private mutexes, all under another private mutex\n");
+ // CHECK: Starting Test10
+ Init(500);
+ // CHECK-NOT: WARNING: ThreadSanitizer:
+ RunThreads(&LockTest::Test11_Thread1, &LockTest::Test11_Thread2,
+ &LockTest::Test11_Thread3, &LockTest::Test11_Thread4);
+ }
+ void Test11_Thread1() { Test10_Thread(0); }
+ void Test11_Thread2() { Test10_Thread(10); }
+ void Test11_Thread3() { Test10_Thread(20); }
+ void Test11_Thread4() { Test10_Thread(30); }
+ void Test11_Thread(size_t m) {
+ for (int i = 0; i < iter_count; i++) {
+ L(m);
+ L(m + 100);
+ U(m + 100);
+ L(m + 200);
+ U(m + 200);
+ L(m + 300);
+ U(m + 300);
+ L(m + 400);
+ U(m + 500);
+ U(m);
+ }
+ }
+
private:
void Lock2(size_t l1, size_t l2) { L(l1); L(l2); U(l2); U(l1); }
void Lock_0_1() { Lock2(0, 1); }
@@ -387,6 +415,7 @@ int main(int argc, char **argv) {
LockTest().Test8();
LockTest().Test9();
LockTest().Test10();
+ LockTest().Test11();
fprintf(stderr, "ALL-DONE\n");
// CHECK: ALL-DONE
}
More information about the llvm-commits
mailing list