[SOLVED] Graphics tired in Linux ? lazarus / 32-Linux ---------------------------------------------------------------------- Fred vS · 2011-07-19 17:52 Hello everybody. I develop a free DJ mixing app for Linux, Windows and Mac. (https://sites.google.com/site/fiensprototyping/home) I use the same code for the 3 OS (with some modif of course). In Windows and Mac, i have run the app for more than 3 days-nights non stop. The graphics are still fluent, fast and perfect.  But in Linux OS (on my PC), after one or two hours playing, all graphics are slower, tired, lazy, timers respond slower,... I do not have find any memory problems or leak (Heaptrc,)... Is it a known problem in Linux ? Many thanks. ---------------------------------------------------------------------- Fred vS · 2011-07-23 14:42 Toc, toc, toc, is there anybody here ? ---------------------------------------------------------------------- Leledumbo · 2011-07-23 15:26 Could be anything. Try checking your system monitor / task manager / whatever you have (I'm using Kubuntu, and it's called system monitor here). What's your distro/desktop environment? ---------------------------------------------------------------------- Fred vS · 2011-07-23 19:42 @ Leledumbo Thank you for your answer. Im using Ubuntu 10.10, gnome, GTK2. The Monitor System shows me 0 % of CPU and +- 10 megas memory used when nothing is playing. When songs are playing, it use +- 40 % of CPU and +- 13 megas memory. It append after +- one hour playing, the timers respond slower (a mix of 8 seconds become 20 seconds, buttons respond very slowly, ...) I do not find how to correct it, in monitor system, nothing different... ---------------------------------------------------------------------- LuizAmérico · 2011-07-23 23:21 Some tips: 1. Try to compile with Qt widgetset 2. maybe related to some resource leaking: http://bugs.freepascal.org/view.php?id=8595 ---------------------------------------------------------------------- Leledumbo · 2011-07-24 10:47 QuoteIt append after +- one hour playing, the timers respond slower (a mix of 8 seconds become 20 seconds, buttons respond very slowly, ...)Hmm... I didn't try that long and indeed the CPU and memory usage is about the same as you post if the program runs around 10 minutes. What does the program do internally? i.e. when playing songs. Read/write some files? Also does it happen when the program just runs without playing anything for an hour? I believe the kernel/GUI backend would notice that a program isn't being used for a certain time and therefore decides to swap in the pages holding the program's code and data to disk, and use the memory for other processes. But this would only happen if the program isn't doing anything. One more thing, when it happens, how's the CPU and memory? ---------------------------------------------------------------------- Blaazen · 2011-07-24 15:33 Now I have here miximum in problematic state. Graphic is really slow. It became after 1, 2 or 3 hours (I was AFK). It has now higher CPU load but this load doesn't come from miximum but from Xorg server (even if miximum is minimalized). Top: Code: [Select]  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                   1057 root      20   0  374m 150m  90m R   90  3.8 126:10.87 Xorg                                   2492 v1        20   0  337m  32m  16m S   10  0.8  45:41.91 miximum                                 2080 v1        20   0  858m 435m  29m S    9 11.0  12:43.96 opera                                   1796 v1         9 -11  285m  18m  16m S    4  0.5   8:14.87 pulseaudio                               2002 root      20   0 14360 3728 1632 S    2  0.1   0:46.14 powertop                                 2329 v1        20   0  359m  24m  12m R    1  0.6   1:29.50 operapluginwrap                           2602 v1        20   0  447m  33m  25m S    1  0.8   3:39.87 ksysguard                                 1857 v1        20   0  429m  23m  16m S    1  0.6   0:10.62 konsole                                 1588 root      20   0 45168 1056  692 S    0  0.0   0:06.33 udisks- daemon                             1741 v1        20   0  793m  65m  35m S    0  1.6   1:04.59 plasma- desktop                           2604 v1        20   0  9304 1288  820 S    0  0.0   0:37.53 ksysguardd                               5986 root       5 -15     0    0    0 S    0  0.0   0:00.71 khidpd_045800a7    EDIT: When miximum finished playing, graphic was still slow but there was no high CPU load from Xorg. ---------------------------------------------------------------------- Fred vS · 2011-07-26 19:47 Thank you very much LuizAmérico  , Leledumbo  and Blaazen  @ LuizAmérico Quote1. Try to compile with Qt widgetset OK, i gonna try it... (and im afraid to install-compile Lazarus for Qt  ) @ Leledumbo QuoteWhat does the program do internally? i.e. when playing songs. Read/write some files? In test mode i let the program do the auto mixes (click once on the Hand and let the program do the work). It do not write anything, only decode the mp3 on loading (for the wave form), playing the song, catching the level for VU and spectrum and drawing the current position on the wave form... No effects are used, no recording, no BPM stretch, no scratching only playing the cue list... QuoteAlso does it happen when the program just runs without playing anything for an hour? I do not know, i gonna test it... QuoteOne more thing, when it happens, how's the CPU and memory? Not really different than when OK... @ Mr Blaazen QuoteNow I have here miximum in problematic state. Graphic is really slow. It became after 1, 2 or 3 hours (I was AFK). It has now higher CPU load but this load doesn't come from miximum but from Xorg server (even if miximum is minimalized). And what is the cure Doctor ? @  LuizAmérico, Leledumbo and Blaazen : many, many thanks to spent your time for miXimum. ---------------------------------------------------------------------- Blaazen · 2011-07-26 20:20 No idea.  As I wrote, when miximum finished playing then it was slow too (and no CPU load from XOrg nor from miximum). Maybe threads, timers.... Hard to say. ---------------------------------------------------------------------- jl · 2011-07-27 02:32 Quote from: Blaazen on July 26, 2011, 10:20:51 pmNo idea.  As I wrote, when miximum finished playing then it was slow too (and no CPU load from XOrg nor from miximum). Maybe threads, timers.... Hard to say. How can he debug that? ---------------------------------------------------------------------- Fred vS · 2011-07-27 16:12 Last night the Qt saves my live   Iiiiiiiaaaaa, yaouuuw, now it is more than one night and one day non stop that miXimum is running perfectly, with same fluidity, graphics fast, audio rendering perfect.  Im totally converted to Qt, bye-bye GTK2 and welcome to my new hair (i loose all of it with GTK2). Now some comments... Splash screen: For the splash-shaped form, with GTK2 the background must be black and the shape white. In Qt it is opposite. Done.  Error in running: QuoteEListError.with message "Duplicate ID: FFFFFFFFFFFFFF31"It seems that Qt have some problems with allocating ID. The cure is to place Application.ProcessMessages after each "big" procedure. Done.  Loops: In GTK2 if i want that the loop gives control to graphics: Code: [Select]Procedure loopGTK2(); begin While  "something is true" do begin application.processmessage;   // give control to graphics procedure_in_loop(); end; end; That do not work well in Qt, of course it release the control to graphics but the procedure inside the loop take to much time to finish. That solve the problem for Qt: Code: [Select]procedure loopQt(); var chx : shortint; begin chx := 0; While  "something is true" do begin inc(chx); if chx > 40 then begin application.processmessage;   // to let control to graphics chx := 0; end; procedure_in_loop(); end; end; Done.  Im very happy, i switch from Delphi to Lazarus because of the Linux version. I was a little disappointed when i get that problem with graphics after one hour playing. And, trust me, i have done all what i could do to find the problem in GTK2, i never find it. Once again, thank to you great Lazarus-pros, Qt is the solution. Many, many, many thanks    PS: I gonna try miXimum in all the ways to check if no more problems then, of course, i gonna give you the brand new, full functioned, no stop and full speed Qt version of miXimum.. PS: Well seen LuizAmérico ---------------------------------------------------------------------- Mike.Cornflake · 2011-08-07 20:59 That's a slick looping app you've got there, nicely done :-) ---------------------------------------------------------------------- avra · 2011-08-08 07:54 Code: [Select]if chx > 40 then beginIt seams to me that you have tuned this for your specific configuration, but how do you know that it will be the same on much worse or much better hardware then yours? It most probably won't, and you will probably need some calibration in initialization if you want to keep this approach. It might be better to rethink if there is some other solution for this problem...