Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81604 - sandbox/variadic_templates/sandbox/slim/test
From: cppljevans_at_[hidden]
Date: 2012-11-27 22:00:01


Author: cppljevans
Date: 2012-11-27 22:00:00 EST (Tue, 27 Nov 2012)
New Revision: 81604
URL: http://svn.boost.org/trac/boost/changeset/81604

Log:
refactored tuple.benchmark.tree_builder.cpp code into tree_build.hpp

Text files modified:
   sandbox/variadic_templates/sandbox/slim/test/time_cmd_name_codes.py | 20 +++++++-----
   sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.cpp | 45 ---------------------------
   sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.guage_time._.run.txt | 64 +++++-----------------------------------
   sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_pickle.py | 8 +++-
   sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_run.py | 4 +-
   5 files changed, 29 insertions(+), 112 deletions(-)

Modified: sandbox/variadic_templates/sandbox/slim/test/time_cmd_name_codes.py
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/time_cmd_name_codes.py (original)
+++ sandbox/variadic_templates/sandbox/slim/test/time_cmd_name_codes.py 2012-11-27 22:00:00 EST (Tue, 27 Nov 2012)
@@ -6,13 +6,13 @@
 #mapping of name of measurement to format code for measurement
 #in --format argument to system time command.
 TUPLE_NAME_CODES=\
