#3891 new enhancement

Implement pthread_getcpuclockid()

Reported by: Joel Sherrill Owned by:
Priority: normal Milestone: Indefinite
Component: posix Version:
Severity: normal Keywords: POSIX-Compliance
Cc: Blocked By:
Blocking:

Description (last modified by Joel Sherrill)

The pthread_getcpuclockid() method currently returns ENOSYS. It should be implemented. Since each thread has execution time statistics with it, this should just be a matter of figuring out how the clock id is specified for each thread.

https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_getcpuclockid.html

The thread ID can be reused as the per thread cpu clock ID because it is distinct from any defined clock id.

Beyond adding the one method, the methods clock_gettime and clock_settime must also be modified to support this clock type. There may be other cases where per thread cpu clock id is used. A search for this capability in the POSIX standard will have to be done to ensure all use cases are covered.

This also will require writing test code and updating the POSIX Compliance Guide via the tracking spreadsheet.

Attachments (1)

0001-pthreadgetcpuclockid.c-Implement-pthread_getcpuclock.patch (1.6 KB) - added by Joel Sherrill on Apr 3, 2020 at 5:41:53 PM.
Untested implementation of pthread_getcpuclockid() assuming thread ID is used as the per thread cpu clock id. Needs clock_gettime/clock_settime capabilities added and tests

Download all attachments as: .zip

Change History (3)

comment:1 Changed on Apr 3, 2020 at 5:40:08 PM by Joel Sherrill

Description: modified (diff)

Changed on Apr 3, 2020 at 5:41:53 PM by Joel Sherrill

Untested implementation of pthread_getcpuclockid() assuming thread ID is used as the per thread cpu clock id. Needs clock_gettime/clock_settime capabilities added and tests

comment:2 Changed on Apr 3, 2020 at 5:43:47 PM by Joel Sherrill

Description: modified (diff)
Note: See TracTickets for help on using tickets.