Forum - C APIs to get time or clock

Jump to navigation Jump to search
Overview > Topics > Tuning > C APIs to get time or clock
[#61]

Some of APIs invoke a system call to get time or clock. But, a system call from a VE program takes time because communication between VE and VH is required. So, some of them are implemented to get time or clock quickly by reducing the invocation of a system call. They invoke a system call at the first time only. They do not invoke any system call at the next time. They read a counter of VE, calculate time or clock and return the result. We call them as "quick call implementation".

The below is the current status of VEOS v2.6.2 which was released on 31st July. 2020.

API option available? quick?
gettimeofday() Yes Yes
clock_gettime() CLOCK_REALTIME Yes Yes
clock_gettime() CLOCK_REALTIME_COARSE Yes Yes
clock_gettime() CLOCK_MONOTONIC Yes Yes
clock_gettime() CLOCK_MONOTONIC_COARSE Yes Yes
clock_gettime() CLOCK_MONOTONIC_RAW Yes Yes
clock_gettime() CLOCK_BOOTTIME Yes Yes
clock_gettime() CLOCK_PROCESS_CPUTIME_ID Yes No
clock_gettime() CLOCK_THREAD_CPUTIME_ID Yes Yes
clock_gettime() The clock id returned by pthread_getcpuclockid() Yes No
clock_gettime() The clock id returned by clock_getcpuclockid() Yes No
getrusage() RUSAGE_SELF Yes No
getrusage() RUSAGE_CHILDREN Yes No
getrusage() RUSAGE_THREAD Yes No
clock() Yes No
time() Yes No
times() Yes No

If your program invokes an API to get time or clock frequently, please invoke an API which is quick call implementation, to get better performance.

Posted by NEC admin (administrator) on 23 June 2022 at 01:18.

Some of C APIs to get time or clock became quick call implementation in VEOS v2.4.1 which is released on 31st Mar. 2020.

I have updated the current status describe in this topic.

Posted by NEC admin (administrator) on 23 June 2022 at 01:19.

VEOS v2.6.2 supports times() though it is not a quick call implementation. I have updated the current status describe in this topic.

Posted by NEC admin (administrator) on 23 June 2022 at 01:19.