On Wed, Feb 18, 2009 at 08:18:20PM +0100, Nikola Kne??evi?? wrote: > Hi, > > I would like to obtain fore mentioned data from within my module. I > need these performance metrics to see how certain code executes, and > make decisions during the runtime. pmc(3) seems complete, but it also > seems to be intended for use in the userland. > > How to use pmc from modules? Is there any other way? Also, module is > amd64 only, so I don't care about portability.
I'm not sure what you mean by "module" ini this context. But CPU utilization my be found in the kern.cp_time sysctl value; per-core utilization may be found in the kern.cp_times sysctl value. Note that these are arrays of counters; a given set of values will be foir "user", "nice", "system", "interrupt", and "idle" CPU time (in that order). The differences between respective counters at each end of a time interval of interest will be informative. Peace, david -- David H. Wolfskill da...@catwhisker.org Depriving a girl or boy of an opportunity for education is evil. See http://www.catwhisker.org/~david/publickey.gpg for my public key.
pgpl6UfrUne2i.pgp
Description: PGP signature