Project

General

Profile

Emulator Issues #8311

Netplay shouldn't use an idle loop

Added by degasus about 5 years ago.

Status:
Fixed
Priority:
Urgent
Assignee:
-
Category:
Netplay
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Current
Regression:
Yes
Relates to usability:
No
Relates to performance:
Yes
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

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?


Related issues

Has duplicate Emulator - Emulator Issues #8284: Netplay is broken on Linux (extremely slow, even the chat messages lag)Duplicate

History

#1 Updated by JosJuice about 5 years ago

  • Relates to performance set to Yes
  • Category set to netplay

#2 Updated by mathieui about 5 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.

#3 Updated by JMC4789 about 5 years ago

Oh yeah, well, now that bug makes sense.

#6 Updated by mathieui about 5 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

#8 Updated by rachelbryk about 5 years ago

I think we are blocked by https://github.com/lsalzman/enet/issues/23

Don't know what to do...

#9 Updated by rachelbryk about 5 years ago

issue 8284 has been merged into this issue.

#10 Updated by JosJuice about 5 years ago

  • Milestone set to Current

#11 Updated by JMC4789 about 5 years ago

I summon comex to magically remedy the situation.

#12 Updated by JMC4789 about 5 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.

#13 Updated by mathieui about 5 years ago

Cross-referencing the PR here: https://github.com/dolphin-emu/dolphin/pull/2198

#14 Updated by JosJuice about 5 years ago

  • Status changed from New to Fixed

Also available in: Atom PDF