CLOCK_GETCPUCLOCKID(3P)

🌸 CLOCK_GETCPUCLOCKID(3P) β€” POSIX Programmer's Manual 🌸

okay so bestie, this is clock_getcpuclockid from the POSIX Programmer's Manual, and I need you to know it's lowkey one of the cutest little functions ever. it hands you the clock ID of a process's CPU-time clock. that's it. that's the whole job. and she does it flawlessly πŸ’…


✨ PROLOG ✨

so this manual page? it's part of the POSIX Programmer's Manual. that means it describes the POSIX interface, not necessarily what Linux does.

heads up bestie: the Linux implementation of this interface may differ β€” so if you're on Linux, go consult the corresponding Linux manual page for the details of Linux behavior. πŸ™ˆ

and like… it's also possible the interface is not implemented on Linux at all. no cap. so vibe check your platform first, okay? πŸ’€


πŸŽ€ NAME πŸŽ€

clock_getcpuclockid β€” access a process CPU-time clock (ADVANCED REALTIME)


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <time.h>

int clock_getcpuclockid(pid_t pid, clockid_t *clock_id);

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea. the clock_getcpuclockid() function shall return the clock ID of the CPU-time clock of the process specified by pid. 🫢

if the process described by pid exists and the calling process has permission, then the clock ID of this clock shall be returned in clock_id. iconic behaviour, honestly.

and if pid is zero? slay. the clock_getcpuclockid() function shall return the clock ID of the CPU-time clock of the process making the call, in clock_id. it's giving "look at me, I'm the main character" energy and I respect it. ✨

now, the conditions under which one process has permission to obtain the CPU-time clock ID of other processes? those are implementation-defined. so like, don't @ me, ask your implementation. iykyk. 🌈


πŸ”₯ RETURN VALUE πŸ”₯

upon successful completion, clock_getcpuclockid() shall return zero. πŸŽ‰

otherwise, an error number shall be returned to indicate the error. not the vibe, but okay, we move. 😭


πŸ’… ERRORS πŸ’…

the clock_getcpuclockid() function shall fail if:

  • EPERM β€” the requesting process does not have permission to access the CPU-time clock for the process. permission denied bestie, sorry 🚫

the clock_getcpuclockid() function may fail if:

  • ESRCH β€” no process can be found corresponding to the process specified by pid. she's not there. she never was. πŸ’€
also, for the record: the following sections are informative. like, that's a whole status. informative. not normative. keep that in mind. πŸ“

🌸 EXAMPLES 🌸

None.

that's the entire section. no examples. she said "figure it out, bestie." πŸ™ˆ


πŸ‘‘ APPLICATION USAGE πŸ‘‘

the clock_getcpuclockid() function is part of the Process CPU-Time Clocks option, and it need not be provided on all implementations. so like β€” not every platform ships her. check before you get attached. πŸ₯²


🌈 RATIONALE 🌈

None.

nothing. empty. the silence is loud. 🀐


⭐ FUTURE DIRECTIONS ⭐

None.

she's not going anywhere, and apparently neither is this section. πŸ•ŠοΈ


πŸ“ SEE ALSO πŸ“

  • clock_getres()
  • timer_create()
  • The Base Definitions volume of POSIX.1‐2017, <time.h>

okay this part is the legal bit so I'm keeping it exactly as she comes, because we do not paraphrase lawyers, bestie. here it is:

Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

and also:

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .

so yeah. referee document. that's the ruling. πŸ§‘β€βš–οΈβœ¨


and that's the whole page!! mwah πŸ’‹ courtesy of IEEE/The Open Group, 2017 β€” that's the source, the version, and the date all rolled into one, and this was CLOCK_GETCPUCLOCKID(3P) from the POSIX Programmer's Manual. go get that CPU-time clock ID, queen πŸ‘‘πŸ¦‹πŸ’–

πŸ“¦ where this page comes from