Steam for Linux > Limited Beta > Topic Details
Yegg Nov 10, 2012 @ 12:18pm
Issue Report: Steam seamingly idle-looping on XGetWindowAttributes()
Even while completely idle, the steam binary is using 55%-65% of a >6000 bogomips CPU core. This appears to come from UI code idle-looping on calls to XGetWindowAttributes(), as I see constant backtraces with this signature:

#0 0xf7762430 in __kernel_vsyscall ()
#1 0xf731a5cb in poll () from /usr/lib32/libc.so.6
#2 0xf721bcc0 in ?? () from /usr/lib32/libxcb.so.1
#3 0xf721d610 in ?? () from /usr/lib32/libxcb.so.1
#4 0xf721d8d7 in xcb_wait_for_reply () from /usr/lib32/libxcb.so.1
#5 0xf763dc02 in _XReply () from /usr/lib32/libX11.so.6
#6 0xf7623ad8 in _XGetWindowAttributes () from /usr/lib32/libX11.so.6
#7 0xf7623c25 in XGetWindowAttributes () from /usr/lib32/libX11.so.6
#8 0xed903d8a in ?? () from /home/*REDACTED*/Steam/ubuntu12_32/vgui2_s.so
#9 0xed90ec20 in ?? () from /home/*REDACTED*/Steam/ubuntu12_32/vgui2_s.so
#10 0xf34ae95f in ?? () from /home/*REDACTED*/Steam/ubuntu12_32/steamui.so
#11 0xf356e924 in ?? () from /home/*REDACTED*/Steam/ubuntu12_32/steamui.so
#12 0xf356f7c8 in ?? () from /home/*REDACTED*/Steam/ubuntu12_32/steamui.so
#13 0x0806599f in RunSteam(int, char**, bool, bool) ()
#14 0x0804f8a7 in main ()
Showing 1-5 of 5 comments
< >
johndrinkwater [🐧︀ 🎮] Nov 10, 2012 @ 1:25pm 
Great find, many people have complained about excessive cpu from steam while in‐game.
vodik Nov 10, 2012 @ 10:33pm 
Along these lines Steam is generating a large amounts of wakeups when just sitting around in the background.

Not good for battery life at all

13.4 W 50.1 ms/s 3728.2 Process /home/simon/Steam/ubuntu12_32/steam
scott_test123 Nov 12, 2012 @ 10:07am 
Good info, thank you. We'll check this out.
johndrinkwater [🐧︀ 🎮] Nov 19, 2012 @ 7:39am 
Power Statistics tool lists lots of hrtimers waking up the processor often http://i.imgur.com/5mTqQ.png
Ronaldus Happening Paulus XVIII Nov 23, 2012 @ 3:28am 
I have to say, this is a pretty annoying problem. While it didn't affect my performance from point of view, but it did raise my CPU temperature to the 60-70C range.

I attempted to write a shell script to work around this problem and throttle the process, but Team Fortress 2 some how depends on Steam, frame-by-frame. Even a microsecond without it, and it stutters.

#!/bin/bash
STEAMID=$(pidof steam)
TEAMFORT=$(pidof hl2_linux) #Just making sure that we're not being stopped as well.

while true;
do
kill -SIGSTOP $STEAMID; kill -SIGCONT $TEAMFORT; sleep 1; kill -SIGCONT $STEAMID; sleep 0.1;
done

Edit & Improved Workaround:
I modified the workaround by stopping and continuing the process about 15 milliseconds long, which is about the refresh rate for 60hz (16.(6)ms to be exact) monitors. I managed to keep my CPU at around 50C on a 24 player 2fort server.

#!/bin/bash
STEAMID=$(pidof steam)

# set the lowest possible priority for steam, might not be a good idea since pauses might be longer than 16ms
renice 19 -p $STEAMID

# since the fps we want is 60, 1000 (ms ticks) divided by 60(fps) is 16.6ms
# I approximate to 0.015 to minimize stuttering
# Keep in mind calling these commands is an asynchronous task so we might want to lower our amount to sleep
while true;
do
kill -SIGSTOP $STEAMID; sleep 0.015; kill -SIGCONT $STEAMID; sleep 0.015;
done

It's really crappy and inefficient due to its asynchronous nature. The syntax and formatting only works in bash, and I'm too lazy to correct it for the dash shell.
Last edited by Ronaldus Happening Paulus XVIII; Nov 23, 2012 @ 4:21am
Showing 1-5 of 5 comments
< >
Per page: 15 30 50
Date Posted: Nov 10, 2012 @ 12:18pm
Posts: 5