On Sat 19 Apr 2008 at 06:43AM, dark0s wrote:
> Hi all, I'd like write a little program in C with kstat framework.
> I would know how can I understand:

You might start by exploring with the kstat(1m) command to
explore system kstats.   It's also useful to know that kstat(1m)
is written in perl; using perl could be helpful for prototyping.

The source code for vmstat, iostat, fsstat, and mpstat are all
available for you to look at, as well.  See:

http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/stat/

> 1) memory usage (of RAM)

vmstat would be a good guide here; check out the vminfo kstat.

> 2) disk usage

examine iostat and/or fsstat for some ideas about how to tackle this.

> 3) disk capacity

I'm not sure what you mean-- the size of disks attached to the system?

> 4) RAM capacity

Of the system as a whole?  That's available from sysconf(3c)-- see
the _SC_PAGESIZE and _SC_PHYS_PAGES entries.  Multiple the first times
the second, to get system memory in bytes.

> 5) CPU usage

Use mpstat as a guide for how to obtain this; another route would
be to use getloadavg(3c), although that is a somewhat coarse
approximation, since it measures an effect of cpu utilization, not
the utilization itself.

> 6) system performance

System performance is described by the all of the above...

Thanks,

        -dp

-- 
Daniel Price - Solaris Kernel Engineering - [EMAIL PROTECTED] - blogs.sun.com/dp
_______________________________________________
tools-discuss mailing list
[email protected]

Reply via email to