4.16. Timing Execution: timeIt is sometimes useful to know how long it takes to run a specific command or program (or more to the point, to know how long it takes relative to how long something else takes) (Figure 4-32).
For example: $ time -p sort allnames.txt >sortednames.txt real 0m 4.18s user 0m 1.85s sys 0m 0.14s $ _ This command tells us it took over 4 seconds of "wall clock" time to sort our file. But the total CPU time used was 1.99 seconds (user time plus system time). The time command is particularly useful when testing programs or scripts on small amounts of data where you can't "feel" the difference in the time required because they run so fast, but you know that when you run on your large amount of "real data," you'll want your program to be as efficient as possible. |