Skip to content

Commit

Permalink
Drop support for usage in means
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorbin committed Aug 6, 2012
1 parent 0031516 commit 01c4cb5
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions means.py
Expand Up @@ -62,7 +62,8 @@ def wrapper(x):

compose = lambda f, g: lambda x: f(g(x))

usage_extractors = (
result_extractors = (
Selector('wallclock', lambda r: (r.end - r.start)),
Selector('cputime', lambda r: (r.utime - r.stime)),
Selector('maxrss'),
Selector('minflt'),
Expand All @@ -73,12 +74,7 @@ def wrapper(x):
Selector('nvcsw'),
Selector('nivcsw'))

result_extractors = (
Selector('wallclock', lambda r: (r.end - r.start)),
) + usage_extractors

def run_collections(run):
usage = usage_extractors
results = result_extractors

# TODO: support compressed output
Expand All @@ -101,16 +97,9 @@ def run_collections(run):
Selector('stderr_bytes', stderr_bytes))

results = Collector(*results)
colls = [results]
if getattr(run, 'hasusage', 'false').lower() == 'true':
usage = Collector(*usage)
colls.append(usage)
else:
usage = None
nc = len(colls)
for i, record in enumerate(run):
colls[i % nc].add(record)
return results, usage
for record in run:
results.add(record)
return results

import argparse
parser = argparse.ArgumentParser()
Expand All @@ -126,9 +115,8 @@ def run_collections(run):
if args.table:
fields = None
for i, run in enumerate(runs):
results, usage = run_collections(run)
if usage is not None:
raise NotImplementedError('no support for usage in result_rows')
results = run_collections(run)

runfields, stats = zip(*collection_stats(results))
if i == 0:
fields = runfields
Expand All @@ -141,8 +129,5 @@ def run_collections(run):
for i, run in enumerate(runs):
if i > 0:
print()
results, usage = run_collections(run)
if usage is not None:
print('== Usage\n%s' % collection_report(usage))
print()
results = run_collections(run)
print('== Results\n%s' % collection_report(results))

0 comments on commit 01c4cb5

Please sign in to comment.