Re: better resolution for getrusage()?

Ben Wing (wing@666.com)
Thu, 29 Feb 1996 17:40:33 GMT


Rogier Wolff writes:
> Ben Wing wrote:
> >
> > It would sure be nice if getrusage() had microsecond resolution like
> > gettimeofday() did. How hard would this be to add?
>
> Very.
>
> Moreover the overhead would be significant. The guts of a
> gettimeofday() call takes around 17us. On the other had this might
> be worth it for some people.....

I asked because I just implemented some profiling in XEmacs, and I
was trying to figure out a way to get more accurate timings. If
getrusage() had so much overhead, it might not be useful, but it
would still help immensely if there were a way of getting SIGPROF's
to occur more than 100 times per second.

If I change HZ to 1000 and recompile my kernel, will this work?

How about a way to change this without recompiling the kernel?
E.g.

-- make HZ be a variable instead of a preprocessor constant.
-- add a system call (callable by root only, of course) that
changes the frequency of the system clock.

I have no idea how difficult this would be, i.e. if it would wreak
havoc on some device drivers.

ben