Search Unity

How does the High Precision Event Timer (HPET) affect Unity builds?

Discussion in 'Linux' started by Joe-Censored, Apr 6, 2017.

  1. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Does anyone know how Unity standalone builds are supposed to be affected by enabling the High Precision Event Timer? Does Unity utilize this timer for greater precision in some manner verses legacy timers? Is this supposed to have any performance impact?

    Here's my issue, when trying to figure out why my idle server instances were maxing their cores on my development server VM, I found that disabling HPET on the VM dropped CPU usage of these idle headless server instances significantly. Servers that run world simulation dropped from 100% to 70%, and servers that run networkserversimple and server to server clients dropped from 100% to 30%. As I understand it I shouldn't be seeing this drastic of a change just by changing a VM's timer setting.

    The guest VM is Ubuntu 16.04 running on Virtual Box, 6 cores and 20GB of RAM allocated to the VM. Host is an older Ubuntu server release with an 8 core AMD CPU from about 4 years ago (so not great, and probably why my new i7 dev boxes get 5% usage compared to 30% on the older AMD server) and 32 GB of RAM. So with HPET enabled on the VM and 5 headless server instances started I get all 5 using 100% CPU, maxing their cores. I disable HPET, start the VM, launch the server instances with no other changes, and get the 2 simulation servers at 70% and the other 3 at 30%. Its a pretty surprising usage drop. Target framerate is set to 60 on all server instances. Unity 5.6.0f3 builds.

    https://en.wikipedia.org/wiki/High_Precision_Event_Timer
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Hmmm on more investigation this is looking like some artifact of Virtual Box itself somehow. Taking the same build and running it directly on the host, which is Ubuntu 12.04, I'm getting comparatively great performance. Simulation servers running at 13% CPU usage and the other 3 are at 5%. Looks like I'll probably be running my game servers on bare metal rather than in a VM for the time being until I can figure out what is going on with Virtual Box.

    I expected some CPU overhead with running in a VM, but never considered a 500% - 2000% CPU usage increase.
     
    Last edited: Apr 6, 2017
  3. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    We're not using HPET directly, just standard syscalls - it seems likely that the VM software is doing so.