Re: Fwd: Re: kstat - an API for gathering kernel stats

1999-12-08 Thread Louis A. Mamakos

> On Wed, 8 Dec 1999, Arun Sharma wrote:
> > 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. 
> 
> It would be better to have
> 
> kern.stats.nice.cpu0
> kern.stats.nice.cpu1
> 
> or simply
> 
> kern.stats.nice.0

Yes, please!  It would be helpful if the kernel's MIB used instances 
(and there was easy support for creating them) like the MIBs many of
us use SNMP to access in network elements.

louie




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Fwd: Re: kstat - an API for gathering kernel stats

1999-12-08 Thread Matthew N. Dodd

On Wed, 8 Dec 1999, Arun Sharma wrote:
> 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. 

It would be better to have

kern.stats.nice.cpu0
kern.stats.nice.cpu1

or simply

kern.stats.nice.0

-- 
| Matthew N. Dodd  | '78 Datsun 280Z | '75 Volvo 164E | FreeBSD/NetBSD  |
| [EMAIL PROTECTED] |   2 x '84 Volvo 245DL| ix86,sparc,pmax |
| http://www.jurai.net/~winter | This Space For Rent  | ISO8802.5 4ever |



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Fwd: Re: kstat - an API for gathering kernel stats

1999-12-08 Thread Arun Sharma

On Wed, Dec 08, 1999 at 05:44:31PM +0100, Andrzej Bialecki wrote:
> On Wed, 8 Dec 1999, Arun Sharma wrote:
> Erhm.. No.
> 
> Look closer at the SPY module. I create the whole branch from the root
> level. In the standard system there is no such thing as "kld" node,
> neither there is a "spy" node. I created both of them. Only then I created
> a bunch of leaves (of course, nothing stops you from creating some more
> leaves on each intermediate level, if you need them).

Given a number N, whose value is determined at run time, could you have
created N kld nodes ?

-Arun



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Fwd: Re: kstat - an API for gathering kernel stats

1999-12-08 Thread Andrzej Bialecki

On Wed, 8 Dec 1999, Arun Sharma wrote:

> 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 ?

Erhm.. No.

Look closer at the SPY module. I create the whole branch from the root
level. In the standard system there is no such thing as "kld" node,
neither there is a "spy" node. I created both of them. Only then I created
a bunch of leaves (of course, nothing stops you from creating some more
leaves on each intermediate level, if you need them).

The same is with linux emulator. It creates "compat" node, then
"linux" node, and then a couple of sysctls.


Andrzej Bialecki

//  <[EMAIL PROTECTED]> WebGiro AB, Sweden (http://www.webgiro.com)
// ---
// -- FreeBSD: The Power to Serve. http://www.freebsd.org 
// --- Small & Embedded FreeBSD: http://www.freebsd.org/~picobsd/ 




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Fwd: Re: kstat - an API for gathering kernel stats

1999-12-08 Thread Arun Sharma

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



Re: Fwd: Re: kstat - an API for gathering kernel stats

1999-12-08 Thread Andrzej Bialecki

On Wed, 8 Dec 1999, Dan Seguin wrote:

> 
> Is it possible to make nodes dynamically that are immutable from userland
> (even by root), but modifyable from the kernel?

Yes, of course. Just mark them as read-only (CTLFLAG_RD). You are free to
assign any value to them within the kernel. If it's more complex type
handled with SYSCTL_PROC (like eg. vm.zone sysctl) you still can decide
what value you return from kernel, and you can ignore any requests to
assign new values.

> 
> On Mon, 29 Nov 1999, Andrzej Bialecki wrote:
> 
> > 
> > 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.
> > 
> > Andrzej Bialecki
> > 
> > //  <[EMAIL PROTECTED]> WebGiro AB, Sweden (http://www.webgiro.com)
> > // ---
> > // -- FreeBSD: The Power to Serve. http://www.freebsd.org 
> > // --- Small & Embedded FreeBSD: http://www.freebsd.org/~picobsd/ 
> 
> 
> 
> 
> Dan SeguinTexar Software, Corporation.
> 
> Visit us at the RSA Conference 2000, January 16-20, San Jose,  Booth # 1241
> 
> 
> 
> 


Andrzej Bialecki

//  <[EMAIL PROTECTED]> WebGiro AB, Sweden (http://www.webgiro.com)
// ---
// -- FreeBSD: The Power to Serve. http://www.freebsd.org 
// --- Small & Embedded FreeBSD: http://www.freebsd.org/~picobsd/ 




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Fwd: Re: kstat - an API for gathering kernel stats

1999-12-08 Thread Dan Seguin


Is it possible to make nodes dynamically that are immutable from userland
(even by root), but modifyable from the kernel?


On Mon, 29 Nov 1999, Andrzej Bialecki wrote:

> 
> 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.
> 
> Andrzej Bialecki
> 
> //  <[EMAIL PROTECTED]> WebGiro AB, Sweden (http://www.webgiro.com)
> // ---
> // -- FreeBSD: The Power to Serve. http://www.freebsd.org 
> // --- Small & Embedded FreeBSD: http://www.freebsd.org/~picobsd/ 




Dan Seguin  Texar Software, Corporation.

Visit us at the RSA Conference 2000, January 16-20, San Jose,  Booth # 1241




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Fwd: Re: kstat - an API for gathering kernel stats

1999-11-29 Thread Andrzej Bialecki

On Sun, 28 Nov 1999, Arun Sharma wrote:

> 
> [ For some reason, this post through muc.lists.freebsd.hackers gateway didn't
>   show up on the mailing list. Forwarding it to the mailing list.. ]
> 
> On Thu, 04 Nov 1999 20:38:50 -0800, Mike Smith <[EMAIL PROTECTED]> wrote:
> > > I don't see any examples in sys/modules. The SYSCTL_INT macros eventually
> > > expands to DATA_SET which puts certain data in a different ELF section.
> > 
> > You don't do anything magic at all; it's handled invisibly by the 
> > kernel linker.
> 
> 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.

Andrzej Bialecki

//  <[EMAIL PROTECTED]> WebGiro AB, Sweden (http://www.webgiro.com)
// ---
// -- FreeBSD: The Power to Serve. http://www.freebsd.org 
// --- Small & Embedded FreeBSD: http://www.freebsd.org/~picobsd/ 



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Fwd: Re: kstat - an API for gathering kernel stats

1999-11-28 Thread Arun Sharma


[ For some reason, this post through muc.lists.freebsd.hackers gateway didn't
  show up on the mailing list. Forwarding it to the mailing list.. ]

On Thu, 04 Nov 1999 20:38:50 -0800, Mike Smith <[EMAIL PROTECTED]> wrote:
> > I don't see any examples in sys/modules. The SYSCTL_INT macros eventually
> > expands to DATA_SET which puts certain data in a different ELF section.
> 
> You don't do anything magic at all; it's handled invisibly by the 
> kernel linker.

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 ? */
}

Also, one simple solution to maintaining per cpu stats is to put the whole
thing in struct globaldata. All existing code remains unchanged and 
automagically updates the per cpu stats. I may need to add some additional
variables, which reflect system wide data. Now, if I put stuff in globaldata
and try to export it using sysctl, things get a little more complex.

One solution to the above problem is to use SMPpt relative addresses in
the sysctl declarations. But given that the number of CPUs is known only
at runtime, we come back to the first question in this mail.

-Arun
 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message