Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Periodic drops in FPS in most games
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Gamers & Players
View previous topic :: View next topic  
Author Message

Joined: 22 Mar 2013
Posts: 6

PostPosted: Tue Jun 04, 2013 9:18 am    Post subject: [Solved] Periodic drops in FPS in most games Reply with quote

Hello all.

So, in a nutshell, the problem is that I'm getting FPS drops every couple of seconds in most games I've played. The number of seconds in between doesn't seem to vary all that much in between games, with Counter-Strike Source (from steam on linux) it was 5-10 seconds, while with quake3-cpma, it was a bit more. It doesn't seem to vary at all when changing the games configuration.
I'm not a very experienced linux user (less than 4 years, less than 2 on gentoo), so please excuse any stupid mistakes on my part.
(I really wish there were spoilers in this forum, the length of the post would be more bearable).


So, the details. I have a Sony Vaio VPC-SB1A9E:
intel 2nd gen core i7-2620M (2.70-3.40 Ghz, 2 cores)
Intel HM65 Express Chipset
1x8GB (I think) DDR3 SDRAM, 1333MHz
128GB SSD, TOSHIBA THNSNC128GMMJ (according to hddtemp)
Using external monitor via hdmi, 1680x1050
AMD Radeon HD6630M (1GB VRAM) + Intel HD3000
Battery (according to official specs): VGP-BPS24, lithium polymer, 48.84 Wh

00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)
00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)
00:1c.2 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 3 (rev b4)
00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b4)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation HM67 Express Chipset Family LPC Controller (rev 04)
00:1f.2 RAID bus controller: Intel Corporation 82801 Mobile SATA Controller [RAID mode] (rev 04)
00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 04)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Whistler [Radeon HD 6600M/6700M/7600M Series] (rev ff)
02:00.0 Network controller: Intel Corporation Centrino Wireless-N 1000 [Condor Peak]
03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader (rev 01)
04:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)
05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 06)

emerge --info
Portage (default/linux/amd64/13.0, gcc-4.7.3, glibc-2.17, 3.9.4-gentoo x86_64)
System uname: Linux-3.9.4-gentoo-x86_64-Intel-R-_Core-TM-_i7-2620M_CPU_@_2.70GHz-with-gentoo-2.2
KiB Mem:     8091288 total,   6708332 free
KiB Swap:     786428 total,    786428 free
Timestamp of tree: Mon, 03 Jun 2013 11:15:02 +0000
ld GNU ld (GNU Binutils) 2.23.1
app-shells/bash:          4.2_p45
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.5, 3.2.5, 3.3.2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.13.2
sys-devel/binutils:       2.23.1
sys-devel/gcc:            4.7.3
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.9 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo x11 science
ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-O2 -pipe -fomit-frame-pointer -march=corei7-avx -mno-movbe -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx2 -mno-lzcnt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=corei7-avx"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -fomit-frame-pointer -march=corei7-avx -mno-movbe -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx2 -mno-lzcnt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=corei7-avx"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/var/lib/layman/x11 /var/lib/layman/science"
USE="X a52 aac acl acpi alsa amd64 avahi berkdb bzip2 cdr cli consolekit cracklib crypt css cups cxx dbus dga dhcpcd directfb divx djvu dri dts dv dvd dvdr dvdthread encode fbcon ffmpeg firefox flac fortran ftp gdbm gif git gnutls gpm iconv ipv6 jpeg jpeg2k ladspa libnotify lm_sensors lock mad matroska midi mmx mmx2 modules mp2 mp3 mpeg mpeg4 mplayer mudflap multilib musepack nas ncurses networkmanager nls nptl offensive ogg openal opengl openmp pam pcre pdf png policykit ppds quicktime readline resolvconf sdl session sse sse2 ssl ssse3 startup-notification subtitles subversion svg symlink tcpd theora threads tiff timidity truetype udev unicode upnp v4l v4l2 vaapi vcd video vorbis wifi x264 xanim xattr xine xinerama xorg xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev keyboard mouse synaptics joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en fr bg" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-4" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="intel vga radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

As boot options in grub, I have:
* when using radeon:
video=uvesafb:off video=vesafb:off i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1 radeon.pcie_gen2=1 modprobe.blacklist=fglrx,radeon root=/dev/sda2
* when using fglrx:
video=uvesafb:off video=vesafb:off i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1 root=/dev/sda2

I have not messed with the i915 options, it seems the laptop runs hotter without them.

