I use the following statements to time the system time used by a routine:

struct rusage ru_start, ru_end;
struct timeval stime;

getrusage(RUSAGE_SELF, &ru_start);
call the routine
getrusage(RUSAGE_SELF, &ru_end);
timersub(&ru_end.ru_stime, &ru_start.ru_stime, &stime);

Sometimes I find that the value of stime.tv_sec is negative (-1). Can
anyone explain the reason for me?

Any help is appreciated.

-Zhihui



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to