Path: utzoo!utgpu!news-server.csri.toronto.edu!helios.physics.utoronto.ca!ists!yunexus!HP-UX!zhengbin From: zhengbin@HP-UX.yorku.ca (zhengbin wang) Newsgroups: comp.unix.aux Subject: getrusage command Message-ID: <22686@yunexus.YorkU.CA> Date: 8 May 91 23:48:58 GMT Sender: news@yunexus.YorkU.CA Reply-To: zhengbin@clid.UUCP (zhengbin wang) Distribution: comp.unix.aux Organization: York University Mathematics Department Lines: 41 Hi, I am writing a short program as follows to test the usage of the command getrusage, but the result is puzzling. Can anybody help me with it? Thanks in advance. Zhengbin@clid.yorku.ca This is this result I got by running the compiled program. =================== a.out User time is 0 signal received1 message received0 User time is 0 User time is 0 ================== #include #include #include #include #include main () { struct rusage pt_rusage; register int i,j; system("sleep 3\n"); wait(); getrusage(-1, &pt_rusage); fprintf(stderr,"User time is %d \n",pt_rusage.ru_stime.tv_sec); system("sleep 3\n"); for ( i = 3; i <= 120; i ++ ) j=2; getrusage(RUSAGE_SELF, pt_rusage.ru_nsignals); fprintf(stderr,"signal received%d \n", pt_rusage.ru_nsignals); fprintf(stderr,"message received%d \n", pt_rusage.ru_msgrcv); fprintf(stderr,"User time is %d \n",pt_rusage.ru_stime.tv_sec); fprintf(stderr,"User time is %d \n",pt_rusage.ru_stime.tv_sec); }