I have tried running anything with the OSS radeon driver, but X won’t start, and the virtualgl method posted here ( doesn’t work either (X fails with “No modes” error). I keep it anyway for vgaswitcheroo, so I can at least stop the card.
So, for the most part, I have played games either with just the intel card, or with fglrx. I get the same hiccups with both.

When using fglrx, I disable sna and enable uxa for xf86-video-intel, because X fails to start otherwise. While using it, (aticonfig --px-dgpu, etc), urxvt seems pretty slow, and there are some problems which seem to me like rendering glitches (urxvt refreshes too slowly, or renders too slowly, or does not update,..).

I started noting the issue with Counter-Strike Source from the linux port of Steam (I followed the wiki’s guide for the installation, no overlay). It also happened with any other source engine game I’ve tried (Portal, Half-Life 2).
(before you say it’s steam specific, I had the same with unreal tournament 3 from steam under wine, and, I think, Supreme Commander under wine).
I played the games with just the intel card then, because when using fglrx, I got an unbelievable lag everytime I moved the mouse (on move, the view changes 1-2 seconds late, slowly), huge fps drop, and in general, there were drops all the time.

Note that I only played offline with bots, usually filling the server.

I’ve tried everything I could imagine:
* changing the cpufreq governor to performance (was ondemand);
* tweaking the kernel config (was using CONFIG_PREEMPT);
* installing different versions of xf86-video-intel, ati-drivers, mesa, libdrm (now using live versions from x11-overlay);
* changing all settings in amdcccle, disabling/enabling vsync,AA (note: i915 uses triple buffering by default);
* changing all games settings, by editing conf files, using absolutely all options for maximum performance, or max-ing everything out;
* stopping laptop-mode-tools, or changing its configuration, and disabling/enabling everything in powertop;
* switching WMs, from fluxbox to dwm (though I don’t know if there would be a huge difference between the two anyway);
* disabling mouse acceleration (using a Logitech G500, I detected a 500MHz polling rate, I don’t remember what tool I used);
* disabling touchpad completely, or modding its settings, using it as the only mouse;
* editing xorg.conf or removing it: played with BackingStore, IgnoreABI options in ServerLayout, DPMS for the Monitor, UseFastTLS and AccelMethod for fglrx under Device;
* using an older kernel (3.7.10-gentoo), with older options (can provide .config if necessary);
* using fullscreen/windowed modes in games, lowering resolution, using a different aspect ratio;
* there is an update for the BIOS (Insyde H20), but I cannot apply it without windows, the freedos method does not work; because of how this BIOS is on most laptops of this series, I only have access to a couple of options in its settings, none relating to video;
* whatever I’m forgetting at the moment.

Now, here is what is driving me nuts: at one point, after doing some changes absent mindedly, Counter-Strike Source started working perfectly, with the intel drivers. No hiccups at all. Then, I wanted to see if there was any improvement with fglrx. Surprise - there was, but the hiccups were back, full force, with both intel and fglrx. I *had* rebooted a couple of times before that, so it didn’t seem like some weird automagical fix. I switched cards with aticonfig --px-dgpu && eselect opengl set ati.

My memories are already blurring, since I’ve struggled for quite some time now, and tried so many things. What I do remember changing in between the switch to fglrx, was recompiling prelink, an update to libpng (latest unstable), changing kernel options (I had changed them back afterwards, I think, no difference), and musing briefly on mtrr (I thought the VRAM maybe wasn’t correctly detected, as has been reported elsewhere with ati-drivers, but I did not change anything).
The only other thing that happened was Counter-Strike Source automatically changing its settings every time I swap cards (aticonfig --px-igpu, or --px-dgpu), so at first, I blamed that. But since then, I’ve tried every combination of settings I could come up with, with no effect. Between ultra high settings and ultra low, the overall FPS are different, but the FPS drops occur at virtually the same time, always. Because the bot count is pretty big (?), There’s usually a big FPS drop in the beginning of the round, and then the hiccups happen ~10 seconds later, and then every 5 seconds or so.
Removing all bots ups overall FPS, and the hiccups happen later, but they happen. Steam overlay is disabled.

Using htop and intel-gpu-tools, I saw that cpu usage is never more than 65-70%, only on one core (I don’t know too much about this stuff yet, though, so forgive possible noobness). When the stutters happen, intel-gpu-tools reports everything to be at 100% usage while they last, but that happens very suddenly, not progressively, i.e. the stats stay relatively low, and then are on 100% all of a sudden.
Steam’s big picture mode runs horribly (with the same insane lag I described before, only it still does now), and reports only ~256MB found for ATI card, but that’s a reported issue. Since there’s no improvement at all when modifying all the video settings in the game, I don’t think this is relevant. Xorg.0.log detects 1GB fine, from what I can gather (with grep -i kb /var/log/Xorg.0.log, I can’t paste the results now since I don’t have fglrx installed).

The only thing that seems to alleviate the problem, is using the laptop’s screen instead of the external monitor (with or without xorg.conf). Here’s some more info on setup:

Screen 0: minimum 320 x 200, current 1680 x 1050, maximum 32767 x 32767
LVDS1 connected (normal left inverted right x axis y axis)
   1366x768       59.9 +
   1024x768       60.0 
   800x600        60.3     56.2 
   640x480        59.9 
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
HDMI2 connected primary 1680x1050+0+0 (normal left inverted right x axis y axis) 474mm x 296mm
   1680x1050      59.9*+
   1280x1024      75.0     60.0 
   1280x960       60.0 
   1152x864       75.0 
   1024x768       75.1     70.1     60.0 
   832x624        74.6 
   800x600        72.2     75.0     60.3     56.2 
   640x480        72.8     75.0     66.7     60.0 
   720x400        70.1 
DP2 disconnected (normal left inverted right x axis y axis)

I don’t really know what’s the best way to disable the laptop’s screen if the external monitor is connected, so I execute this (I’m not very good at bash yet):


TEST="$(xrandr | grep "${OUTPUT} connected")"

if [ "${TEST}" != "" ]; then
   xrandr --output ${OUTPUT} --auto   
   xrandr --output ${OUTPUT} --primary
   xrandr --output ${OUTPUT} --left-of ${DEFAULT}
   xrandr --output ${DEFAULT} --off

I launch this from here (note: I use cdm for DM):


# use correct screen

# source ~/.Xresources (used by urxvt)
xrdb -merge ~/.Xresources

# Run urxvt daemon
urxvtd -q -o -f

# for gnome-keyring support; this eases passwd management for GnuPG, ssh and Wifi
eval $(gnome-keyring-daemon --components=pkcs11,secrets,ssh,gpg)

# Set xserver parameters
xset s0
xset dpms 0 0 1800

# start syndaemon (synaptics), correct place?
/usr/bin/syndaemon -d -t -k -i l

# from "set window manager name property of the root window
# utility to fix problems with jdk versions and other broken programs assuming
# a reparenting window manager for instance"
# example: steam (native)
wmname LG3D

# Launch dwm and create consolekit session, when no DM is used, eg.xdm
# allow restarting dwm without logging out or closing programs
exec ck-launch-session dbus-launch --sh-syntax --exit-with-session /usr/local/bin/dwmloop

(I should remove the gnome-keyring thing, I just noticed that now; the xset stuff is a relic from fluxbox... tbh, I don’t really have looked into what it does, don’t tell me this is the issue??)

That was a couple of weeks ago, I’ve since noted similar hiccups in quake3-cpma (usually running at 125fps), Dawn of War - Soulstorm (in wine), Unreal Tournament 3 (in wine, through steam). The one with quake3-cpma doesn’t seem consistent, it only happened once.

Another note: the laptop has always had problems with temperatures; overall, it has overheated over 25-30 times; when running anything that requires some juice, the cpu goes from circa 42-50C to over 70C (according to lm-sensors), but does not overheat if the ATI card is off. I did not monitor it when I was using fglrx, because I suck and I didn’t know how to configure lm_sensors, or that I could use aticonfig --odgt.
Now, while idle, when turning the radeon on using vgaswitcheroo, lm-sensors reports 44C, and then temp is steadily rising to 60C (cpu also rises to ~58C).
Sometimes, there’s a weird smell coming from the laptop, but it doesn’t really seem to happen in most circumstances, I have no idea what’s that about.
Cleaning the laptop with compressed air, by blowing it in the vents is completely ineffective. I opened it up and a lot of dust had collected in the fan (of the cpu? gpu?). Cleaning that up as much as I can did not do anything, the temps were the same. However, I could not reach the cpu or gpu, as I’d have to completely disassemble the whole thing to access them (completely), and given that there’s a ton of screws to unscrew, and a lot of duck tape to remove, I’m not confident enough to do this. So, no thermal paste replacement, no assessment of damage, if any.
Looking at the internets, there have been quite a bit of complaints about this one and other similar models, with the sony guys being completely ineffective at solving the issue, so it seems like it’s a design problem, or something. The hot air certainly doesn’t seem to be evacuated very efficiently, though that’s just my uneducated opinion.

So, skimming on windows related topics on the internet, this sort of issue usually relates to voltage problems, or overheating, so the latter may be it.

That’s all I could think of right now. I can’t really test a whole lot anymore, because I have a big exam in a week, even if this is driving me insane. So, excuse any delay in replying, if you request more details.


Good lord, I’ve probably invested a bit too much time in this.

TL;DR: Skimming over all this data, does this seem to be more of a hardware issue, or a software one? What's a probable cause/fix?

Last edited by quux on Thu Jun 13, 2013 7:29 pm; edited 1 time in total
Back to top
View user's profile Send private message

Joined: 14 Jul 2005
Posts: 7310

PostPosted: Tue Jun 04, 2013 2:53 pm    Post subject: Re: Periodic drops in FPS in most games Reply with quote

quux wrote:
the laptop has always had problems with temperatures

The BIOS might be throttling the CPU and/or GPU, out of the control of Linux, in the interests of self-preservation.

Fix the temperature issue. If the fan seems weak, try replacing it. Also consider buying a cheap USB laptop cooler that fits underneath - those help a little.
Back to top
View user's profile Send private message

Joined: 22 Mar 2013
Posts: 6

PostPosted: Tue Jun 04, 2013 9:05 pm    Post subject: Reply with quote

Thanks for the quick reply.

I already have a laptop cooler, which I forgot to mention. All the temps I reported are with the cooler on.
As far as the BIOS goes, I had first used this laptop with windows 7 x64, and had no FPS drops of any kind. The laptop was reaching much higher temps, since playing any game during the summer (circa 30C) would make it overheat (since it shuts itself down, I assume that's what it is). That was more than a year ago, though. What I mean by this, is that I doubt the BIOS is doing this if everything was fine under windows before, unless something changes when using linux?
I can install windows again, and see if that persists there, but I'd have to make a custom install disk for windows xp, or wipe gentoo for windows 7 (it doesn't like my partitioning scheme or something), so I can't do that for at least a week. When I do that, I'll also be able to update the BIOS, and/or get a custom/hacked image that unlocks all available configuration options for the BIOS, but I'm not really sure I want to try that (no BIOS recovery mode).
I have ordered thermal paste, so I'll just dive into it and see what I can do. Again, that's for in a week or so.

I just noticed the problem is there in Counter-Strike Condition Zero as well, which runs on a different engine. I don't own any games on Steam-linux that do not run on the Source/goldsrc engines... OpenArena and quake3 seem to play just fine. I'd almost say that this is a Steam issue, except that I've experienced these stutters in wine games as well (with things like Starcraft Brood War).

I'll update this once I get more data.
Back to top
View user's profile Send private message

Joined: 14 Jul 2005
Posts: 7310

PostPosted: Tue Jun 04, 2013 9:19 pm    Post subject: Reply with quote

Wine troubleshooting has some things to try:

For ATI cards, in xorg.conf:
Option "UseFastTLS" "2"

For CFS scheduler:
echo 21 > /proc/sys/kernel/sched_features
echo 25000000 > /proc/sys/kernel/sched_batch_wakeup_granularity_ns
echo 4000000 > /proc/sys/kernel/sched_min_granularity_ns

I would strongly recommend the BFS scheduler instead of CFS, for any desktop user, and especially for gamers.
Back to top
View user's profile Send private message

Joined: 14 Nov 2004
Posts: 468

PostPosted: Wed Jun 05, 2013 10:38 am    Post subject: Reply with quote

PaulBredbury wrote:

I would strongly recommend the BFS scheduler instead of CFS, for any desktop user, and especially for gamers.

Certainly worth a shot although I've found that CFS does fine with recent kernel versions on my system(s). Early versions of CFS were awful, though. The only downside is that BFS can be a bit behind on kernel versions.

Also, I didn't read all your post but with FGLRX there are some well known input lag/stuttering bugs. I'm assuming your laptop doesn't have a hardware MUX otherwise i'd suggest using the latest git Mesa with the R600-sb backend.

Git Intel drivers might help too, there's been a fair amount of work being done there too I believe.
Back to top
View user's profile Send private message

Joined: 22 Mar 2013
Posts: 6

PostPosted: Wed Jun 05, 2013 12:38 pm    Post subject: Reply with quote

Thanks again for the replies.

As I've said in OP, I've already tried tweaking UseFastTLS when using fglrx, but I did not notice any difference.
Again, the problem occurs irrelevant of which card or driver I'm using (in the exact same fashion). Right now, I'm using live builds of xorg-server, xf86-video-{intel,ati}, xf86-input-..., libdrm and mesa (from x11 overlay). It's probably a temperature issue after all, I'll have more data next week.

I didn't know about BFS, thanks for the info. I installed/cfg'ed ck-sources-3.9.2, and set BFS, but the issue is still there with no improvement.
By the way, going through BFS' FAQ page, it says:
"When compiling software, do not use more jobs than you have CPUs! So make -j2 on dual core, -j4 on quad core and so on."
Having a dual core i7, should I set MAKEOPTS in make.conf as "-j2" instead of "-j5" if I'm using BFS?
Back to top
View user's profile Send private message

Joined: 22 Mar 2013
Posts: 6

PostPosted: Thu Jun 13, 2013 8:05 pm    Post subject: Reply with quote

Okay, so I did a lot of stuff these past 2-3 days (including moving around all the partitions, so I can install windows 7), and I think I discovered what caused the slowdowns, though I don't understand the problem at all.
It's actually related to the Speed/Stamina switch on the laptop, which supposedly turns the discrete GPU on or off. I have mostly completely ignored this switch on both windows and linux, so I'm not using any scripts to manipulate how it works or anything.

Now, I can understand the computer using either the integrated or the discrete card depending on the state of the switch, but I doesn't really seem to be the case. On linux, I've always had to use vgaswitcheroo manually to switch off the radeon card, otherwise it stays on, using power and raising all temps. In addition, amdcccle, glxinfo and glxgears do not indicate anything different irrelevant of the position of the switch.

What actually happens, is that when the switch is on "stamina" mode, it does not allow the cpu's to constantly run at their maximum frequency, and even when it's stressed, it constantly goes up to circa 2.70Ghz, then drops to 800Mhz, in ~5 second cycles - I can also hear the fan continuously run faster, then dropping its speed, in the same way. I noticed this when running RealTemp on windows, and comparing what happens in either speed or stamina mode.

So, here are some facts:
* In both windows and linux, the switch works irrelevant of what else is going on (X server or no, works immediately, without a restart), or which card is actually used (iGPU or dGPU), and produces the exact same effect - constantly throttling the cpu.
* On linux, it does not seem to depend on what driver is being used for the discrete GPU (fglrx or radeon).

I'm not too familiar with any benchmarking tools on either OS, but I think sysbench should provide sufficient "proof". If necessary, I'll see what I could use to make some graphs, since that would be a lot more useful.
I'm using this for the benchmark:
sysbench --test=cpu --cpu-max-prime=200000 --num-threads=2 run

This is what I get on a typical run:

Speed mode:
sysbench 0.4.12:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 2

Doing CPU performance benchmark

Threads started!

Maximum prime number checked in CPU test: 200000

Test execution summary:
    total time:                          338.9913s
    total number of events:              10000
    total time taken by event execution: 677.9794
    per-request statistics:
         min:                                 63.72ms
         avg:                                 67.80ms
         max:                                 70.36ms
         approx.  95 percentile:              69.49ms

Threads fairness:
    events (avg/stddev):           5000.0000/0.00
    execution time (avg/stddev):   338.9897/0.00

Stamina mode:
sysbench 0.4.12:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 2

Doing CPU performance benchmark

Threads started!

Maximum prime number checked in CPU test: 200000

Test execution summary:
    total time:                          430.7396s
    total number of events:              10000
    total time taken by event execution: 861.4715
    per-request statistics:
         min:                                 63.72ms
         avg:                                 86.15ms
         max:                                402.66ms
         approx.  95 percentile:              93.88ms

Threads fairness:
    events (avg/stddev):           5000.0000/0.00
    execution time (avg/stddev):   430.7358/0.00

Am I missing something? The pages I read, that referenced the Speed/Stamina Switch, including the official one on vaio's website, describe it as a "hybrid graphics switch", nothing more. So what's going on?
(I'm marking the thread as "solved" since the original problem was solved)
Back to top
View user's profile Send private message

Joined: 14 Nov 2004
Posts: 468

PostPosted: Mon Jun 17, 2013 2:42 pm    Post subject: Reply with quote

You might be running into the bug with the ondemand CPU governor that some are experiencing. Although why it's related to that Speed/Stamina switch isn't obvious to me. But you can either tune ondemand to be more aggressive in switching frequency, or switch to the performance governor.

Ondemand tuning:


echo 30 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold # Switch to max speed when hit 30% CPU use
echo 200 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor # Don't switch down too quickly when at full speed

The first command is needed because the default level of CPU usage to switch up frequency is 95% which will be too high if CPU usage is sustained at a lower level. I'm not sure how useful the second command is but apparently it delays switching a little bit so it won't switch down when CPU usage momentarily drops.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gamers & Players All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum