0

I'm trying to measure the CPU% consumed by my app on a multi-core machine, meaning htop CPU% reports can go over 100%. I'm trying to get a simple read on CPU usage difference when I run my app in one configuration vs. another, but the change is likely less than 1% CPU and I'm seeing the following "107." for my process:

107 dot

I guess they hardcoded the CPU% column to only support 4 characters... is there a way to expand the width of this column so I can see fractional parts of three digit CPU% values? Ideally two digits of precision past the decimal.

1

I'm pretty sure that is going to be wasted precision*, in the sense that once you get to four significant digits the sampling would have to be accurate to more than 1 part in 1,000 and for five digits it would have to be more than one part in 10,000. It is very unlikely that the sampling is going to be accurate enough to detect that. And that's not even taking into account any inaccuracies because of other processes running on the same machine.

Instead, what is usually done is running the code in a profiler, which can give accurate measurements of the performance of the code in isolation.

* Like the joke about the museum employee telling people a dinosaur is 50,000,003 years old. Why so precise? Because it was dated as 50 million years old three years ago.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.