Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Show allocation info for tests and benchmarks. Do not show cumulative…

… allocation for suites since that's likely to overflow <integer>.
  • Loading branch information...
commit 1a807487f93a6367a9025ccdfb054077bbc41640 1 parent 2156d74
@cgay cgay authored
Showing with 19 additions and 2 deletions.
  1. +3 −2 run.dylan
  2. +16 −0 utils.dylan
View
5 run.dylan
@@ -266,10 +266,11 @@ define method show-progress
let verbose? = runner.runner-progress = $verbose;
if (result)
let reason = result.result-reason;
- test-output("%s%s in %ss\n",
+ test-output("%s%s in %ss and %s\n",
verbose? & " test " | " ",
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
16 utils.dylan
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.