CPU Usage

What do you want to see in Armagetron soon? Any new feature ideas? Let's ponder these ground breaking ideas...
Post Reply
Luke-Jr
Dr Z Level
Posts: 2246
Joined: Sun Mar 20, 2005 4:03 pm
Location: IM: [email protected]

CPU Usage

Post by Luke-Jr »

Why is my (idle) AA server constantly using as much CPU as it can? :(
User avatar
Tank Program
Forum & Project Admin, PhD
Posts: 6711
Joined: Thu Dec 18, 2003 7:03 pm

Post by Tank Program »

That's a good question. My servers usually only eat CPU when people are playing. With 10 people around 20-30% or so...
Image
Luke-Jr
Dr Z Level
Posts: 2246
Joined: Sun Mar 20, 2005 4:03 pm
Location: IM: [email protected]

Post by Luke-Jr »

These syscalls seem to be looping (strace):

ioctl(4, FIONREAD, [0]) = 0
recvfrom(4, 0x70e7b0, 4000, 0, 0x7fffffa40e50, 0x7fffffa40d18) = -1 EAGAIN (Resource temporarily unavailable)
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 100000000}, NULL) = 0
read(0, 0x6a6440, 1) = -1 EAGAIN (Resource temporarily unavailable)
User avatar
Z-Man
God & Project Admin
Posts: 11585
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

Strange, the nanosleep calls should make sure no CPU time is used. According to man, they only return early if a signal is caught, and I don't think that should be the case.
Luke-Jr
Dr Z Level
Posts: 2246
Joined: Sun Mar 20, 2005 4:03 pm
Location: IM: [email protected]

Post by Luke-Jr »

z-man wrote:Strange, the nanosleep calls should make sure no CPU time is used. According to man, they only return early if a signal is caught, and I don't think that should be the case.
Sleeping for 1/10th of a second (?) seems a bit pointless...
User avatar
Z-Man
God & Project Admin
Posts: 11585
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

??? That's an eternity for every CPU that still has electricity flowing through its veins :) I'd use non-polling network IO if there was a crossplatform way, but no, it's handled by signals in Unix and window events in Windows.
Signals, there was something... nanosleep aborts when signals are received. If someone could find out how to enable signals when a socket receives new data (ioctl probably), we could make the Unix server more responsive.
Luke-Jr
Dr Z Level
Posts: 2246
Joined: Sun Mar 20, 2005 4:03 pm
Location: IM: [email protected]

Post by Luke-Jr »

Power went out here, and with a fresh boot AA no longer eats CPU. Go figure.
Actually, I wonder if it was more than just a single AA instance gone crazy-- I don't think I checked to be sure the PID # was changing across restarts...
Post Reply