Subject: getrusage() problem in hp300 port??
To: None <port-hp300@NetBSD.ORG>
From: Greg Oster <oster@cs.usask.ca>
List: port-hp300
Date: 11/19/1997 13:22:57
Hi folks

Can someone with a NetBSD-1.3_Alpha/hp300 box run this little proggy to see 
if they get the same behaviour I'm seeing under 1.2E on the HP300 port?  

----8<----
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
#define   RUSAGE_SELF     0
main()
{
        struct rusage my_usage;
        int i,j;

        for(i=0;i<10;i++) {
                if( getrusage( RUSAGE_SELF, &my_usage ) < 0 ) {
                        perror( "show" );
                        exit( 1 );
                } else {
                        printf( "%ld + %ld\n", my_usage.ru_utime.tv_sec,
                                my_usage.ru_utime.tv_usec );
                }
                sleep( 2 );
        }
}
----8<----
What I see on the hp300 port is output like:
0 + 76105
0 + 74541
0 + 75267
0 + 75995
0 + 76728
0 + 77460
0 + 73600
0 + 74280
0 + 74964
0 + 75651

This is on:  (NetBSD darlene 1.2E NetBSD 1.2E (MOB2) #23: Tue Jul  8 12:42:30 
GMT+6 1997     wlm125@darlene:/usr/local/home/wlm125/src/sys/arch/hp300/compile
/MOB2 hp300).
Note that one would expect the times to be increasing, or staying the same, 
but certainly not to be decreasing... 

On a i386 box (NetBSD morty.usask.ca 1.2E NetBSD 1.2E (MOBILE.BB) #13: Tue Jul 
 1 16:10:52 CST 1997     wlm125@morty.usask.ca:/home/wlm125/src/sys/arch/i386/c
ompile/MOBILE.BB i386)
I get:

0 + 13777
0 + 15452
0 + 15706
0 + 15953
0 + 16199
0 + 16450
0 + 16699
0 + 16947
0 + 17198
0 + 17461

which appears to be much more correct.  If I can get someone else to verify 
that this problem still exists in 1.3_alpha I'll file a PR on it... 
(I'd upgrade one of our hp300 boxes to 1.3_alpha and test this myself, but 
there are various local reasons not to upgrade (custom kernels, perceived 
stability, etc.))  Of course if it is a problem, and it still exists, then the 
next step is to figure out *why* this behaviour is occuring...

Thanks to Tony Kusalik and his Cmpt330 class (who are using HP300's running 
NetBSD for their class work) for discovering this...

Later...

Greg Oster

oster@cs.usask.ca
Department of Computer Science
University of Saskatchewan, Saskatoon, Saskatchewan, CANADA