HPL_ptimer_cputime(3)
π HPL_ptimer_cputime β bestie edition π
okay so you're in the HPL library functions section (HPL_ptimer_cputime(3), hey girl hey π), and this lil cutie is all about returning the CPU time. that's it, that's the whole vibe. let's get into it π«Ά
β¨ NAME β¨
HPL_ptimer_cputime β returns the CPU time. literally her whole job π
πΈ SYNOPSIS πΈ
#include "hpl.h"
double HPL_ptimer_cputime();
yes bestie, she takes no arguments and hands you back a double. no thoughts, just time β±οΈ
π¦ DESCRIPTION π¦
so HPL_ptimer_cputime returns the cpu time. simple. elegant. iconic.
but how she gets it? that depends on what you defined, and this is the part where you gotta pay attention π
- if
HPL_USE_CLOCKis defined β theclock()function is used to return an approximation of processor time used by the program. the value returned is the CPU time used so far as aclock_t; and to get the number of seconds used, the result is divided byCLOCKS_PER_SEC. and fun fact bestie: this function is part of the ANSI/ISO C standard library β¨ - if
HPL_USE_TIMESis defined β thetimes()function is used instead. this function returns the current process times.times()returns the number of clock ticks that have elapsed since the system has been up π - otherwise, and by default β the standard library function
getrusage()is used π
so like, three possible routes, one adorable little double at the end of it. the way that she adapts?? obsessed π
ngl bestie, make sure you know which macro you're compiling with, because the answer you get comes from a different function depending on it. no cap π
π SEE ALSO π
HPL_ptimer_walltime(3) β for when you want the wall-clock bestie instead π°οΈHPL_ptimer(3) β the main character of the timer family π
and that's the whole page, periodt π this was HPL version 2.2, dated February 24, 2016 β so she's been serving accurate CPU time since way back, and she still ate fr fr ππ§β¨
π¦ where this page comes from
- fedora 43: hpl-doc 2.2-22.fc43 Β· LicenseRef-Callaway-BSD-with-advertising
- fedora 44: hpl-doc 2.2-23.fc44 Β· LicenseRef-Callaway-BSD-with-advertising
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms