Refactors queue push pop
authorPeizhao Ou <peizhaoo@uci.edu>
Thu, 15 Feb 2018 07:15:33 +0000 (23:15 -0800)
committerPeizhao Ou <peizhaoo@uci.edu>
Thu, 15 Feb 2018 07:15:33 +0000 (23:15 -0800)
test/stress/queue/CMakeLists.txt
test/stress/queue/push_pop.cpp

index 5d392f8..f2e93b4 100644 (file)
@@ -39,9 +39,9 @@ set(CDSSTRESS_QUEUE_RANDOM_SOURCES
     ../main.cpp
     random.cpp
 )
-add_executable(${CDSSTRESS_QUEUE_RANDOM} ${CDSSTRESS_QUEUE_RANDOM_SOURCES})
-target_link_libraries(${CDSSTRESS_QUEUE_RANDOM} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
-add_test(NAME ${CDSSTRESS_QUEUE_RANDOM} COMMAND ${CDSSTRESS_QUEUE_RANDOM} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})    
+#add_executable(${CDSSTRESS_QUEUE_RANDOM} ${CDSSTRESS_QUEUE_RANDOM_SOURCES})
+#target_link_libraries(${CDSSTRESS_QUEUE_RANDOM} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
+#add_test(NAME ${CDSSTRESS_QUEUE_RANDOM} COMMAND ${CDSSTRESS_QUEUE_RANDOM} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})    
 
 # stress-queue-bounded
 set(CDSSTRESS_QUEUE_BOUNDED stress-queue-bounded)
index bf4d244..b12a199 100644 (file)
@@ -40,6 +40,7 @@ namespace {
     static size_t s_nConsumerThreadCount = 4;
     static size_t s_nProducerThreadCount = 4;
     static size_t s_nQueueSize = 4000000;
+    static size_t s_nVyukovQueueSize = 40000;
     static size_t s_nHeavyValueSize = 100;
 
     static std::atomic<size_t> s_nProducerDone( 0 );
@@ -325,6 +326,7 @@ namespace {
             s_nConsumerThreadCount = cfg.get_size_t( "ConsumerCount", s_nConsumerThreadCount );
             s_nProducerThreadCount = cfg.get_size_t( "ProducerCount", s_nProducerThreadCount );
             s_nQueueSize = cfg.get_size_t( "QueueSize", s_nQueueSize );
+            s_nVyukovQueueSize = cfg.get_size_t( "VyukovQueueSize", s_nVyukovQueueSize );
             s_nHeavyValueSize = cfg.get_size_t( "HeavyValueSize", s_nHeavyValueSize );
 
             if ( s_nConsumerThreadCount == 0u )
@@ -355,9 +357,12 @@ namespace {
 #define CDSSTRESS_Queue_F( test_fixture, type_name ) \
     TEST_F( test_fixture, type_name ) \
     { \
+        size_t old_queue_size = s_nQueueSize; \
+        s_nQueueSize = s_nVyukovQueueSize; \
         typedef queue::Types< value_type >::type_name queue_type; \
         queue_type queue( s_nQueueSize ); \
         test( queue ); \
+        s_nQueueSize = old_queue_size; \
     }
 
     CDSSTRESS_VyukovQueue( simple_queue_push_pop )