Emulator Issues #8311
closedNetplay shouldn't use an idle loop
0%
Description
We use an idle loop in the netplay code:
https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Core/NetPlayServer.cpp#L108
This waste lots of CPU, and has some critical components in it:
- m_ping_timer.GetTimeElapsed() <- syscall, so we'll generate as much syscalls as our operation system can handle
- std::lock_guard<std::recursive_mutex> lks(m_crit.send) <- this mutex may be locked almost 100% of the time
A good designed way would be to use locking events. Does enet support an event based usage?
Updated by JosJuice almost 10 years ago
- Relates to performance set to Yes
- Category set to netplay
Updated by mathieui almost 10 years ago
“- std::lock_guardstd::recursive_mutex lks(m_crit.send) <- this mutex may be locked almost 100% of the time” it does on linux, as far as I’m aware.
Updated by degasus almost 10 years ago
http://enet.bespin.org/Tutorial.html#ManageHost
Sounds pretty simple.
Updated by mathieui almost 10 years ago
I also want to point out that a user hosting the play has actually two of those loops running: https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Core/NetPlayClient.cpp#L483
Updated by rachelbryk almost 10 years ago
I think we are blocked by https://github.com/lsalzman/enet/issues/23
Don't know what to do...
Updated by rachelbryk almost 10 years ago
Issue 8284 has been merged into this issue.
Updated by JMC4789 almost 10 years ago
I summon comex to magically remedy the situation.
Updated by JMC4789 almost 10 years ago
- Priority set to Urgent
- Regression set to Yes
There's a few people working on this. Mathieui on IRC has performance back to normal.
Updated by mathieui almost 10 years ago
Cross-referencing the PR here: https://github.com/dolphin-emu/dolphin/pull/2198
Updated by JosJuice almost 10 years ago
- Status changed from New to Fixed
PR 2198 was merged in 4.0-5886. https://dolphin-emu.org/download/dev/486370829a95e2b9e21cfda701be337508c2dd2a/