This preview shows page 1. Sign up to view the full content.
Unformatted text preview: icating child times give the accumulated times used by children that have terminated and have been reaped. Thus, times cannot be used to monitor the time used by any ongoing children. As a return value, times returns the total number of clock ticks that have elapsed since the system was started. We can therefore compute the total time (in clock ticks) between two different points in a program execution by making two calls to times and computing the difference of the return values. The ANSI C standard also deﬁnes a function clock that measures the total time used by the current process:
#include <time.h> clock t clock(void);
Returns: total time used by process Although the return value is declared to be the same type clock t used with the times function, the two functions do not, in general, express time in the same units. To scale the time reported by clock to seconds, it should be divided by the deﬁned constant CLOCKS PER SEC. This value need not be the same as the constant CLK TCK. 9.2.3 Accuracy of...
View Full Document
- Spring '10
- The American