Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/snewcomer/ntimes
Run a command N times
https://github.com/snewcomer/ntimes
Last synced: 3 months ago
JSON representation
Run a command N times
- Host: GitHub
- URL: https://github.com/snewcomer/ntimes
- Owner: snewcomer
- Created: 2020-12-31T17:27:40.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-25T03:19:46.000Z (almost 4 years ago)
- Last Synced: 2024-10-03T12:23:31.870Z (3 months ago)
- Language: Rust
- Size: 10.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ntimes
Execute a command N times
Often times, I want to obtain an average/median of request timing stats for a particular endpoint. This binary makes
it possible for you to obtain reasonable stats by executing your command ntimes.Reasonable: You might be optimizing a specific endpoint, trimming unnecesary data. ntimes can help you measure and obtain reasonable confidence.
Not so much: Hitting an endpiont that returns HTML. While this may be insightful, first input delays is likely more of a concern. Once your application/browser
receives its first bytes, there is still a long way to go before the user can start interacting with your site.### Links
https://blog.cloudflare.com/a-question-of-timing/
## Usage
To send a sync process and wait for each subsequent command to finish.
```
$ ntimes 100 -- curl 'https://google.com' -s -o /dev/null -w "%{time_starttransfer}\n"
```Sends command to child process. This starts subshells in parallel.
```
$ ntimes 100 -p -- curl 'https://google.com' -s -o /dev/null -w "%{time_starttransfer}\n"
```Lastly, to gather your metrics, you can redirect the stdout to the stdin of another command.
```
$ ntimes 100 -- curl 'https://google.com' -s -o /dev/null -w "%{time_starttransfer}\n" | percentile
```[percentile](https://github.com/yuya-takeyama/percentile)
## License
The MIT License