On Mon, Nov 29, 1999 at 10:09:35AM +0100, Andrzej Bialecki wrote:
> > I was thinking about implementing SMP cpu stats using sysctl today and
> > I have a question - can I create sysctl nodes dynamically ?
> >
> > i.e.
> >
> > for (cpu = 0; cpu < get_num_cpus(); cpu++) {
> > /* create sysctl node here ? */
> > }
>
> Yes. See for example linux emulator or my SPY module:
>
> http://www.freebsd.org/~abial/spy
>
> You can also create whole new branches, as the second example shows.
Thanks - that was useful. However, I noticed that only the leaves
(SYSCTL_INT/LONG/STRING) etc can be dynamically created. But nodes
can't be dynamically created. Am I correct ?
I'm interested in doing something like:
kern.stats.cpu0.idle
kern.stats.cpu0.nice
...
kern.stats.cpu1.idle
kern.stats.cpu1.nice
...
and I want the nodes cpu0, cpu1 etc dynamically created.
But that's no big deal. I'll define 4 cpus for now and zero the values for
non-existent cpus.
-Arun
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message