Re: Profiling GTK within an application



   Hello Chris!
   There are different types of profiling:
1 - application code profiling (gprof), it only profiles the code of the application without taking into account the libraries it uses and other factors like X and your hardware and video card. 2 - application code and libraries code profiling (qprof), it only profiles the code of the application and the code of the libraries without taking into account other processes that interact with your application like X and your hardware and video card. 3 - system wide profiling (sysprof, oprofile), it profiles all code of all proceses including the kernel and drivers.

All that types of profiling may or may not take into account the time of the function and all the functions it calls (flat view or call graph respectively), and they may or may not take into account the time spent sleeping (sometimes because it is waiting for another process to finish, like for example for X to process the request and the hardware drawing the screen).

So taking into account all that, one needs to decide what specific kind of profiling it needs, and then find the tool for the job. In your case, you say that "top" is showing that your application process is using more CPU than before, and also you say that the slowdown doesn't come from your application but from a library (GTK+ suite), so I guess that for that case what you need is a profiler that shows you the CPU time used by functions in your code accumulating the time used in the functions that it calls (from GTK+ or your application), that will help determine what functions of your code take the most time to fulfill, and then you can look at those functions to change the way you use GTK+ to optimize your use of GTK+ and avoid the slowdown, or maybe to see what functions of GTK+ are slowing down your application and see if you can optimize that functions in GTK+ itself. Discard the group 1 (gprof and maybe others). You can select group 2 or 3. If QProf is compatible with Solaris and you can build it with libunwind then it can show you a call graph of your functions and library functions and the accumulated and segregated times of each, the default mode of operation is to show used CPU time and thats precisely what you need, but you can also instruct it to take into account the time the function sleeps, if you keep your application busy then it will mostly sleep for X or another process or hardware item to finish your request and it could be useful too. Sysprof and OPriofile can do that too (the call graph), but they are Linux specific, but maybe there is something similar for Solaris, at this time they don't take into account the time the process/function sleeps but you don't need that. Since now you know what type of profiling you need, maybe you can ask on a Solaris specific mailing list, forum or IRC channel for that type of profiler.

   Hope this helps! Good luck.

--
Ivan Baldo - ibaldo adinet com uy - http://ibaldo.codigolibre.net/
ICQ 10215364 - Phone/FAX (598) (2) 613 3223.
Caldas 1781, Malvin, Montevideo, Uruguay, South America.
We believe that we are free, but in reality we are not! Are we?
Alternatives: ibaldo codigolibre net - http://go.to/ibaldo




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]