Monitoring CPU usage bug

  • 497 Views
  • Last Post 06 August 2018
  • Topic Is Solved
NeoXen posted this 09 February 2018

Hi there,

I don't know if this has been reported already or if this is a problem specific to my setup, so sorry if I missed out on something. If so, feel free to close this immediately ;)

As you can see, AMP shows 2% CPU usage for my Minecraft server, while the server reports 64% (the minecraft server is the only java-app that I use).

How does AMP get the info from the system? Is there anything I can change to get this right?

Greetings and thanks in advance,

Neo

enter image description here

System: Ubuntu 16.04 LTS

AMP Version: AMP Release "TN/SR4" v1.6.0.0, built 20/01/2018 15:59

Order By: Standard | Newest | Votes
Mike posted this 10 February 2018

How many CPU cores does the system have? There's a difference in how AMP and top report CPU usage so its probably the intended behaviour.

NeoXen posted this 11 February 2018

How many CPU cores does the system have? There's a difference in how AMP and top report CPU usage so its probably the intended behaviour.

Hi Mike, the system (VPS) has 6 vCores.

Mike posted this 11 February 2018

Try turning off Multicore CPU usage calculation under the Monitoring settings.

NeoXen posted this 11 February 2018

Try turning off Multicore CPU usage calculation under the Monitoring settings.

This actually changed nothing, seems to display the same as before ;D

Possemaster posted this 05 June 2018

Any update on CPU calculation?

If I have "Multicore CPU usage calculation" Turned on , it never goes above 1% or 2% which is very very incorrect. And if I turn "Multicore CPU usage calculation" off it almost always shows 100% which is incorrect as well.

I have tuned all cores (affinity) on during creation of the Minecraft instance but this does not change a damn thing.

This software for me is useless if I cannot see how my CPU utilization is.

Please fix it!!!

I tried latest build 1.6.8.0 and now I am on nightly 1.7.0.0 but it does not change anything.

enter image description here

Mike posted this 05 June 2018

Is this running in a virtual machine or on real hardware? AMP actually just asks the OS for CPU/RAM usage information but that data isn't always correct in certain types of VM.

We're looking to changing to a different mechanism to get this info based on the Windows Performance Counters but we're not sure how that'll behave yet.

Possemaster posted this 20 July 2018

It is NOT running in a VM. It is running on a dedicated machine with a I7 8700k (6-core). Just tried all the settings again, mulicore calculation on or off, Set the affinity mask in the config to 4095 or 0 does not change anything. The Java process is using all cores but AMP does not see it correctly. I think it is a calculation error As i see my CPU % in WIndows in the 10% range in AMP it says 1% when i see it in WIndows on the 20% range in AMP it shows 2% and once I hit 30% in Windows it shows 3%. So it looks like a decimal point error or so. Is it possible to change something in the code to show decimal number like 2 decimals? Than I can confirm this

Mike posted this 21 July 2018

Check out the latest Nightly build. A windows update broke the mechanism AMP used to monitor CPU usage. We've swapped to a new system using the system performance counters.

Possemaster posted this 23 July 2018

Well that did not work.

Even memory usage is broken now.

I set affinity mask to 0 and memory goes to 851 max , when I set affinity mask to 4096 memory goes to 1. CPU Usage goes to max 8% enter image description here

Mike posted this 23 July 2018

Don't mess with the affinity mask. If you've changed the multicore flag you might need to change that too.

AMP just asks the OS for the CPU and memory usage so if anything differs between it and task manager it's usually down to either timing or what specifically is being shown.

Possemaster posted this 24 July 2018

I put the affinity mask back to 0. Mulicore calculation flag is on. Same issue. RAM calculation is wrong and CPU only goes to 8%

Reverted back to Latest release and RAM is working fine and CPU is back to 0%

Mike posted this 24 July 2018

Use the resource monitor, not the task manager.

Possemaster posted this 27 July 2018

That has the exact same result. Why would that be any different?

enter image description here

Mike posted this 27 July 2018

Are you perchance using an Intel CPU with Hyperthreading enabled?

Mike posted this 27 July 2018

I'm pretty sure I've found out what's going on. It's to do with how you calculate CPU usage on SMT/hyperthreaded systems. Normally if you query the number of CPU cores that'll include hyperthread 'cores', so a quad core i7 will show up as 8 cores. But if you use that as the divisor you get the wrong result. This why VMs don't show this issue and neither do systems that don't have SMT or have it disabled.

Next nightly queries the number of actual CPU cores and uses that. Try it out and see how that behaves for you.

Possemaster posted this 28 July 2018

OK, that makes sense. Indeed it is a hyperthreaded CPU.

I'll try the next nightly and hope it fixes this.

Thanks

Possemaster posted this 05 August 2018

SO , Tried the next nightly, and it just doubles the CPU usage from max 8% to max 16%.

Still does not ressemble the actual usage of my system. Also tried this nightly on a second machine with a 8086k also a 6 core with hyperthread. Same result.

enter image description here

Mike posted this 05 August 2018

I can't reproduce this. For me AMP shows the same value as task manager to within a margin of 1% or so. This is on an i7 7700.

Edit: For anyone looking at this who knows about WMI, AMP is doing the following internally:

SELECT PercentProcessorTime,WorkingSetPrivate,IOReadBytesPersec,IOWriteBytesPersec FROM Win32_PerfFormattedData_PerfProc_Process WHERE IDProcess = {Id}

So this should show the same data as the performance monitor. But since it's the OS returning this data then if it's wrong it wouldn't be considered a bug in AMP.

I'm dropping an update into Nightly that allows you to actually control whether or not to take SMT (hyperthreading) into account when calculating CPU usage. On my system the following setup gives the same number as task manager:

Multicore CPU usage calculation: ON

IgnoreSMTCores: OFF

CPU Usage in ARK

Possemaster posted this 06 August 2018

OK, let me add to this.

As long as the CPU usage is lower than 16% the calculation is correct now. So If the server is consuming 9% AMP shows 9% If the server is using 11% AMP shows 11%

BUT. If the server consumes 17% AMP shows 16% and all above also shows 16%

Maybe this helps. I think at the moment it is acting like it is capped at 16%

Close