ClassiCube / MCGalaxy

A Minecraft Classic / ClassiCube server software
GNU General Public License v3.0
174 stars 82 forks source link

Stop using performance counter to measure 'all processes CPU usage' in /sinfo #712

Closed UnknownShadow200 closed 2 years ago

UnknownShadow200 commented 2 years ago

Using performance counters does have some overhead (e.g. on Windows takes ~2 seconds to initialise and uses extra ~2.5 MB of memory), which is probably overkill for just one informational line in one command

There are also some issues with using them to measure 'all processes CPU usage'

So should instead switch to using OS specific 'get all CPU time' functions, such as e.g. GetSystemTimes on Windows