using get_system_info() - obtaining system load averages
kamal kc
kamal_ckk at yahoo.com
Mon Jan 9 23:59:16 PST 2006
--- Dan Nelson <dnelson at allantgroup.com> wrote:
> In the last episode (Jan 09), kamal kc said:
> > dear everybody,
> >
> > i want to use the routine get_system_info() to get
> the load averages
> > of the cpu. i found it that top uses it.
>
> get_system_info is just a function /in/ top itself
> that gets the CPU
> usage. It uses the vm.loadavg sysctl to get the
> load average. A
> simpler way is to just call the getloadavg()
> function; see its manpage
> for more info.
thanks i tried getloadavg() it worked.
but when i tried to put it in the kernel the kernel
failed to link.
i also looked at sysctl(3) and i guess it is also for
user
based programs.
so i looked at the sys/sysctl.h and found that there
was
sysctl_find_oid() that was defined for kernel. but i
don't
know how to use it. i could not get any info on the
web.
the function declaration was ::
int sysctl_find_oid(int *name, u_int namelen, struct
sysctl_oid **noid,
int *nindx, struct sysctl_req *req);
isn't it the function i should be using to retrieve
the sysctl
value ???
how should i use it ??
any demo on using it would be immensely helpful for
me.
thanks,
kamal
__________________________________________
Yahoo! DSL Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com
More information about the freebsd-hackers
mailing list