Permalink
Browse files

Merge pull request #54 from cgay/allocation

Show allocation info for tests and benchmarks
  • Loading branch information...
2 parents 2156d74 + 0338b3a commit 2562c36f5eab287b27dd673f37fb8325cb0a2715 @waywardmonkeys waywardmonkeys committed Feb 10, 2014
Showing with 24 additions and 3 deletions.
  1. +8 −3 run.dylan
  2. +16 −0 utils.dylan
View
@@ -266,10 +266,15 @@ define method show-progress
let verbose? = runner.runner-progress = $verbose;
if (result)
let reason = result.result-reason;
- test-output("%s%s in %ss\n",
- verbose? & " test " | " ",
+ test-output("%s%s in %ss and %s\n",
+ if (verbose?)
+ format-to-string(" %s ", test.component-type-name)
+ else
+ " "
+ end,
result.result-status.status-name.as-uppercase,
- result.result-time);
+ result.result-time,
+ format-bytes(result.result-bytes));
reason & test-output(" %s\n", reason);
else
test-output("Running %s %s:%s",
View
@@ -98,3 +98,19 @@ define method tags-match?
#t
end block
end method tags-match?;
+
+
+// Might want to put an extended version of this in the io:format module.
+define function format-bytes
+ (bytes :: <integer>) => (string :: <string>)
+ let (divisor, units) = case
+ bytes <= 1024 =>
+ values(1, "B");
+ bytes <= ash(1, 20) =>
+ values(1024, "KiB");
+ otherwise =>
+ values(ash(1, 20), "MiB");
+ // Need more bits in our integers...
+ end;
+ concatenate(integer-to-string(round/(bytes, divisor)), units)
+end function format-bytes;

0 comments on commit 2562c36

Please sign in to comment.