T: /usr/bin/time with useful by default output

Published a small utility I use almost daily: GitHub - matklad/t-cmd

$ cargo install t-cmd
$ cd ~/projects/ndarray
$ touch src/lib.rs && t cargo test --no-run -q
real 2.30s
cpu  25.57s (20.17s user + 5.40s sys)
rss  273.46mb

It is does a subset of things that /usr/bin/time does, and solves two problems for me:

  • it is not named time, so there's no conflict between the shell's built in and the command I actually want
  • the output is more useful/readable

Unrelated tidbit of knowledge: perf stat is a more advanced version of /usr/bin/time, very useful for ad-hoc performance investigations.

1 Like

An alternative to getrusage(RUSAGE_CHILDREN) is wait4, so you can get the results as soon as the process is finished. I use it for timehistory-bash and it gives the same results as t-cmd, but if you add support for multiple processes in t-cmd, getrusage(RUSAGE_CHILDREN) will mix the results.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.