# # # patch "README" # from [b913e6cdc2eec97224ec7f8297b9e44783b10781] # to [fa9f881d0ad01527b48a32c4487d858a41e2e0ce] # # patch "mtn_benchmark/instrumenter.py" # from [c04fd7417f6c9a34dfe9f064d78f514a884e6057] # to [b01b9f0257cc593bba87944c1ddd9fc3b30fd858] # # patch "mtn_benchmark/instrumenters.py" # from [ea65e44ba430445b8ccc1dc4d56b9938f372df94] # to [4c10911d5a88cf39d15b8920fa657db1a2bc011b] # # patch "mtn_benchmark/util.py" # from [b7817417a6cfd134019cee7ecbce189f50f49080] # to [3c2fc3e4a685a860a338fc6e4513b9b7e4c6dbc5] # ============================================================ --- README b913e6cdc2eec97224ec7f8297b9e44783b10781 +++ README fa9f881d0ad01527b48a32c4487d858a41e2e0ce @@ -7,14 +7,22 @@ Otherwise, enhance drop_caches to work on your platform, or do without. +(There has been one report of running drop_caches repeatedly causing a +serious problem on Linux 2.6.16.13 with XFS filesystem. After running +it a bunch of times, the filesystem started giving an I/O error any +time it was accessed. Power-cycling the machine fixed this. It may +have had something to do with ctrl-c'ing the run partway through, but +I don't know.) + Then: $ python2.4 benchmark.py \ -m mtn-0.26=path/to/0.26 -m mtn-0.27=path/to/0.27 \ -b pull='Pull(ExistingRepo("path/to/some/repo.mtn"))' \ myscratch myresults -Then look in myresults/. +More usage examples can be found in the examples directory. +Then look in myresults/. Add new instrumenters (oprofile, callgrind, massif, dtrace IO tracing, ...) to instrumenters.py. ============================================================ --- mtn_benchmark/instrumenter.py c04fd7417f6c9a34dfe9f064d78f514a884e6057 +++ mtn_benchmark/instrumenter.py b01b9f0257cc593bba87944c1ddd9fc3b30fd858 @@ -1,7 +1,8 @@ import shutil import os import subprocess import csv +import time from mtn_benchmark.util import ensure_dir ============================================================ --- mtn_benchmark/instrumenters.py ea65e44ba430445b8ccc1dc4d56b9938f372df94 +++ mtn_benchmark/instrumenters.py 4c10911d5a88cf39d15b8920fa657db1a2bc011b @@ -1,3 +1,5 @@ +import os +import os.path import mtn_benchmark.instrumenter as instrumenter def NullInstrumenter(): @@ -35,3 +37,39 @@ def TimingInstrumenter(repeats=3): return instrumenter.Instrumenter(TimingInstrumenterObj, repeats) + +class MemTimingInstrumenterObj(instrumenter.RecordingInstrumenterObj): + def run_bg(self, name, cmd): + memtime = os.path.abspath("../../../memtime"); + if not os.path.exists(memtime): + os.system("pwd") + print "memtime not in ../../.. directory, doesn't know how to pass the argument through to the class" + sys.exit(1) + my_cmd = [memtime, "-o", "timings-" + name] + cmd + def timing_hook(result): + timing_file = open("timings-" + name, "r") + for line in timing_file: + if line.startswith("STATS_MACHINE_V1:"): + break + assert line.startswith("STATS_MACHINE_V1:") + junk, user, sys, wall, max_size_bytes, max_resident_bytes, avg_size_bytes, avg_resident_bytes = line.split() + self.record_stat(name + "-user-time", user) + self.record_stat(name + "-system-time", sys) + self.record_stat(name + "-wall-time", wall) + self.record_stat(name + "-max-size-MiB", float(max_size_bytes) / (1024*1024)) + self.record_stat(name + "-max-resident-MiB", float(max_resident_bytes) / (1024*1024)) + self.record_stat(name + "-avg-size-MiB", float(avg_size_bytes) / (1024*1024)) + self.record_stat(name + "-avg-resident-MiB", float(avg_resident_bytes) / (1024*1024)) + + process = super(MemTimingInstrumenterObj, self).run_bg(name, my_cmd) + process.hook(timing_hook) + return process + +# TODO: figure out how to get a path to memtime passed through +def MemTimingInstrumenter(path, repeats=3): + # TODO: get path from here into the object; just putting it in as + # an argument in the next line doesn't work (some error), even + # with an __init__ function in the class + return instrumenter.Instrumenter(MemTimingInstrumenterObj, repeats) + + ============================================================ --- mtn_benchmark/util.py b7817417a6cfd134019cee7ecbce189f50f49080 +++ mtn_benchmark/util.py 3c2fc3e4a685a860a338fc6e4513b9b7e4c6dbc5 @@ -14,5 +14,6 @@ self.executable = os.path.abspath(executable) def __call__(self): - os.system(self.executable) + if self.executable: + os.system(self.executable)