summaryrefslogtreecommitdiff
path: root/t/perf/perf-lib.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-08-17 20:56:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-08-20 21:04:47 (GMT)
commit22bec79d1aef8fd82c7870e62f77b7817f0575a7 (patch)
tree94931434d3aa851e4ee00084d4e5e37ad4359836 /t/perf/perf-lib.sh
parent5a924a62bb0fc5524101aeec9086aee530c2244d (diff)
downloadgit-22bec79d1aef8fd82c7870e62f77b7817f0575a7.zip
git-22bec79d1aef8fd82c7870e62f77b7817f0575a7.tar.gz
git-22bec79d1aef8fd82c7870e62f77b7817f0575a7.tar.bz2
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.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index a54be09..11d1922 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_ () {