Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 May 2005 16:03:08 +0300 (EEST)
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        shiner chen <shiner_chen@yahoo.com.cn>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: how to get the status of cpu in kernel?
Message-ID:  <20050521160013.V18522@gothmog>
In-Reply-To: <20050521104937.70622.qmail@web15509.mail.cnb.yahoo.com>
References:  <20050521104937.70622.qmail@web15509.mail.cnb.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2005-05-21 18:49, shiner chen wrote:
> In order to implement a dispacthing policy I want to get the status of 
> cpu. I have read the code of top command and i find it get the status 
> of cpu by the function :
>
>    int sysctlbyname(const char *, void *, size_t *, void *, size_t);
>
> I search the code of kernel ,then I consider that i can get the status 
> of cpu through the funciton:
>
>     int kernel_sysctlbyname(struct thread *td, char *name,  void *old, 
>         size_t *oldlenp, void *new, size_t newlen,  size_t *retval);
>
> I try to get the status of cpu by that function ,but it does not work!

You're looking at the wrong place.  There is a manpage for the 
sysctlbyname() function, which you obviously missed.

> who can tell me the problem?

Nobody until you show us the source, I guess :-)

> How do i get the status of cpu?
> How do i use it if the funcion is right? what's the mean of the 
> function's arguments ?

Start by reading the manpage of sysctlbyname().  Then, if you still have 
problems, you can post the source online somewhere and point us people 
at the URL.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050521160013.V18522>