GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Tue Sep 02, 2014 9:09 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: _fini shows up in a gprof profile?
PostPosted: Fri Nov 01, 2013 4:33 am 
Offline
Familiar Face

Joined: Tue Oct 08, 2013 6:04 pm
Posts: 13
I have a batch oriented process to which I have added a Gtk+ 3.0 interface.

I have used gprof as I have done many times before but I'm now getting very strange results. Calls to _fini appear to consume most of the cycles. My code is only C and I read that _fini is some kind of deprecated C++ destructor. Is the Gtk+3.0 lib doing this stuff? Further, there are apparent calls to functions in the code that are in fact never used.

What advice does anyone have for profiling a Gtk+ application? Should I build a version that unhooks the GUI just for profiling purposes?


Top
 Profile  
 
 Post subject: Re: _fini shows up in a gprof profile?
PostPosted: Fri Nov 01, 2013 7:38 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 745
Location: UK
Hello,

_fini is now an obsolete destructor, but its use is not confined to just C++. It is also used for along with _init to initialise and finalise dynamically loaded libraries even those written in C. And had many other uses, but mainly confined to initialisation and destruction of libraries or complex global variables.

I know that GLib which is the base for GTK is now using more up to date methods for initialisation and destruction, but there could be a library that gets linked in that still uses the older methods.

Quote:
Further, there are apparent calls to functions in the code that are in fact never used.

Not sure about that one. If a function is called then it is used! Probably what you meant was there are functions that appear to be called, but you have not called them yourself. Again this is normal for any GUI application. A GUI tool kit is fairly complex and a single API call by you will call many other functions them self.

_________________
E.


Top
 Profile  
 
 Post subject: Re: _fini shows up in a gprof profile?
PostPosted: Fri Nov 01, 2013 3:28 pm 
Offline
Familiar Face

Joined: Tue Oct 08, 2013 6:04 pm
Posts: 13
The 'spurious' calls are to functions in my code that are not called by my code at all. I rely on the linker to expunge such stuff. I figured that there might be some kind of residue from a previous profiling run so I deleted the gmon file. But I subsequently got the same result. It is as if the function names have been somehow mixed up in some linker symbol table. The code runs fine.

The profile results are useless. It shows that _fini is 69% of the process time!

I just wonder if anyone has experience of using gprof with Gtk+3.0 ?

My gcc 4.7.2 options look like this:
Code:
-g -pg -march=pentium4
-Wextra -Wno-unused-but-set-parameter -Wno-unused-result -Wno-unused-but-set-variable
-mmmx -msse -msse2 -msse3 -mssse3 -mfpmath=sse -mstackrealign
-pthread -fopenmp -std=gnu89
`pkg-config --cflags gtk+-3.0`


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group