Project

General

Profile

Actions

Emulator Issues #8311

closed

Netplay shouldn't use an idle loop

Added by degasus almost 10 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 1 (0 open1 closed)

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

Actions
Actions #1

Updated by JosJuice almost 10 years ago

  • Relates to performance set to Yes
  • Category set to netplay
Actions #2

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.

Actions #3

Updated by JMC4789 almost 10 years ago

Oh yeah, well, now that bug makes sense.

Actions #6

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

Actions #8

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...

Actions #9

Updated by rachelbryk almost 10 years ago

Issue 8284 has been merged into this issue.

Actions #10

Updated by JosJuice almost 10 years ago

  • Milestone set to Current
Actions #11

Updated by JMC4789 almost 10 years ago

I summon comex to magically remedy the situation.

Actions #12

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.

Actions #13

Updated by mathieui almost 10 years ago

Actions #14

Updated by JosJuice almost 10 years ago

  • Status changed from New to Fixed
Actions

Also available in: Atom PDF