- ( ('UserTime','%U')
- , ('SystemTime','%S')
- , ('ElapsedTime','%e')
- , ('MajorPageFaults', '%I')
- , ('MaxResidentSetSize', '%M')
- , ('Swaps', '%W')
- , ('ContextSwitches', '%w')
+ ( ('UserTime', ('%U',float))
+ , ('SystemTime', ('%S',float))
+ , ('ElapsedTime', ('%e',float))
+ , ('MajorPageFaults', ('%I',long))
+ , ('MaxResidentSetSize', ('%M',long))
+ , ('Swaps', ('%W',long))
+ , ('ContextSwitches', ('%w',long))
     )
 
 DICT_NAME_CODE=dict(TUPLE_NAME_CODES)
@@ -23,7 +23,11 @@
 
 def fmtcode(name):
     """the format code for name"""
- return DICT_NAME_CODE[name]
+ return DICT_NAME_CODE[name][0]
+
+def convert_str(name,str):
+ """Convert str into value appropriate for name"""
+ return DICT_NAME_CODE[name][1](str)
 
 if __name__ == '__main__':
     print(":DICT_NAME_CODE=",DICT_NAME_CODE)

Modified: sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.cpp
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.cpp (original)
+++ sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.cpp 2012-11-27 22:00:00 EST (Tue, 27 Nov 2012)
@@ -11,50 +11,7 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 //
-
-#include <string>
-#include <cstdio>
-#include "./make_tuple.hpp"
-#include <boost/preprocessor/repetition/enum.hpp>
-
-#ifndef TUPLE_SIZE
-#define TUPLE_SIZE 2
-#endif
-
-#ifndef TREE_DEPTH
-#define TREE_DEPTH 2
-#endif
-
-template<int I>
-struct tree_builder
-{
- #define M0(Z, N, D) ::make_tuple(static_cast<T &&>(t), std::integral_constant<int, N>())
- #define M1(Z, N, D) auto BOOST_PP_CAT(tmp, N) = ::get<N>(res);
-
- template<typename T>
- static auto make_tree(T &&t)
- -> decltype(tree_builder<I+1>::make_tree(::make_tuple(BOOST_PP_ENUM(TUPLE_SIZE, M0, ~))))
- {
- auto res = tree_builder<I+1>::make_tree(::make_tuple(BOOST_PP_ENUM(TUPLE_SIZE, M0, ~)));
- // Get each element of the tuple.
- BOOST_PP_REPEAT(TUPLE_SIZE, M1, ~)
- return res;
- }
-
- #undef M1
- #undef M0
-};
-
-template<>
-struct tree_builder<TREE_DEPTH+1>
-{
- template<typename T>
- static T make_tree(T &&t)
- {
- return static_cast<T &&>(t);
- }
-};
-
+#include "./tree_builder.hpp"
 int main()
 {
     char sz[] = "hello";

Modified: sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.guage_time._.run.txt
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.guage_time._.run.txt (original)
+++ sandbox/variadic_templates/sandbox/slim/test/tuple.benchmark.tree_builder.guage_time._.run.txt 2012-11-27 22:00:00 EST (Tue, 27 Nov 2012)
@@ -19,67 +19,19 @@
 ]compilers
 domain_names['compiler', 'TUPLE_IMPL', 'TUPLE_SIZE', 'TUPLE_UNROLL_MAX', 'TREE_DEPTH']domain_names
 range_how['guage_time', 'UserTime', 'SystemTime', 'ElapsedTime', 'MajorPageFaults', 'MaxResidentSetSize', 'Swaps', 'ContextSwitches']range_how
-domain_values['gcc4_8', 'bcon12_horizontal', 10, -1, 4]domain_values
+domain_values['gcc4_8', 'bcon12_horizontal', 10, -1, 2]domain_values
 range_out[
-UserTime[1.29]SystemTime[0.23]ElapsedTime[3.67]MajorPageFaults[32112]MaxResidentSetSize[241856]Swaps[0]ContextSwitches[381]
+UserTime[0.56]SystemTime[0.07]ElapsedTime[0.63]MajorPageFaults[64]MaxResidentSetSize[140704]Swaps[0]ContextSwitches[13]
 ]range_out
-domain_values['gcc4_8', 'bcon12_horizontal', 10, -1, 5]domain_values
+domain_values['gcc4_8', 'bcon12_horizontal', 10, -1, 3]domain_values
 range_out[
-UserTime[1.21]SystemTime[0.12]ElapsedTime[1.35]MajorPageFaults[8]MaxResidentSetSize[268256]Swaps[0]ContextSwitches[6]
+UserTime[0.65]SystemTime[0.05]ElapsedTime[0.68]MajorPageFaults[0]MaxResidentSetSize[165408]Swaps[0]ContextSwitches[6]
 ]range_out
-domain_values['gcc4_8', 'bcon12_horizontal', 10, -1, 6]domain_values
+domain_values['clangxx', 'bcon12_horizontal', 10, -1, 2]domain_values
 range_out[
-UserTime[1.35]SystemTime[0.11]ElapsedTime[1.55]MajorPageFaults[56]MaxResidentSetSize[295232]Swaps[0]ContextSwitches[12]
+UserTime[0.38]SystemTime[0.05]ElapsedTime[0.45]MajorPageFaults[24]MaxResidentSetSize[108016]Swaps[0]ContextSwitches[6]
 ]range_out
-domain_values['gcc4_8', 'bcon12_horizontal', 10, -1, 7]domain_values
+domain_values['clangxx', 'bcon12_horizontal', 10, -1, 3]domain_values
 range_out[
-UserTime[1.58]SystemTime[0.18]ElapsedTime[1.89]MajorPageFaults[200]MaxResidentSetSize[322864]Swaps[0]ContextSwitches[12]
-]range_out
-domain_values['gcc4_8', 'bcon12_horizontal', 15, -1, 4]domain_values
-range_out[
-UserTime[1.33]SystemTime[0.15]ElapsedTime[1.46]MajorPageFaults[0]MaxResidentSetSize[295968]Swaps[0]ContextSwitches[5]
-]range_out
-domain_values['gcc4_8', 'bcon12_horizontal', 15, -1, 5]domain_values
-range_out[
-UserTime[1.56]SystemTime[0.20]ElapsedTime[1.76]MajorPageFaults[48]MaxResidentSetSize[336928]Swaps[0]ContextSwitches[6]
-]range_out
-domain_values['gcc4_8', 'bcon12_horizontal', 15, -1, 6]domain_values
-range_out[
-UserTime[1.96]SystemTime[0.18]ElapsedTime[2.15]MajorPageFaults[0]MaxResidentSetSize[378496]Swaps[0]ContextSwitches[56]
-]range_out
-domain_values['gcc4_8', 'bcon12_horizontal', 15, -1, 7]domain_values
-range_out[
-UserTime[2.34]SystemTime[0.18]ElapsedTime[2.64]MajorPageFaults[32]MaxResidentSetSize[421168]Swaps[0]ContextSwitches[7]
-]range_out
-domain_values['clangxx', 'bcon12_horizontal', 10, -1, 4]domain_values
-range_out[
-UserTime[1.13]SystemTime[0.11]ElapsedTime[2.72]MajorPageFaults[27608]MaxResidentSetSize[146608]Swaps[0]ContextSwitches[228]
-]range_out
-domain_values['clangxx', 'bcon12_horizontal', 10, -1, 5]domain_values
-range_out[
-UserTime[2.48]SystemTime[0.05]ElapsedTime[2.53]MajorPageFaults[0]MaxResidentSetSize[159296]Swaps[0]ContextSwitches[4]
-]range_out
-domain_values['clangxx', 'bcon12_horizontal', 10, -1, 6]domain_values
-range_out[
-UserTime[16.85]SystemTime[0.08]ElapsedTime[17.36]MajorPageFaults[0]MaxResidentSetSize[170368]Swaps[0]ContextSwitches[3]
-]range_out
-domain_values['clangxx', 'bcon12_horizontal', 10, -1, 7]domain_values
-range_out[
-UserTime[160.33]SystemTime[0.27]ElapsedTime[160.60]MajorPageFaults[0]MaxResidentSetSize[182624]Swaps[0]ContextSwitches[3]
-]range_out
-domain_values['clangxx', 'bcon12_horizontal', 15, -1, 4]domain_values
-range_out[
-UserTime[1.58]SystemTime[0.05]ElapsedTime[1.62]MajorPageFaults[0]MaxResidentSetSize[169664]Swaps[0]ContextSwitches[4]
-]range_out
-domain_values['clangxx', 'bcon12_horizontal', 15, -1, 5]domain_values
-range_out[
-UserTime[12.53]SystemTime[0.06]ElapsedTime[12.58]MajorPageFaults[0]MaxResidentSetSize[187472]Swaps[0]ContextSwitches[3]
-]range_out
-domain_values['clangxx', 'bcon12_horizontal', 15, -1, 6]domain_values
-range_out[
-UserTime[173.84]SystemTime[0.30]ElapsedTime[174.20]MajorPageFaults[24]MaxResidentSetSize[207792]Swaps[0]ContextSwitches[6]
-]range_out
-domain_values['clangxx', 'bcon12_horizontal', 15, -1, 7]domain_values
-range_out[
-UserTime[2592.81]SystemTime[0.63]ElapsedTime[2593.48]MajorPageFaults[0]MaxResidentSetSize[229648]Swaps[0]ContextSwitches[3]
+UserTime[0.46]SystemTime[0.04]ElapsedTime[0.49]MajorPageFaults[0]MaxResidentSetSize[117424]Swaps[0]ContextSwitches[3]
 ]range_out

Modified: sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_pickle.py
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_pickle.py (original)
+++ sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_pickle.py 2012-11-27 22:00:00 EST (Tue, 27 Nov 2012)
@@ -28,6 +28,7 @@
       """
       pass
   
+import time_cmd_name_codes
 class parse_range_time:
     """
     Concrete for parsing output from compiler performance measurement
@@ -45,9 +46,12 @@
     def parse(self,range_values_str):
         found=self.range_values_re.search(range_values_str)
         range_values_lst=[]
+ #print(":range_names=",self.range_names)
         n=len(self.range_names)
- for i in range(1,1+n):
- range_val=float(found.group(i))
+ for i in range(n):
+ str_val=found.group(i+1)
+ #print(":i=",i,":str_val=",str_val)
+ range_val=time_cmd_name_codes.convert_str(self.range_names[i],str_val)
             range_values_lst.append(range_val)
         return range_values_lst
 

Modified: sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_run.py
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_run.py (original)
+++ sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_run.py 2012-11-27 22:00:00 EST (Tue, 27 Nov 2012)
@@ -71,7 +71,7 @@
         ""\
       #
   tuple_min_size=10
- tuple_max_size=15
+ tuple_max_size=10
   tuple_del_size=5
   name_domain=[
       [ 'compiler', compilers(COMPILER_MAP.keys())]
@@ -82,7 +82,7 @@
   if benchmark_suffix == "mini" :
     name_domain.append( [ 'LAST_LESS', last(4,tuple_del_size)])
   else:
- name_domain.append( [ 'TREE_DEPTH', tree_depth(4,7,1)])
+ name_domain.append( [ 'TREE_DEPTH', tree_depth(2,3,1)])
   domains=product_dep(
     map(lambda t: t[1], name_domain)
     )


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk