Opened 5 years ago
Closed 6 days ago
#15615 closed enhancement (fixed)
pthread_getcpuclockid support
Reported by: | kallisti5 | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta6 |
Component: | System/libroot.so | Version: | R1/Development |
Keywords: | pthread | Cc: | |
Blocked By: | Blocking: | ||
Platform: | All |
Description
Seems to exist on all platforms and BSD's except Apple.
Here's an example usage from Mesa:
/* Return the time of a thread's CPU time clock. */ static inline int64_t u_thread_get_time_nano(thrd_t thread) { #if defined(HAVE_PTHREAD) && !defined(__APPLE__) struct timespec ts; clockid_t cid; pthread_getcpuclockid(thread, &cid); clock_gettime(cid, &ts); return (int64_t)ts.tv_sec * 1000000000 + ts.tv_nsec; #else return 0; #endif }
Change History (8)
comment:1 by , 5 years ago
comment:3 by , 20 months ago
Haiku exposes that we support this with _POSIX_THREAD_CPUTIME in posix/unistd.h
We should probably remove this from the file untill we have implemented it?
comment:4 by , 19 months ago
NOTE: This is not required for POSIX nor UNIX 2003 compatibility/compliance. We can close this ticket as it is not a bug/nor considered implemented yet.
comment:5 by , 19 months ago
Type: | bug → enhancement |
---|
That makes it an enhancement but there is no need to close it...
Also nephele is correct that we have a define in unistd.h announcing that we support it when that isn't the case, so at least that define should be removed.
comment:8 by , 6 days ago
Milestone: | Unscheduled → R1/beta6 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
One can use get_thread_info() and sum the user_time and kernel_time in the returned struct to get the equivalent on Haiku. We have only microsecond resolution, however.