Created
January 8, 2011 23:00
-
-
Save snim2/771226 to your computer and use it in GitHub Desktop.
Simple shell script to generate readable performance data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env sh | |
| # (C) Sarah Mount http://snim2.org | |
| # | |
| # Execute a given command and print performance information in a readable manner. | |
| # | |
| # Example: | |
| # | |
| # ./timeit.sh gcc hello.c | |
| # ----------------- Process ----------------- | |
| # Executed: gcc hello.c | |
| # 0 exit status | |
| # ----------------- Time ----------------- | |
| # 0:00.04 real (wall clock) time | |
| # 0.02 user mode time | |
| # 0.01 sys (kernel mode) time | |
| # ----------------- Memory ----------------- | |
| # 0kB total memory used | |
| # 0kB data used | |
| # 0kB share text | |
| # 0kB unshared stack size | |
| # 0kB average set size | |
| # 21424kB maximum set size | |
| # ----------------- Caching ----------------- | |
| # 18 number of involuntarily context-switches | |
| # 13 number of voluntarily context-switches | |
| # 4110 number of minor page faults | |
| # 0 number of major page faults | |
| # 0 number of times the process was swapped out | |
| # ----------------- System ----------------- | |
| # 4096 system page size | |
| time --format="----------------- Process ----------------- \nExecuted: %C\n%x exit status \n----------------- Time ----------------- \n%E real (wall clock) time \n%U user mode time \n%S sys (kernel mode) time\n----------------- Memory ----------------- \n%KkB total memory used\n%DkB data used \n%XkB share text \n%pkB unshared stack size \n%tkB average set size \n%MkB maximum set size \n----------------- Caching ----------------- \n%c number of involuntarily context-switches \n%w number of voluntarily context-switches \n%R number of minor page faults \n%F number of major page faults \n%W number of times the process was swapped out \n----------------- System -----------------\n%Z system page size" $* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment