Add bashmark function
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
parent
09b744b961
commit
859ea19d11
|
@ -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
|
||||
|
|
2
baz.env
2
baz.env
|
@ -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
12
plugin/functions/bashmark
Normal 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
|
Loading…
Reference in a new issue