Operating System - HP-UX
1833619 Members
3622 Online
110062 Solutions
New Discussion

Re: pstat_getlwp() and struct lwp_status

 
Chuck Fricano
New Member

pstat_getlwp() and struct lwp_status

The pstat_getlwp() function populates
the lwp_status stuct but the lwp_utime
and wp_stime members contain the user
and system time in seconds according
to the .H include files.

Does anyone to know how to obtain thread/lwp
clock time in sub-second resolution.

Nanoseconds or microseconds would be best.

Thanks,
Chuck
1 REPLY 1
rick jones
Honored Contributor

Re: pstat_getlwp() and struct lwp_status

I cannot say if it is "supported" or not for end-user use, but if you go into:

/usr/include/sys/pstat/lwp_pstat_body.h

and find lwp_utime you will see (on 11.11 and I presume later at least)

struct lwpcycles
lwp_usercycles; /* 64-bit user mode execution cycle count */
struct lwpcycles
lwp_systemcycles; /* 64-bit system mode execution cycle count */
struct lwpcycles
lwp_interruptcycles; /* 64-bit interrupt for thread cycle count */

It is left as an excercise to the reader to find the definition of "lwpcycles" :) (I'd start with:

find /usr/include -exec grep lwpcycles {} \;

myself. And, if those cycles are anything like the system-wide cycles netperf looks at for CPU util, you could probably go into say the src/netcpu_pstatnew.c file of netperf sources:

http://www.netperf.org/svn/netperf2/trunk

and find-out how to manipulate them.
there is no rest for the wicked yet the virtuous have no pillows