28 minutes ago · Tech · hide

time is a POSIX utility for timing commands. Most shells build it in, and Zsh’s version has a lot more to offer than the one in Bash. Put time before a command to time it. For example, to time a Python script: $ time python example.py python example.py 1.33s user 1.73s system 74% cpu 4.114 total When the command finishes, Zsh prints a single line to standard error, which contains: python example.py: the command, or “job”, that was timed. 1.33s user: user CPU time, the time the CPU spent running the program’s own code. 1.73s system: system CPU time, the time the CPU spent in the kernel on the program’s behalf. 74% cpu: the amount of CPU used in the duration, calculated as (user + system) / elapsed. 4.114 total: the elapsed time, also known as “wall clock time”, from start to finish. This one-line format differs from Bash’s time, which prints three lines, labelled real, user, and sys. But the numbers have the same meanings. The CPU percentage is a useful clue for what a program is…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town