4 ms·
Please, correct me if I'm wrong: when I invoke "time" on a Unix system (eg. 'time ./a.out'), is the reported execution time calculated from start to finish, or
by smoldesu 5y ago
Please, correct me if I'm wrong: when I invoke "time" on a Unix system (eg. 'time ./a.out'), is the reported execution time calculated from start to finish, or is it calculated from the sum of CPU cycles? Perhaps a silly question, but I'm curious if *nix developers had the foresight to play with this at any point.
- strken 5y agoReal is the wallclock execution time, user and sys are the CPU time for userland and kernel respectively.
- adrian_b 5y agoYes, "real" is the time from start to finish and for a multi-threaded program "user" and "sys" will be the sums of the corresponding times for all threads, so normally "user" will be many times greater than "real" in that case.
- jjav 5y agoHere's an easy test which answers the question: % time sleep 1 sleep 1 0.00s user 0.01s system 0% cpu 1.011 total