clock_getcpuclockid()

access a process CPU-time clock 

Advanced Realtime Function


SYNOPSIS

#include <time.h>

int clock_getcpuclockid(pid_t pid, clockid_t *clock_id);


DESCRIPTION

The clock_getcpuclockid() retrieves the clock ID of the CPU-time clock of the specified process (pid) and places it in clock_id. This function only succeeds when the specified process exists and the calling process has permission.

When you specify a value of 0 for pid, clock_getcpuclockid() behaves as though you had specified the process ID of the calling process.

On the NuTCRACKER Platform, you can only retrieve the clock ID for the calling process which is CPU_PROCESS_CPUTIME_ID. If you specify any value for pid other than 0, clock_getcpuclockid() fails. Additionally, the retrieved value can only be used with the clock_getres() and clock_gettime() functions. It cannot be used with clock_nanosleep() or timer_create().


PARAMETERS

clock_id 

Points to the location where the retrieved clock ID is stored.

pid 

Specifies the process ID of a process. This value can be 0 to retrieve the clock ID of the CPU-time clock of the the calling process. On the NuTCRACKER Platform, this value can only be 0.


RETURN VALUES

When successful, clock_getcpuclockid() returns 0.

Otherwise, one of the following values is returned:

EFAULT 

The clock_id argument is a bad pointer.

ENOSYS 

The system does not support this function.


CONFORMANCE

UNIX 03.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

The NuTCRACKER Platform implements this function using the Win32 GetProcessTimes() API.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

api_intro

Functions:
clock_getres(), timer_create()


PTC MKS Toolkit 10.2 Documentation Build 28.