aboutsummaryrefslogtreecommitdiff
path: root/bench/summarize.jq
blob: 5d144910865c70fef20262435750fe6655c4b574 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env -S jq -Mrf

def round3:
    . * 1000 | round | . / 1000
    ;

def stats($first):
    [
        "  mean:     \(.mean | round3)s ± \(.stddev | round3)s",
        "            user: \(.user | round3)s | system: \(.system | round3)s",
        "  median:   \(.median | round3)s",
        "  range:    \(.min | round3)s ... \(.max | round3)s",
        "  relative: \(.mean / $first.mean | round3)"
    ]
    | join("\n")
    ;

def fmt($first):
    "\(.command)\n" + (. | stats($first))
    ;

[.results | .[0] as $first | .[] | fmt($first)] | join("\n\n") | (. + "\n\n---\n")