From 4773bae3dcb27e3e18ff8dece305f3d65a29ac71 Mon Sep 17 00:00:00 2001 From: Andrea Arteaga Date: Wed, 22 Feb 2012 19:56:45 +0100 Subject: Better results, error handling, sample configuration file. --- numbench/confinput/xmlinput.py | 2 +- numbench/htmlreport.py | 9 ++++++--- numbench/main.py | 3 +++ numbench/report.py | 9 ++++++++- numbench/utils/btl.py | 2 +- 5 files changed, 19 insertions(+), 6 deletions(-) (limited to 'numbench') diff --git a/numbench/confinput/xmlinput.py b/numbench/confinput/xmlinput.py index 2a145a9..4743730 100644 --- a/numbench/confinput/xmlinput.py +++ b/numbench/confinput/xmlinput.py @@ -105,7 +105,7 @@ def parseConf(fname): skip = [] skipre = [] for s in t.getElementsByTagName('skip'): - if not s.hasAtribute('type') or s.getAttribute('type') == 'glob': + if not s.hasAttribute('type') or s.getAttribute('type') == 'glob': skip.append(s.firstChild.data) elif s.getAttribute('type') == 'regexp': skipre.append(s.firstChild.data) diff --git a/numbench/htmlreport.py b/numbench/htmlreport.py index 33c19fa..1880934 100644 --- a/numbench/htmlreport.py +++ b/numbench/htmlreport.py @@ -63,7 +63,8 @@ h1, h2, .plot, .descr, .info { self.content += title + "" date = time.strftime('%Y-%m-%d, %I:%M %p') self.content += '

Generated on ' + date + '

' - + + # Information regarding the CPU cpuinfo = file('/proc/cpuinfo', 'r').readlines() cpu = None for l in cpuinfo: @@ -71,7 +72,8 @@ h1, h2, .plot, .descr, .info { cpu = l.split(':',1)[1].strip() if cpu: self.content += '

CPU: ' + cpu + '

' - + + # Information regarding the memory meminfo = file('/proc/meminfo', 'r').readlines() mem = None for l in meminfo: @@ -79,7 +81,8 @@ h1, h2, .plot, .descr, .info { mem = l.split(':',1)[1].strip() if mem: self.content += '

Total memory: ' + mem + '

' - + + # Input file self.content += '
Input file: ' + \ '%s' % (basename(inputfile), cfg.inputfile) + \ '
%s
' % xmlescape(file(cfg.inputfile, 'r').read()) diff --git a/numbench/main.py b/numbench/main.py index 1cbb772..1285c18 100644 --- a/numbench/main.py +++ b/numbench/main.py @@ -147,6 +147,9 @@ for tname, ttest in cfg.tests.items(): if len(ttest['skip']) != 0: Print(" - Skip implementations: " + ' '.join(ttest['skip'])) + if len(ttest['skipre']) != 0: + Print(" - Skip implementations (regular expressions): " + ' '.join(ttest['skipre'])) + if len(ttest['requires']) != 0: Print(" - Pkg-config requirements substitutions:", '') for c_0, c_1 in ttest['requires'].items(): diff --git a/numbench/report.py b/numbench/report.py index 901723b..e3b4f73 100644 --- a/numbench/report.py +++ b/numbench/report.py @@ -16,6 +16,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # from os.path import join as pjoin, basename +from shutil import copy as fcopy, copytree import numpy as np import benchconfig as cfg @@ -68,7 +69,8 @@ def saveReport(): for tid,test in cfg.tests.items(): if test.has_key('implementations'): for impl in test['implementations']: - if test['results'][impl].has_key(operation): + res = test['results'][impl] + if res and res.has_key(operation): resultsFile = test['results'][impl][operation] x,y = np.loadtxt(resultsFile, unpack=True) plotf(x, y, label=tid+'/'+impl, hold=True) @@ -86,6 +88,11 @@ def saveReport(): html.close() Print('HTML report generated: ' + htmlfname) + # Copy input and logs + inputdest = pjoin(cfg.reportdir, basename(cfg.inputfile)) + fcopy(cfg.inputfile, inputdest) + copytree(cfg.logdir, pjoin(cfg.reportdir, 'log')) + # Initialize module try: diff --git a/numbench/utils/btl.py b/numbench/utils/btl.py index 3031eb3..1f06f67 100644 --- a/numbench/utils/btl.py +++ b/numbench/utils/btl.py @@ -215,7 +215,7 @@ def runTest(test, btlconfig): if not outline: Print.up() Print('Execution error') - return 1 + return 1, None logfs.write(outline) logfs.flush() -- cgit v1.2.3-65-gdbad