[Novalug] kernel plugin per process accounting?

Mark Smith mark@winksmith.com
Sun Oct 14 23:39:39 EDT 2012


after a bit of research, i've noted something called Comprehensive System
Accounting (CSA).  it was in a kernel doco dated 2000-05-04 so it's a
bit out of date.  i'm pretty sure it's been superceded by other cool stuff.

i noted some cool io information that is accessible via /proc.  for instance,
this gives the io stats for the life of the process:

	$ cat /proc/$$/io
	rchar: 628704
	wchar: 14428
	syscr: 1011
	syscw: 288
	read_bytes: 0
	write_bytes: 16384
	cancelled_write_bytes: 0

there is, of course, the other normal cool stuff in /proc.  including
these fine charmers:

	/proc/<pid>/mountinfo - not available on probe
	/proc/<pid>/fd/* - open file descriptors
	/proc/<pid>/stat - current information about the process
	/proc/stat - global information.

i can use /proc/<pid>/stat to figure out a great many things.  this is
what 'ps' is using behind the scenes for much of what it reports.

the sad news is that there is no already-built tools for collecting this
information historically over time.  i'd need to write up some scripts
to collect this fine information.  it's not builtin like sar is.

for instance, this is overkill and on my system takes between 1 and 4
seconds to complete.

	d=/tmp/proc/`date +%Y-%m-%d_%H:%M%S`
	mkdir $d || exit 1
	cp -a /proc/[0-9]* $d > /dev/null 2>&1

and as a db, it's big.  each sample on my system is 83MB.  i guess i'd
have to tune it down quite a bit.  only pick the pids i need, and only
the bits within the /proc that is useful.

then figure out how to graph it all.

gosh, hasn't anyone done any performance on linux?  there's gotta be
better measurement tools.

On Fri, Oct 12, 2012 at 01:59:39PM +1300, Mark Smith wrote:
> does anyone know of any per process kernel accounting software?
> 
> i can see one of my processes being used, but i don't know which process
> it is.  likewise, i can see a process firing off using lastcomm, but i
> don't know anything about that process historically.  where did it run?
> what resources did it use?  not even what were it's parameters!
> 
> i realize there will be some overhead, but i need to figure out some of
> this stuff and i'm flying blind.

-- 
Mark Smith
mark@winksmith.com
mark@tux.org



More information about the Novalug mailing list