1 Many shell programmers are in the habit of using calls to external commands
2 instead of using shell built-in commands (an example of this is a call to
3 usr/bin/echo instead of using the echo command built into the shell.
5 This script shows sh_wasted.d tracing a shell script that calls /usr/bin/echo
6 instead of using the built-in.
8 # sh_wasted.d -c ./func_waste.sh
9 Tracing... Hit Ctrl-C to end.
13 Script duration: 3101631 us
15 External command elapsed times,
17 func_waste.sh sleep 3019573
19 Wasted command elapsed times,
21 func_waste.sh /usr/bin/echo 26510
23 You can see that the calls to /usr/bin/echo took around 26 thousand
24 microseconds; time wasted by the shell having to access an external command.
27 Here we trace the same script, except it uses the shell built-in echo command.
29 # sh_wasted.d -c ./func_abc.sh
31 Tracing... Hit Ctrl-C to end.
34 Script duration: 3032616 us
36 External command elapsed times,
38 func_abc.sh sleep 3012920
40 Wasted command elapsed times,
43 The total time here is less and there are no 'wasted' calls to external