Question

I have several large code bases which compile into dynamic libraries. I know that some of these have some very expensive dynamic global dynamic initializers. (That is, global instances of classes/structs which are very expensive to construct.)

I would like a way to view a list of what/where these dynamic initializers are in the code so I can see if they are expensive and need to be refactored. I'd like to avoid digging through a lot of assembly as some of these libraries are quite large and probably contain hundreds of dynamic initializers (many of them small and fairly cheap, like string construction).

Is there a tool that can help me with this? (My tool chain is Redhat Linux/gcc/cmake.)

Was it helpful?

Solution

How about running your code under valgrind's callgrind tool, which will profile its execution (I am assuming when you said expensive you meant in terms of CPU, not I/O). Write a small test program which does nothing other than load these many things you are concerned about, and then analyze the profile (e.g. using the graphical tool kcachegrind on the callgrind output file).

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