Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#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 04/03/20 at 17:41:53.
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 04/03/20 at 17:40:08 by Joel Sherrill

Description: modified (diff)

Changed on 04/03/20 at 17:41:53 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 04/03/20 at 17:43:47 by Joel Sherrill

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