v2 / cmd / tools / bench / map_clear_runner.vsh
23 lines · 16 sloc · 680 bytes · b801083f13615bfcebe4dd3c25fdfc031d9eb268
Raw
1#!/usr/bin/env -S v -raw-vsh-tmp-prefix tmp
2
3import os
4
5const time_fmt = '"CPU: %Us\tReal: %es\tElapsed: %E\tRAM: %MKB\t%C"'
6const flags = os.getenv('FLAGS')
7
8unbuffer_stdout()
9
10start := os.args[1] or { '1_000_000' }.int()
11end := os.args[2] or { '10_000_000' }.int()
12step := os.args[3] or { '500_000' }.int()
13
14os.chdir(os.dir(@VEXE))!
15vcmd := 'v ${flags} cmd/tools/bench/map_clear.v'
16
17println('>> start: ${start} | end: ${end} | step: ${step} | workdir: "${os.getwd()}" | flags: "${flags}" | vcmd: "${vcmd}"')
18assert os.system(vcmd) == 0
19
20println('running...')
21for i := start; i <= end; i += step {
22 os.system('/usr/bin/time -f ${time_fmt} cmd/tools/bench/map_clear ${i}') == 0
23}
24