Trying to get kernel thread processor time

I have been trying to get kernel thread processor times for graphical monitoring, but the output of ps -AHo comm,time is cutting thread names:
Code:
kernel/zio_write_issue_     0:31,38
kernel/zio_write_issue_     0:31,23
kernel/zio_write_issue_     0:31,19
kernel/zio_write_issue_     0:31,39
kernel/zio_write_issue_     0:00,52
kernel/zio_write_issue_     0:00,53
kernel/zio_write_issue_     0:00,55
kernel/zio_write_issue_     0:00,54
kernel/zio_write_issue_     0:00,52
How can I get these names with processor times with ps() or with something else from the command line? I would like to get the full thread name and the processor time in seconds that was used by this thread.
 
The problem seems to be that the threads names returned by kvm_getprocs (which is called by both ps and top) are limited to 16 characters:
Code:
# ps wwaxHo comm | awk -F/ '/^kernel/{print length($2)}' | sort -n | tail -1
16
#

% grep "thread name" /sys/sys/user.h
#define TDNAMLEN        16              /* size of returned thread name */
        char    ki_tdname[TDNAMLEN+1];  /* thread name */
%
 
I'm no kernel programmer but looking at the things you want to know you probably have more luck using specialized debug tools like ktrace(1) and dtrace(1).
 
Back
Top