Subject: Re: NetBSD/pc532 ToDo list
To: Phil Nelson <phil@steelhead.cs.wwu.edu>
From: Jon Buller <jonb@metronet.com>
List: port-pc532
Date: 07/04/1995 14:27:55
>   As for a small project ... you could investigate why profiling of
> programs is not working.  I have no clue if the problem is in user
> land or system land.

Well, after a few initial looks, I would say that at least it
appears that the SYS_profil syscall has not been implemented.  The
gprof man page makes reference to the profil(2) man page.  Doing
a "find /usr/src/sys -type f -print | xargs grep SYS_profil"
responds with:

./compat/hpux/hpux_syscall.h:#define    HPUX_SYS_profil 44
./compat/linux/linux_syscall.h:#define  LINUX_SYS_profil        98
./compat/sunos/sunos_syscall.h:#define  SUNOS_SYS_profil        44
./compat/ultrix/ultrix_syscall.h:#define        ULTRIX_SYS_profil       44
./sys/syscall.h:#define SYS_profil      44

I'd expect it to show up in a .c file somewhere too.  My kernel
was sup'd on May 20, so it's a bit old, but I'd expect that one of
the ports had profil(2) working before May 20.  Is that header file
not used in the kernel anywhere?  I wouldn't be suprised if the
man pages are wrong in places, I haven't dug into gcrt0, and
I don't know how to find the code that implements each individual
syscall if the find|grep I did is useless. 8-(  On the other hand,
profiling does work, when 0.0 is the right answer 8-)

Anyway, I wrote a program to call profil(2) and print out the results,
it should have had a 2 byte granularity, and I sampled nearly the first 20KB
of memory.  Every bucket returned was 0, adding further evidence of the
syscall being wrong.

Any suggestions from here?  (Pointers to the kernel profil(2) code, or the
true way gprof is implemented would be helpful, if these guesses are wrong.)

Jon