From: khizmax Date: Sun, 30 Oct 2016 21:11:01 +0000 (+0300) Subject: Improved output of stress test stat X-Git-Tag: v2.2.0~80 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=commitdiff_plain;h=157444493e655314dc6ee7a94cee96f5ca94ebbf Improved output of stress test stat --- diff --git a/test/include/cds_test/stress_test.h b/test/include/cds_test/stress_test.h index e9486641..c6f49008 100644 --- a/test/include/cds_test/stress_test.h +++ b/test/include/cds_test/stress_test.h @@ -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 - static inline property_stream& operator <<( property_stream& s, std::pair prop ) + static inline property_stream& operator <<( property_stream& s, std::pair 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 prop ) + static inline property_stream& operator <<( property_stream& s, std::pair 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 { diff --git a/test/stress/framework/stress_test.cpp b/test/stress/framework/stress_test.cpp index b4a7e5ff..22090792 100644 --- a/test/stress/framework/stress_test.cpp +++ b/test/stress/framework/stress_test.cpp @@ -34,8 +34,20 @@ namespace cds_test { - struct property_stream - {}; + static std::string s_stat_prefix( "stat" ); + + /*static*/ std::string const& property_stream::stat_prefix() + { + return s_stat_prefix; + } + + /*static*/ void property_stream::set_stat_prefix( char const* prefix ) + { + if ( prefix && prefix[0] ) + s_stat_prefix = prefix; + else + s_stat_prefix = "stat"; + } /*static*/ property_stream& stress_fixture::propout() { diff --git a/test/stress/map/map_type_split_list.h b/test/stress/map/map_type_split_list.h index 93ff5103..77efadcb 100644 --- a/test/stress/map/map_type_split_list.h +++ b/test/stress/map/map_type_split_list.h @@ -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 diff --git a/test/stress/set/set_type_split_list.h b/test/stress/set/set_type_split_list.h index 13501ad8..19299954 100644 --- a/test/stress/set/set_type_split_list.h +++ b/test/stress/set/set_type_split_list.h @@ -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 const& s ) { o << s.statistics() - << s.list_statistics(); + << cds_test::stat_prefix( "list_stat" ) + << s.list_statistics() + << cds_test::stat_prefix( "" ); } } // namespace set