MantisBT - Zandronum | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0003620 | Zandronum | [All Projects] Bug | public | 2019-03-10 22:18 | 2019-06-04 20:18 |
Reporter | voidpointer | ||||
Assigned To | |||||
Priority | normal | Severity | major | Reproducibility | always |
Status | new | Resolution | open | ||
Platform | Ubuntu 18.10 | OS | Ubuntu 18.10 | OS Version | |
Product Version | |||||
Target Version | Fixed in Version | ||||
Summary | 0003620: Unnecessarily high CPU usage when zandronum-server is idle | ||||
Description | When there are zero connected clients for an instance of zandronum-server, I am seeing around 8-10% CPU usage. This is not scalable. There should be as close to 0% CPU usage as possible when there are no connected clients for a server instance of Zandronum. After looking at the Zandronum code base a bit, I see this in sv_main.cpp: lPreviousTics = static_cast<LONG> ( g_lGameTime / (( 1.0 / TICRATE ) * 1000.0 ) ); lNowTime = I_MSTime( ); lNewTics = static_cast<LONG> ( lNowTime / (( 1.0 / TICRATE ) * 1000.0 ) ); lCurTics = lNewTics - lPreviousTics; while ( lCurTics <= 0 ) { // [BB] Recieve packets whenever possible (not only once each tic) to allow // for an accurate ping measurement. SERVER_GetPackets( ); I_Sleep( 1 ); lNowTime = I_MSTime( ); lNewTics = static_cast<LONG> ( lNowTime / (( 1.0 / TICRATE ) * 1000.0 ) ); lCurTics = lNewTics - lPreviousTics; } The delta calculations are strange and confusing, but the `I_Sleep(1)` is very inefficient for the CPU. The sleep needs to be longer so the OS can schedule other work for the CPU. Could we make this an `I_Sleep(500)` (2 FPS) when there are 0 connected clients, and bump it back up to 35 FPS when 1 or more clients are connected? | ||||
Steps To Reproduce | |||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2019-03-10 22:18 | voidpointer | New Issue | |||
2019-06-04 20:18 | Dusk | Note Added: 0020722 |
Notes | |||||
|
|||||
|
|