(9862) Per-Thread CPU Time? PCA and Threads?

Archive of the OpenVMS Ask the Wizard (ATW) questions and answers database.
Locked

Topic author
User
Visitor
Posts: 0
Joined: Mon Jan 10, 2022 8:16 am
Reputation: 0
Status: Offline

(9862) Per-Thread CPU Time? PCA and Threads?

Post by User » Mon Oct 04, 2004 9:26 am

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 application.

Any pointer towards useful sources of information on using PCA with multi-threaded code would also be much appreciated.

Many thanks,
Steve Lock.
Last edited by marty.stu on Mon Aug 22, 2022 7:03 am, edited 1 time in total.


Wizard
Visitor
Posts: 0
Joined: Mon Jan 10, 2022 8:17 am
Reputation: 0
Status: Offline

Re: (9862) Per-Thread CPU Time? PCA and Threads?

Post by Wizard » Tue Oct 05, 2004 9:26 am

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.)

Code: Select all

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-relevant 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.
Last edited by marty.stu on Mon Aug 22, 2022 7:12 am, edited 1 time in total.

Locked