diff options
| author | Jeff King <peff@peff.net> | 2018-08-17 16:56:37 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-08-20 14:04:47 -0700 |
| commit | 22bec79d1aef8fd82c7870e62f77b7817f0575a7 (patch) | |
| tree | 94931434d3aa851e4ee00084d4e5e37ad4359836 /t/perf/perf-lib.sh | |
| parent | t/perf: factor out percent calculations (diff) | |
| download | git-22bec79d1aef8fd82c7870e62f77b7817f0575a7.tar.gz git-22bec79d1aef8fd82c7870e62f77b7817f0575a7.zip | |
t/perf: add infrastructure for measuring sizes
The main objective of scripts in the perf framework is to
run "test_perf", which measures the time it takes to run
some operation. However, it can also be interesting to see
the change in the output size of certain operations.
This patch introduces test_size, which records a single
numeric output from the test and shows it in the aggregated
output (with pretty printing and relative size comparison).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/perf/perf-lib.sh')
| -rw-r--r-- | t/perf/perf-lib.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh index a54be09516..11d1922cf5 100644 --- a/t/perf/perf-lib.sh +++ b/t/perf/perf-lib.sh @@ -231,6 +231,19 @@ test_perf () { test_wrapper_ test_perf_ "$@" } +test_size_ () { + say >&3 "running: $2" + if test_eval_ "$2" 3>"$base".size; then + test_ok_ "$1" + else + test_failure_ "$@" + fi +} + +test_size () { + test_wrapper_ test_size_ "$@" +} + # We extend test_done to print timings at the end (./run disables this # and does it after running everything) test_at_end_hook_ () { |
