The 𝗽𝗿𝗼𝗰𝗲𝘀𝘀.𝗰𝗽𝘂𝗨𝘀𝗮𝗴𝗲 method returns the user and system CPU time usage of the current process, in microseconds.
These values measure time spent in user and system code respectively, and may end up being greater than actual elapsed time if multiple CPU cores are performing work for this process.
The result of a previous call to 𝗽𝗿𝗼𝗰𝗲𝘀𝘀.𝗰𝗽𝘂𝗨𝘀𝗮𝗴𝗲 can be passed as the argument to the function, to get a diff reading.
Of course, this method can be used with the 𝗻𝗼𝗱𝗲:𝗼𝘀 module to calculate the CPU usage percentage. I'll post about that later.
Did you learn something new today?
Like and share this post, and follow me for more!
Top comments (0)