Skip to content

Instantly share code, notes, and snippets.

@vadimkantorov
Last active February 3, 2023 23:11
Show Gist options
  • Save vadimkantorov/016326dfce61ddf6f00210440dcaa2c9 to your computer and use it in GitHub Desktop.
Save vadimkantorov/016326dfce61ddf6f00210440dcaa2c9 to your computer and use it in GitHub Desktop.
A Bash alias that wraps /usr/bin/time to produce parsable JSON format output.
alias timejson='/usr/bin/time -f '"'"'{"exit_code" : %x, "time_user_seconds" : %U, "time_system_seconds" : %S, "time_wall_clock_seconds" : %e, "rss_max_kbytes" : %M, "rss_avg_kbytes" : %t, "page_faults_major" : %F, "page_faults_minor" : %R, "io_inputs" : %I, "io_outputs" : %O, "context_switches_voluntary" : %w, "context_switches_involuntary" : %c, "cpu_percentage" : "%P", "signals_received" : %k}'"'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment