Add bashmark function

Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
Ari Archer 2022-10-22 23:39:35 +03:00
parent 09b744b961
commit 859ea19d11
Signed by untrusted user who does not match committer: ari
GPG key ID: A50D5B4B599AF8A2
3 changed files with 14 additions and 1 deletions

View file

@ -17,3 +17,4 @@ $ baz install git 'https://ari-web.xyz/gh/cmdutils-baz-plugin'
- `showtopcmd` -- Show top `n` ammount of commands
- `beep` -- Beep
- `rshell` -- Reset shell
- `bashmark` -- Benchmark a command

View file

@ -1,6 +1,6 @@
export BAZP_NAME='cmdutils-baz-plugin'
export BAZP_LICENSE='WTFPL'
export BAZP_VER=2
export BAZP_VER=3
export BAZP_AUTHOR='Ari Archer'
export BAZP_SRC='plugin'
export BAZP_METHOD='git'

12
plugin/functions/bashmark Normal file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
if [ ! "$1" ]; then
echo 'Usage: BMT=<times to run> time bashmark "<command>"' >&2
return 1
fi
ts="${BMT:-1000}"
for num in $(seq -- "$ts"); do
printf '%d\n%d\n%d\n' "$num" "$num$num" "$num$num$num" | bash -c -- "$1"
done