You are not logged in.
I've made this small application:
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
char str[2000] = "abcdefghijklmnopqrstuvwxyz 0123456789 ~!@#$%^&*():";
int main(void)
{
int i;
struct winsize w;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
while (strlen(str) < 1000) memcpy(str+strlen(str), str, strlen(str));
str[w.ws_col - 11] = 0;
for (i = 0; ; ++i) {
printf("%9d %s\n", i, strfry(str));
usleep(40000);
}
return 0;
}All it is doing is printing random lines into the terminal every 40 ms.
You can compile this as "gcc stringdump.c -o stringdump" and run it as "./stringdump".
My problem with this that when I run this application in the foreground in a fullscreen terminal then X eats all my CPU (according to top) and X becomes a "sluggish". This means I can see a noticeable delay between window switching and when I press & hold a key in another text window I see an irregularly repeating pattern rather than a constant-timed pattern. I usually notice this effect when I'm scrolling in vim.
I'm having this problem for a long time now. I'm using the latest ATI catalyst drivers on a 1920x1080 display (and everything else like OpenGL and HD playback is fine with it). I've tried this with urxvt, gnome-terminal and konsole - all the same, although font and its size has some smaller effects on the load. I primarily use Terminus which should be a bitmap font but it's slow with that as well. I'm not sure what other variables are relevant so ask me for them.
I've already tried to reduce everything to the minimum as described in Font Configuration and even though the fonts looked ugly (though Terminus in the terminal remained the same) my script still managed to make X eat all CPU.
It's not something very annoying but I would like to have it faster. Is there a setting which I can tweak or font rendering is just that slow in my setup?
Offline
I've written an additional script to measure something that correlates with slow X (though I'm not sure what exactly am I measuring).
My script is here: http://pastebin.com/A3QvE3BN, all you need to is press and hold Enter for a few seconds and after the end it prints some timing numbers. I'd be curious what are these numbers for other 1920x1080 or larger screen users.
If you do this test please run "xset r rate 300 40" before running so that it matches with my setup. I'm executing these tests in a fullscreen urxvt terminal with the Terminus font.
Setup 1: fontsize is 12, columns=319, rows=89
4.549314 seconds have elapsed in the printing setup
0.123894 seconds have elapsed in the empty setup
Setup 2 (my usual setup): fontsize is 16, columns=239, rows=67
6.518967 seconds have elapsed in the printing setup
0.116761 seconds have elapsed in the empty setup
Setup 3: fontsize is 24, columns=159, rows=44
5.066974 seconds have elapsed in the printing setup
0.102328 seconds have elapsed in the empty setup
An interesting tidbit: I have an Intel Core2 machine which I'm running at 1200 MHz all the time. I've tried to increase it to 2000 MHz for the second setup and it still didn't go below 6 seconds. This means that X could be memory bound.
Offline
Probably the reason is "ATI catalyst drivers". They were never known for high quality. Try measuring open source one.
Offline
I've just tried the open source driver. It has better performance but X still maxes out the CPU. Is bitmap font rendering that expensive?
I couldn't really test my script with urxvt because it didn't start (it complained something about fonts - I didn't know how to fix those) so I've run my test in xfce-terminal with Terminus in the 2nd setup (explained above):
1.448517 seconds have elapsed in the printing setup
0.035505 seconds have elapsed in the empty setup
I've used a newer version of my script because I've fixed some problems in it like screen clearing: http://pastebin.com/EmP7Eypf
I went back to catalyst because it has video acceleration. Do you know some settings which could help me with catalyst?
Last edited by rlblaster (2012-02-05 10:29:05)
Offline
I haven't really tested this theory but I think I know what's happening. When the terminal scrolls it doesn't just tells X to move a large portion of the screen upwards by y pixels and just render the last row but rather it rerenders all the characters on the screen! So this isn't an X issue really but a terminal issue too. I don't think this is an easily fixable though.
I welcome any ideas. ![]()
Offline
I have an update about my issue. I mentioned that font rendering it's fast in gnome but that's not actually the case. I did a poor investigation. It's faster on another X server. E.g. on my first X server it's slow, but when I start another one it's fast. If I start a third X server it's fast again. If I kill the first one the other ones remain fast but if I start a new one now, it will be slow again. I have one video card only. I see no important looking differences in Xorg logs below. I have no idea what could I check next. Does anyone have an idea?
Log of the slow X: http://pastebin.com/iTRkRMvw
Log of the fast X: http://pastebin.com/q3rxspg7
Diff of slow and fast: http://pastebin.com/uFB3xq27
My lspci output:
00:00.0 Host bridge: Intel Corporation Mobile 4 Series Chipset Memory Controller Hub (rev 07)
00:01.0 PCI bridge: Intel Corporation Mobile 4 Series Chipset PCI Express Graphics Port (rev 07)
00:1a.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 03)
00:1a.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 (rev 03)
00:1a.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 (rev 03)
00:1a.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 (rev 03)
00:1c.1 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 2 (rev 03)
00:1c.3 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 4 (rev 03)
00:1c.5 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 6 (rev 03)
00:1d.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 03)
00:1d.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 03)
00:1d.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 03)
00:1d.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 93)
00:1f.0 ISA bridge: Intel Corporation ICH9M LPC Interface Controller (rev 03)
00:1f.2 SATA controller: Intel Corporation 82801IBM/IEM (ICH9M/ICH9M-E) 4 port SATA Controller [AHCI mode] (rev 03)
00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 03)
01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI RV710 [Mobility Radeon HD 4500/5100 Series]
01:00.1 Audio device: Advanced Micro Devices [AMD] nee ATI RV710/730 HDMI Audio [Radeon HD 4000 series]
04:00.0 Network controller: Broadcom Corporation BCM4322 802.11a/b/g/n Wireless LAN Controller (rev 01)
08:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5784M Gigabit Ethernet PCIe (rev 10)
09:01.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 05)
09:01.1 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 22)
09:01.2 System peripheral: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter (rev 12)
09:01.3 System peripheral: Ricoh Co Ltd xD-Picture Card Controller (rev 12)Offline