def run(monitors, loops, record_type=None):
    header = (
        "Overhead time | Relative overhead | "
        "{:^10} | {:^{length}}".format(
            'Records', 'Name',
            length=max(len(key) for key in monitors) - 4))
    line = ('{time:>13} | {relative:>17} | {records:>10} | {name}')
    print header
    print len(header) * '-'
    expected_time, _ = pystone.pystones(loops)
    for name, monitor in monitors.iteritems():
        recorder = RecordCounter()
        with monitor(recorder=recorder, record_type=record_type):
            time, _ = pystone.pystones(loops)
        print line.format(
            name=name,
            time='{:2.2f}'.format(time - expected_time),
            relative='{:.2%}'.format((time - expected_time) / expected_time),
            records='{:10d}'.format(recorder.records))
Time the monitors overhead using pystones.
dataset/ETHPy150Open enthought/pikos/pikos/benchmark/monitors.py/run