import time from os.path import join as pjoin, basename import benchconfig as cfg class HTMLreport: def __init__(self, fname, title="Benchmarks report", \ inputfile=pjoin(cfg.reportdir, basename(cfg.inputfile))): self.fname = fname self.content = """
Generated on ' + date + '
' cpuinfo = file('/proc/cpuinfo', 'r').readlines() cpu = None for l in cpuinfo: if l[:10] == 'model name': cpu = l.split(':',1)[1].strip() if cpu: self.content += 'CPU: ' + cpu + '
' meminfo = file('/proc/meminfo', 'r').readlines() mem = None for l in meminfo: if l[:8] == 'MemTotal': mem = l.split(':',1)[1].strip() if mem: self.content += 'Total memory: ' + mem + '
' self.content += '%s
' + descr + '
' self.content += '