Gathering system usage stats
Gathering system usage stats
- Subject: Gathering system usage stats
- From: Thomas Inskip <email@hidden>
- Date: Mon, 7 May 2007 18:43:59 -0400
Hi, I am a born-again Mac programmer, who's spent the the last few
years doing linux server development. A new project has fallen on my
lap which requires gathering and analysis of quite a bit of system
usage information on a per-process (task?) basis. I need to gather
at least the following: CPU usage, memory usage (total allocated
memory, resident memory, wired memory, page file usage), I/O
information (bytes read/write, from/to disk or network devices). It
would also be good to have other information such as graphics device
access stats and audio device stats.
I figured a good way to get started would be to look at the source
for top, and I really hope there is an easier, softer way to go about
this. top relies on sysctl to gather kernel process info, and
iterates trough a process' thread info in order to gather things like
CPU utilization data. If I have to go about it that way, I will, but
was wondering if there is a more straight-forward approach. Also,
the I/O statistics (network and disk) gathered by top are on a global
basis, rather than on a per-process basis (it iterates through the
different block devices and network interfaces to collect this
data). Is accounting of these stats available per-process or per-
thread?
The impression I am getting is that some information is available via
the kernel, other via the BSD subsystem, other via the IOKit APIs. I
don't know how much overlap there is, or which is the best way to get
to this information.
Any help pointing me in the right direction would be greatly
appreciated.
Thanks.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden