protonscr

Steam uses 7.2% CPU, in Windows it's 0.0%

steamclosed reviewed
ValveSoftware/steam-for-linux#432 · opened 2012-12-27 by ghost · updated 2013-10-30 · 18 comments · github
?ghost 2012-12-27 github

On average opened steam window (showing game library) uses much more CPU in linux than it does in Windows.
Xubuntu 12.10 64bit AMD apu (dual core) E450 1.65GHz

pidstat -p 5380 5 12 
Linux 3.5.0-21-generic (notreal)    12/27/2012  _x86_64_    (2 CPU)

08:25:34 PM       PID    %usr %system  %guest    %CPU   CPU  Command
08:25:39 PM      5380   10.80    4.00    0.00   14.80     1  MainThrd
08:25:44 PM      5380    3.80    3.20    0.00    7.00     0  MainThrd
08:25:49 PM      5380    2.80    4.40    0.00    7.20     0  MainThrd
08:25:54 PM      5380    4.20    3.00    0.00    7.20     1  MainThrd
08:25:59 PM      5380    3.00    4.00    0.00    7.00     1  MainThrd
08:26:04 PM      5380    4.20    3.20    0.00    7.40     1  MainThrd
08:26:09 PM      5380    3.60    3.60    0.00    7.20     1  MainThrd
08:26:14 PM      5380    3.80    3.40    0.00    7.20     1  MainThrd
08:26:19 PM      5380    3.40    4.00    0.00    7.40     1  MainThrd
08:26:24 PM      5380    3.60    3.60    0.00    7.20     0  MainThrd
08:26:29 PM      5380    4.00    3.20    0.00    7.20     0  MainThrd
08:26:34 PM      5380    4.40    2.80    0.00    7.20     1  MainThrd
Average:         5380    4.30    3.53    0.00    7.83     -  MainThrd

Windows 7 64bit
steam exe 00 cpu

MMrSchism 2012-12-27 github

For the record, I've often found that the task manager was inaccurate in showing actual CPU usage.

Oolavd 2012-12-27 github

openSUSE 12.2 x86_64 KDE4:

processes

In System Monitor it changes between 0 and 4 % depending on the load here. «top» gives me values between 1.7 and 2.2. It's just a estimate, but this is on my system of course.

Gghfuss 2012-12-28 github

On my system (opensuse 12.2 64bit), it seems to spend a significant amount of time in sys.

Dual core i7-2677M CPU @ 1.80GHz (using ondeman freq governor, but I verified behavior is the same with performance governor)
KDE 4 with desktop effects disabled.
Sandybridge onchip intel graphics (it's using the VMware gallium driver from Mesa, which seems wrong. I'll try to change that)

laptop:~ # ps -ef | grep steam
username 5201 1450 0 19:25 pts/0 00:00:00 /bin/bash /home/username/.local/share/Steam/steam.sh
username 5247 5201 21 19:25 pts/0 00:00:11 /home/username/.local/share/Steam/ubuntu12_32/steam

I just left it idling on the store screen
laptop:~ # pidstat -p 5247 -u 5 6
Linux 3.4.11-2.16-desktop (laptop.site) 12/27/12 x86_64 (4 CPU)

19:27:31 PID %usr %system %guest %CPU CPU Command
19:27:36 5247 4.00 2.80 0.00 6.80 3 MainThrd
19:27:41 5247 4.80 2.40 0.00 7.20 0 MainThrd
19:27:46 5247 4.40 2.60 0.00 7.00 1 MainThrd
19:27:51 5247 4.40 3.00 0.00 7.40 1 MainThrd
19:27:56 5247 4.20 2.80 0.00 7.00 0 MainThrd
19:28:01 5247 4.40 3.00 0.00 7.40 1 MainThrd
Average: 5247 4.37 2.77 0.00 7.13 - MainThrd

Steam seems to crash a lot when trying to ltrace, but I did get a bit and it seems to spend most of the sys time in _newselect (select), and once I saw a pretty long poll.

As far as raw number of library/sys calls, here's the breakdown from ~20 seconds of it running:
16 SYS_tgkill
28 SYS_futex
110 SYS_ipc
110 SYS_nanosleep
110 SYS_rt_sigtimedwait
330 pthread_mutex_trylock
330 pthread_mutex_unlock
344 SYS_time
452 SYS__newselect
1114 SYS_gettimeofday
4929 SYS_writev
8673 SYS_poll
9670 SYS_socketcall

Oolavd 2012-12-28 github

heiss, could you paste some system information? I ran pidstat a couple of times here for comparison: https://gist.github.com/4394595. ltrace just didn't want to play along …

Ttarvitz 2012-12-28 github

My windows 7 x64 shows up to 17% normal mode, avarage about 3-5% of CPU using according to sys internals process explorer. Agree with @MrSchism default process explorer is a little bit inaccurate

?ghost 2012-12-28 github

The question is what does Steam need to poll its sockets so often for, if it's just a desktop application. Even watching outpot of strace attached to it is kind of scary.

Ttr37ion 2012-12-28 github

Did you try Powertop?

?ghost 2012-12-28 github

Sorry, I didn't know that Close button closes the issue
lol

?ghost 2012-12-28 github

For the record, I've often found that the task manager was inaccurate in showing actual CPU usage.

Looks like you are correct, according to Sysinternals process explorer steam window (showing game library) cpu usage in Windows is actually around 2.2...2.3%
steam cpu usage sysinternals

Did you try Powertop?

Who?

Vvadi2 2012-12-28 github

Powertop - https://01.org/powertop/ it's likely to be available in your distro's packager already.

Gghfuss 2012-12-28 github

In powertop, steam is by far on top with around 350 events/s

Jjohnv-valve maintainer 2013-01-22 github

Should be noticeably better in the next release, although it will probably still be more CPU-intensive on X11 relative to Windows

ZZeXx86 2013-01-22 github

For me it's around 6% (Core i3, dual core with HT). Good job and thank you very much Valve.

CChristophHaag 2013-05-26 github

I personally wouldn't consider this "solved" given that steam running cases quite many cpu wakeups which means that on my notebook the fans run noticeably more than without steam running. I don't think I should have to use the steam webchat to chat with steam contacs only because the steam client produces so much cpu wakeups.

Consider only how much energy is globally wasted by idle steam clients...

I suggest using perf (perf top) to find out where the cpu cycles are wasted:
perf top
And while I don't know anything about the internals of steam I don't feel something like find_busiest_group needs to actually run that often.

Ttr37ion 2013-05-26 github

@ChristophHaag investigating this issue is a good thing. Steam is still using around 10% CPU time?!

CChristophHaag 2013-05-26 github

Well, on a 3632qm:

steam itself uses ~4-6%
CSteamController is a thread that jumps between 2.6 and 3.3%

Just idly displaying my library.

It is not much, but it is much more than it should be.

Ttr37ion 2013-05-26 github

Interestingly, I have Steam using only

0,34%  steamui.so                           [.] 0x0000000000dbdc3e

Have a Bumblee notbook and Steam running on the Intel graphics card. Maybe the performance issue is related to a certain hardware configuration or Kernel version?

I have Linux kernel 3.9.3-1-ARCH

Jjustinmayhew 2013-09-07 github

This is still an issue. Both top and htop report Steam to be using 3-5% CPU at all times, even when Steam is minimized. This is on Fedora 19 with an Intel 4670K CPU.

Here's the output of strace -p $STEAMPID -c running for 60 seconds.

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 98.88    1.382027          92     14946           poll
  0.36    0.005000        5000         1           restart_syscall
  0.30    0.004216           0     16058     11400 recv
  0.20    0.002767           0      7939           clock_gettime
  0.10    0.001421           0      4566           writev
  0.05    0.000761           1      1134           nanosleep
  0.02    0.000335           0      1134      1134 semop
  0.02    0.000316           0      1134           select
  0.02    0.000282           0      1134      1134 waitpid
  0.02    0.000275           0      3524           time
  0.01    0.000182           0      1134           read
  0.00    0.000061           1        75           send
  0.00    0.000025           0       108           tgkill
------ ----------- ----------- --------- --------- ----------------
100.00    1.397668                 52887     13668 total

Nothing extracted yet.