Improved output of stress test stat
authorkhizmax <libcds.dev@gmail.com>
Sun, 30 Oct 2016 21:11:01 +0000 (00:11 +0300)
committerkhizmax <libcds.dev@gmail.com>
Sun, 30 Oct 2016 21:11:01 +0000 (00:11 +0300)
test/include/cds_test/stress_test.h
test/stress/framework/stress_test.cpp
test/stress/map/map_type_split_list.h
test/stress/set/set_type_split_list.h

index e948664..c6f4900 100644 (file)
@@ -115,10 +115,34 @@ namespace cds_test {
         friend class config_file;
     };
 
-    struct property_stream;
+    class property_stream
+    {
+    public:
+        static std::string const& stat_prefix();
+        static void set_stat_prefix( char const* prefix );
+    };
+
+    struct stat_prefix
+    {
+        char const* prefix_;
+
+        stat_prefix()
+            : prefix_( nullptr )
+        {}
+
+        stat_prefix( char const* prefix )
+            : prefix_( prefix )
+        {}
+    };
+
+    static inline property_stream& operator<<( property_stream& s, stat_prefix&& prefix )
+    {
+        s.set_stat_prefix( prefix.prefix_ );
+        return s;
+    }
 
     template <typename T>
-    static inline property_stream& operator <<( property_stream& s, std::pair<char const *, T > prop )
+    static inline property_stream& operator <<( property_stream& s, std::pair<char const*, T > prop )
     {
         std::stringstream ss;
         ss << prop.second;
@@ -135,7 +159,7 @@ namespace cds_test {
         return s;
     }
 
-    static inline property_stream& operator <<( property_stream& s, std::pair<char const *, std::chrono::milliseconds > prop )
+    static inline property_stream& operator <<( property_stream& s, std::pair<char const*, std::chrono::milliseconds > prop )
     {
         std::stringstream ss;
         ss << prop.second.count();
@@ -144,7 +168,7 @@ namespace cds_test {
     }
 
 #define CDSSTRESS_STAT_OUT_( name, val ) std::make_pair( name, val )
-#define CDSSTRESS_STAT_OUT( s, field ) CDSSTRESS_STAT_OUT_( "stat." #field, s.field.get())
+#define CDSSTRESS_STAT_OUT( s, field ) CDSSTRESS_STAT_OUT_( property_stream::stat_prefix() + "." #field, s.field.get())
 
     class stress_fixture : public fixture
     {
index b4a7e5f..2209079 100644 (file)
 \r
 namespace cds_test {\r
 \r
-    struct property_stream\r
-    {};\r
+    static std::string s_stat_prefix( "stat" );\r
+\r
+    /*static*/ std::string const& property_stream::stat_prefix()\r
+    {\r
+        return s_stat_prefix;\r
+    }\r
+\r
+    /*static*/ void property_stream::set_stat_prefix( char const* prefix )\r
+    {\r
+        if ( prefix && prefix[0] )\r
+            s_stat_prefix = prefix;\r
+        else\r
+            s_stat_prefix = "stat";\r
+    }\r
 \r
     /*static*/ property_stream& stress_fixture::propout()\r
     {\r
index 93ff510..77efadc 100644 (file)
@@ -153,6 +153,10 @@ namespace map {
         struct traits_SplitList_Michael_dyn_cmp_stat : public traits_SplitList_Michael_dyn_cmp
         {
             typedef cc::split_list::stat<> stat;
+            typedef typename cc::michael_list::make_traits<
+                co::compare< compare >
+                ,co::stat< cc::michael_list::stat<> >
+            >::type ordered_list_traits;
         };
         typedef SplitListMap< cds::gc::HP, Key, Value, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_HP_dyn_cmp_stat;
         typedef SplitListMap< cds::gc::DHP, Key, Value, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_DHP_dyn_cmp_stat;
@@ -258,6 +262,11 @@ namespace map {
         struct traits_SplitList_Michael_st_less_stat : traits_SplitList_Michael_st_less
         {
             typedef cc::split_list::stat<> stat;
+            typedef typename cc::michael_list::make_traits<
+                co::less< less >
+                , co::stat< cc::michael_list::stat<> >
+            >::type ordered_list_traits;
+
         };
         typedef SplitListMap< cds::gc::HP, Key, Value, traits_SplitList_Michael_st_less_stat > SplitList_Michael_HP_st_less_stat;
         typedef SplitListMap< cds::gc::DHP, Key, Value, traits_SplitList_Michael_st_less_stat > SplitList_Michael_DHP_st_less_stat;
@@ -299,6 +308,10 @@ namespace map {
         struct SplitList_Lazy_dyn_cmp_stat : public SplitList_Lazy_dyn_cmp
         {
             typedef cc::split_list::stat<> stat;
+            typedef typename cc::lazy_list::make_traits<
+                co::compare< compare >
+                , co::stat< cc::lazy_list::stat<>>
+            >::type ordered_list_traits;
         };
         typedef SplitListMap< cds::gc::HP, Key, Value, SplitList_Lazy_dyn_cmp_stat > SplitList_Lazy_HP_dyn_cmp_stat;
         typedef SplitListMap< cds::gc::DHP, Key, Value, SplitList_Lazy_dyn_cmp_stat > SplitList_Lazy_DHP_dyn_cmp_stat;
@@ -407,6 +420,10 @@ namespace map {
         struct SplitList_Lazy_st_less_stat : public SplitList_Lazy_st_less
         {
             typedef cc::split_list::stat<> stat;
+            typedef typename cc::lazy_list::make_traits<
+                co::less< less >
+                , co::stat< cc::lazy_list::stat<>>
+            >::type ordered_list_traits;
         };
         typedef SplitListMap< cds::gc::HP, Key, Value, SplitList_Lazy_st_less_stat > SplitList_Lazy_HP_st_less_stat;
         typedef SplitListMap< cds::gc::DHP, Key, Value, SplitList_Lazy_st_less_stat > SplitList_Lazy_DHP_st_less_stat;
@@ -448,6 +465,10 @@ namespace map {
         struct traits_SplitList_Iterable_dyn_cmp_stat : public traits_SplitList_Iterable_dyn_cmp
         {
             typedef cc::split_list::stat<> stat;
+            typedef typename cc::iterable_list::make_traits<
+                co::compare< compare >
+                , co::stat< cc::iterable_list::stat<>>
+            >::type ordered_list_traits;
         };
         typedef SplitListMap< cds::gc::HP, Key, Value, traits_SplitList_Iterable_dyn_cmp_stat > SplitList_Iterable_HP_dyn_cmp_stat;
         typedef SplitListMap< cds::gc::DHP, Key, Value, traits_SplitList_Iterable_dyn_cmp_stat > SplitList_Iterable_DHP_dyn_cmp_stat;
@@ -563,6 +584,10 @@ namespace map {
         struct traits_SplitList_Iterable_st_less_stat : traits_SplitList_Iterable_st_less
         {
             typedef cc::split_list::stat<> stat;
+            typedef typename cc::iterable_list::make_traits<
+                co::less< less >
+                , co::stat< cc::iterable_list::stat<>>
+            >::type ordered_list_traits;
         };
         typedef SplitListMap< cds::gc::HP, Key, Value, traits_SplitList_Iterable_st_less_stat > SplitList_Iterable_HP_st_less_stat;
         typedef SplitListMap< cds::gc::DHP, Key, Value, traits_SplitList_Iterable_st_less_stat > SplitList_Iterable_DHP_st_less_stat;
@@ -583,7 +608,9 @@ namespace map {
     static inline void print_stat( cds_test::property_stream& o, SplitListMap< GC, K, T, Traits > const& m )
     {
         o << m.statistics()
-          << m.list_statistics();
+          << cds_test::stat_prefix( "list_stat" )
+          << m.list_statistics()
+          << cds_test::stat_prefix( "" );
     }
 
 }   // namespace map
index 13501ad..1929995 100644 (file)
@@ -266,6 +266,10 @@ namespace set {
         struct traits_SplitList_Lazy_dyn_cmp_stat : public traits_SplitList_Lazy_dyn_cmp
         {
             typedef cc::split_list::stat<> stat;
+            typedef typename cc::lazy_list::make_traits<
+                co::compare< compare >
+                , co::stat< cc::lazy_list::stat<>>
+            >::type ordered_list_traits;
         };
         typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_dyn_cmp_stat > SplitList_Lazy_HP_dyn_cmp_stat;
         typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_dyn_cmp_stat > SplitList_Lazy_DHP_dyn_cmp_stat;
@@ -368,6 +372,10 @@ namespace set {
         struct traits_SplitList_Lazy_st_less_stat : public traits_SplitList_Lazy_st_less
         {
             typedef cc::split_list::stat<> stat;
+            typedef typename cc::lazy_list::make_traits<
+                co::less< less >
+                , co::stat< cc::lazy_list::stat<>>
+            >::type ordered_list_traits;
         };
         typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_HP_st_less_stat;
         typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_DHP_st_less_stat;
@@ -559,7 +567,9 @@ namespace set {
     static inline void print_stat( cds_test::property_stream& o, SplitListSet<GC, T, Traits> const& s )
     {
         o << s.statistics()
-          << s.list_statistics();
+          << cds_test::stat_prefix( "list_stat" )
+          << s.list_statistics()
+          << cds_test::stat_prefix( "" );
     }
 
 } // namespace set