Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81404 - sandbox/variadic_templates/sandbox/slim/test
From: cppljevans_at_[hidden]
Date: 2012-11-17 15:36:39


Author: cppljevans
Date: 2012-11-17 15:36:38 EST (Sat, 17 Nov 2012)
New Revision: 81404
URL: http://svn.boost.org/trac/boost/changeset/81404

Log:
Expanded benchmark_prefix to produce several
filenames; hence, the rename. Also used
in Makefile to help documentation.

Added:
   sandbox/variadic_templates/sandbox/slim/test/benchmark_filenames.py
      - copied, changed from r81400, /sandbox/variadic_templates/sandbox/slim/test/benchmark_prefix.py
Removed:
   sandbox/variadic_templates/sandbox/slim/test/benchmark_prefix.py
Text files modified:
   sandbox/variadic_templates/sandbox/slim/test/Makefile | 26 +++++++++++++++-----------
   sandbox/variadic_templates/sandbox/slim/test/benchmark_filenames.py | 14 ++++++++++++--
   sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_run.py | 21 +++++++++++++++------
   3 files changed, 42 insertions(+), 19 deletions(-)

Modified: sandbox/variadic_templates/sandbox/slim/test/Makefile
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/Makefile (original)
+++ sandbox/variadic_templates/sandbox/slim/test/Makefile 2012-11-17 15:36:38 EST (Sat, 17 Nov 2012)
@@ -1,24 +1,28 @@
 BENCHMARK.suffix=mini
 BENCHMARK.suffix=tree_builder
 TIMEFMT=%Y-%m-%d_%T_%N
-#TIMESTAMP.value=_
-TIMESTAMP.value?=$(shell date +$(TIMEFMT))
+#TIMESTAMP=_
+TIMESTAMP?=$(shell date +$(TIMEFMT))
 GUAGE=guage_time
-BENCHMARK.prefix=$(shell python benchmark_prefix_name.py)
-MAIN=$(BENCHMARK.prefix).$(BENCHMARK.suffix)
-MEASURED=$(MAIN).$(GUAGE)@$(TIMESTAMP.value)
 PYTHON=python
+#The following macros are only used in comments.
+SRC_BASENAME=$(shell $(PYTHON) benchmark_filenames.py $(BENCHMARK.suffix))
+OUT_BASENAME=$(shell $(PYTHON) benchmark_filenames.py $(BENCHMARK.suffix)\
+ $(GUAGE)\
+ $(TIMESTAMP)\
+ )
 
 .PHONY: brun
-brun:#produces $(MEASURED).txt from $(MAIN).cpp
- $(PYTHON) tuple_benchmark_run.py $(GUAGE) $(BENCHMARK.suffix) $(TIMESTAMP.value)
+brun:#produces $(OUT_BASENAME).txt from $(SRC_BASENAME).cpp
+ $(PYTHON) tuple_benchmark_run.py \
+ $(GUAGE) $(BENCHMARK.suffix) $(TIMESTAMP)
 
 .PHONY: domain
-domain:
+domain:#prints the domains(inputs) used in brun target.
         $(PYTHON) tuple_benchmark_domain.py
 
-parse:#produces domain_range.pkl from $(MEASURED).txt
- $(PYTHON) tuple_benchmark_parserange.py $(MEASURED).txt
+parse:#produces domain_range.pkl from $(OUT_BASENAME).txt
+ $(PYTHON) tuple_benchmark_parserange.py $(OUT_BASENAME).txt
 
 .PHONY: plot
 plot: domain_range.pkl#produces filtered output from domain_range.pkl
@@ -26,4 +30,4 @@
 
 .PHONY: show
 show:#shows selected macro values.
- echo $(BENCHMARK.prefix)
+ echo $(OUT_BASENAME)

Copied: sandbox/variadic_templates/sandbox/slim/test/benchmark_filenames.py (from r81400, /sandbox/variadic_templates/sandbox/slim/test/benchmark_prefix.py)
==============================================================================
--- /sandbox/variadic_templates/sandbox/slim/test/benchmark_prefix.py (original)
+++ sandbox/variadic_templates/sandbox/slim/test/benchmark_filenames.py 2012-11-17 15:36:38 EST (Sat, 17 Nov 2012)
@@ -3,9 +3,19 @@
 benchmark.
 """
 from __future__ import print_function
+from sys import argv
 
-def name():
+def src_prefix():
     return "tuple.benchmark"
 
+def src_basename(src_suffix):
+ return src_prefix()+"."+src_suffix
+
+def out_basename(src_suffix,guage,run):
+ return src_basename(src_suffix)+"."+guage+"@"+run
+
 if __name__ == '__main__':
- print(name())
+ out_name=src_basename(argv[1])
+ if len(argv)>2:
+ out_name=out_basename(argv[1],argv[2],argv[3])
+ print(out_name)

Deleted: sandbox/variadic_templates/sandbox/slim/test/benchmark_prefix.py
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/benchmark_prefix.py 2012-11-17 15:36:38 EST (Sat, 17 Nov 2012)
+++ (empty file)
@@ -1,11 +0,0 @@
-"""
-Print to stdout a prefix of the name of the c++ source code
-benchmark.
-"""
-from __future__ import print_function
-
-def name():
- return "tuple.benchmark"
-
-if __name__ == '__main__':
- print(name())

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-17 15:36:38 EST (Sat, 17 Nov 2012)
@@ -11,7 +11,7 @@
 
 from tuple_benchmark_domain import *
 import compiler_guage
-import benchmark_prefix
+import benchmark_filenames
 import boost_root
 
 def main(argv):
@@ -37,9 +37,10 @@
     benchmark_suffix=argv[2]
   if len(argv)>3:
     benchmark_run=argv[3]
- benchmark_presuffix=benchmark_prefix.name()+"."+benchmark_suffix
- benchmark_basename=benchmark_presuffix+".cpp"
- #print("benchmark_basename=",benchmark_basename)
+ benchmark_basename_ext\
+ = benchmark_filenames.src_basename(benchmark_suffix)\
+ + ".cpp"
+ #print("benchmark_basename_ext=",benchmark_basename_ext)
   boost_root_path=boost_root.path()
   impl_map_inc={}#implementation key -> -I include flags to compiler
   if False:
@@ -88,7 +89,15 @@
     map(lambda t: t[1], name_domain)
     )
   guage_fun=guage_map[guage_name]
- measure_out=open(benchmark_presuffix+"."+guage_name+"@"+benchmark_run+".txt",mode='w')
+ measure_out=\
+ open\
+ ( benchmark_filenames.out_basename\
+ ( benchmark_suffix
+ , guage_name
+ , benchmark_run
+ ) + ".txt"
+ , mode='w'
+ )
   print(TAG_TUPLE.compilers+"[",file=measure_out)
   for compiler_name in COMPILER_MAP.keys():
     (compiler_exe,compiler_flags)=COMPILER_MAP[compiler_name]
@@ -123,7 +132,7 @@
         + compiler_flags+" "\
         + compiler_macros+" "\
         + impl_map_inc[macro_vals[0]]+" "\
- + benchmark_basename\
+ + benchmark_basename_ext\
         #
       print(TAG_TUPLE.range_out+"[",file=measure_out)
       measure_out.flush()


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