Linux command
cmdperf 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Benchmark
cmdperf "sleep 0.1"
Compare
cmdperf "grep 'ERROR' log.txt" "rg 'ERROR' log.txt"
Run
cmdperf -n 100 "ls -la"
Simulate
cmdperf -c 10 "curl -s https://example.com > /dev/null"
Run
cmdperf -d 30s "redis-cli PING"
Export
cmdperf --markdown [results.md] "sleep 0.1" "sleep 0.2"
说明
cmdperf runs one or more shell commands repeatedly and gathers timing statistics, displaying them in a live terminal UI with a progress bar, ETA, and key metrics including mean execution time, standard deviation, and min/max ranges. It supports single command benchmarking, multi-command comparison, concurrent execution to simulate load, duration-based runs, and rate limiting for HTTP endpoint testing.
参数
- -n, --runs=_N_
- Number of iterations to run (default: 10).
- -c, --concurrency=_N_
- Number of parallel executions (default: 1).
- -d, --duration=_DURATION_
- Run for a fixed duration instead of a fixed number of runs.
- -r, --rate=_RATE_
- Target request rate in requests per second.
- -t, --timeout=_DURATION_
- Per-command timeout (default: 1m).
- -s, --shell=_SHELL_
- Shell to use for command execution (default: /bin/sh).
- --shell-opt=_OPT_
- Shell option, repeatable (default: -c).
- -N, --no-shell
- Execute command directly without wrapping in a shell.
- --csv=_FILE_
- Export results to CSV file.
- --markdown=_FILE_
- Export results to Markdown file.
- --fail-on-error
- Exit with non-zero status if any command returns non-zero exit code.
- --color-scheme=_SCHEME_
- Set color scheme (auto, catppuccin, tokyonight, nord, monokai, solarized, solarized-light, gruvbox, monochrome).
- --list-color-schemes
- Display available color schemes.
- --version
- Display version information.
FAQ
What is the cmdperf command used for?
cmdperf runs one or more shell commands repeatedly and gathers timing statistics, displaying them in a live terminal UI with a progress bar, ETA, and key metrics including mean execution time, standard deviation, and min/max ranges. It supports single command benchmarking, multi-command comparison, concurrent execution to simulate load, duration-based runs, and rate limiting for HTTP endpoint testing.
How do I run a basic cmdperf example?
Run `cmdperf "sleep 0.1"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -n, --runs=_N_ do in cmdperf?
Number of iterations to run (default: 10).