HP OpenVMS Systems

ask the wizard
Content starts here

Per-Thread CPU Time? PCA and Threads?

» close window

The Question is:

Is there any way to determine how much CPU time has been accumulated by
 individual threads in a multi-threaded application?
The lib$*_timer routines appear to work on a process-wide basis (even with a
 unique timer handle for each thread).
As an aside, I'm having to take this route because I've had very limited
 success with using PCA to analyse the execution profile of my multi-threaded
Any pointer towards useful sources of information on using PCA with
 multi-threaded code would also be much appreciated.
Many thanks,
Steve Lock.

The Answer is :

  The OpenVMS Wizard is aware of no standards-compliant, documented,
  portable, and/or supported means to obtain this information.
  A non-portable and undocumented mechanism does exist on the most
  recent POSIX Threads releases, specifically on OpenVMS Alpha V7.3-2
  with the VMS732_PTHREAD-V0100 or later ECO installed.  (This
  interface is undocumented, unsupported, and subject to change
  without notice, of course.)
  extern int pthread_getcputime_np( pthread_t, struct timespec * );
  Status return values:
    0       Success
    EINVAL  NULL cputime parameter
    ESRCH   handle is not a thread
    ENOTSUP can't return CPU time for SCS thread (UNIX only)
    -ESTALE warning that value is out of date (target is running)
  The DECset Performance and Coverage Analyzer (PCA) tool is not
  cognizant of POSIX Threads.
  Potentially-relevent topics here in Ask The Wizard include
  (1661), (2790), (3283), (3443), (4647), (5842), (6099), (6984),
  (8938), and other topics referenced by these topics.  Manuals
  including the POSIX Threads manual and the debugger manual
  will also be of interest -- the debugger can be programmed,
  of course.

answer written or last revised on ( 5-OCT-2004 )

» close window