Question

I had a little surprise after profiling my program with oprofile.

The profile shows that my program spend 85% in _fini:

CPU: Intel Core/i7, speed 1199 MHz (estimated) Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (No unit mask) count 100000 samples % image name symbol name 553519 85.7402 eddic _fini

The other symbols looks good.

My program is compiled with GCC 4.7.

From what I understand, the symbol _fini is a deprecated construct for global destruction, so I don't get why my program spend so much time in this symbol.

Can that result from a bad configuration of oprofile or of GCC ?

I tried to profile the unoptimized code and the problem is not present. There are no such symbol with no optimizations.

Is there a way to fix the profile or to avoid spend so much time in _fini ?

I can't paste my paste as it very very long, I didn't isolate the problem.

Thanks for any idea

Was it helpful?

Solution

without seeing the code in question is really hard to suggest where the problem lies, but the _fini time suggests destructors for global variables (or static function variables which also exist for the duration of the program). I would suggest - that you inspect the classes of all your global+static variables and see what their destructors are doing - comment out functionality in your program until that stops happening to give you a hint of where it is spending its time - Use gdb or another debugger to inspect what is happening at _fini.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top