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)