Refactors RCU test cases
authorPeizhao Ou <peizhaoo@uci.edu>
Wed, 7 Feb 2018 23:19:04 +0000 (15:19 -0800)
committerPeizhao Ou <peizhaoo@uci.edu>
Wed, 7 Feb 2018 23:19:04 +0000 (15:19 -0800)
folly/stress-test/clean.sh
folly/stress-test/stress-sequential-folly-sync.cpp

index 8144dba8eb57f6786cdf04a48ad21782b49feaca..19a24e7079d4c3df0651bcc60c558fb9542ac75c 100755 (executable)
@@ -1,6 +1,10 @@
 #!/bin/bash -e
 
 #!/bin/bash -e
 
-Benchmarks=(stress-sequential-folly-map)
+Benchmarks=(
+    stress-sequential-folly-queue
+    stress-sequential-folly-map
+    stress-sequential-folly-sync
+)
 
 for bench in ${Benchmarks[*]}; do
   rm -rf $bench ${bench}.bc ${bench}.o
 
 for bench in ${Benchmarks[*]}; do
   rm -rf $bench ${bench}.bc ${bench}.o
index 0b849c50d77c75d19f169b3a860245ce74a730b3..dbedef056312569483becf42445c344aaeaef8b3 100644 (file)
@@ -49,8 +49,8 @@ typedef folly::RWTicketSpinLock32 RWTicketSpinLock32;
 typedef folly::RWTicketSpinLock64 RWTicketSpinLock64;
 
 // RCU
 typedef folly::RWTicketSpinLock64 RWTicketSpinLock64;
 
 // RCU
-const size_t kRcuSyncPassCount = 3000000;
-const size_t kRcuNoSyncPassCount = 2500000;
+const size_t kRcuSyncPassCount = 180000;
+const size_t kRcuNoSyncPassCount = 3500000;
 const char* kRcuSyncBenchmarkName = "FollyRCU_Sync";
 const char* kRcuNoSyncBenchmarkName = "FollyRCU_NoSync";
 // Represent the RCU-protected data.
 const char* kRcuSyncBenchmarkName = "FollyRCU_Sync";
 const char* kRcuNoSyncBenchmarkName = "FollyRCU_NoSync";
 // Represent the RCU-protected data.
@@ -65,10 +65,18 @@ void run_rcu_sync(size_t pass_count, const char* bench_name) {
   std::cout << "[ RUN      ] " << kTestName << "." << bench_name << std::endl;
   auto start_time = std::chrono::system_clock::now();
 
   std::cout << "[ RUN      ] " << kTestName << "." << bench_name << std::endl;
   auto start_time = std::chrono::system_clock::now();
 
-  for (size_t count = 0; count < pass_count; count++) {
-    RcuFoo* f = new RcuFoo();
-    folly::rcu_retire(f);
-    folly::synchronize_rcu();
+  for (int write_percentage = 1; write_percentage <= 5; write_percentage += 1) {
+    for (size_t count = 0; count < pass_count; count++) {
+      for (int i = 0; i < 100; ++i) {
+        if (i < write_percentage) {
+          RcuFoo* f = new RcuFoo();
+          folly::rcu_retire(f);
+          folly::synchronize_rcu();
+        } else {
+          folly::rcu_reader g;
+        }
+      }
+    }
   }
 
   auto finish_time = std::chrono::system_clock::now();
   }
 
   auto finish_time = std::chrono::system_clock::now();
@@ -82,7 +90,7 @@ void run_rcu_no_sync(size_t pass_count, const char* bench_name) {
   std::cout << "[ RUN      ] " << kTestName << "." << bench_name << std::endl;
   auto start_time = std::chrono::system_clock::now();
 
   std::cout << "[ RUN      ] " << kTestName << "." << bench_name << std::endl;
   auto start_time = std::chrono::system_clock::now();
 
-  for (int write_percentage = 5; write_percentage <= 10; write_percentage += 1) {
+  for (int write_percentage = 1; write_percentage <= 5; write_percentage += 1) {
     for (size_t count = 0; count < pass_count; count++) {
       for (int i = 0; i < 100; ++i) {
         if (i < write_percentage) {
     for (size_t count = 0; count < pass_count; count++) {
       for (int i = 0; i < 100; ++i) {
         if (i < write_percentage) {