I'm using solaris 9 and g++ compiler. I'm trying to get gprof information about a shared library. So I wrote a small library like this,
comp.cpp #include<iostream> #include<string> #include"comp.h" using namespace std; void detailsG(int age, string str) { cout << "lib 1 ******************" << endl; int a = age; string s = str; cout <<"your name is "<< s; cout <<" and your age is " << a << "."<< endl; sayHelloG(); cout <<"comp.cpp detailsG"<<endl; cout << "lib 1 ******************" << endl; } void sayHelloG() { cout << "lib 1 ******************" << endl; cout << "Hello dear.." <<endl; cout << "comp.cpp sayHelloG" << endl; cout << "lib 1 ******************" << endl; } comp.h #include<string.h> #include<string> using namespace std; extern "C" { void detailsG(int, string); void sayHelloG(); } Then I build the library like this, g++ -pg -fPIC -I. -c comp.cpp g++ -shared -pg -o libmitTest.so comp.o Then I wrote a little program which uses that library. #include "comp.h" #include <iostream> using namespace std; int main () { cout << "IN MAIN" << endl; sayHelloG(); detailsG(22, "Gavinda"); cout << "AGAIN IN MAIN" << endl; return 0; } I compiled it like this, g++ -pg -L /export/home/chanaka/first/lib -lmitTest z.cpp -o z.out export LD_PROFILE=libmitTest.so:z.out after I run z.out file I got gmon.out file but its gprof output don't show details about shared library functions. But I want to get details about shared library functions. Could anyone please tell me the way to get details about shaed library functions. gprof -b z.out gmon.out produced a output like this, bash-2.05$ gprof -b z.out gmon.out granularity: each sample hit covers 4 byte(s) no time propagated called/total parents index %time self descendents called+self name index called/total children 0.00 0.00 1/1 _start [19] [2] 0.0 0.00 0.00 1 main [2] 0.00 0.00 2/2 <external> [1] ----------------------------------------------- 0.00 0.00 1/2 _GLOBAL__I_main [10] 0.00 0.00 1/2 _GLOBAL__D_main [9] [8] 0.0 0.00 0.00 2 _Z41__static_initialization_and_destruction_0ii [8] ----------------------------------------------- 0.00 0.00 1/1 __do_global_dtors_aux [13] [9] 0.0 0.00 0.00 1 _GLOBAL__D_main [9] 0.00 0.00 1/2 _Z41__static_initialization_and_destruction_0ii [8] ----------------------------------------------- 0.00 0.00 1/1 __do_global_ctors_aux [12] [10] 0.0 0.00 0.00 1 _GLOBAL__I_main [10] 0.00 0.00 1/2 _Z41__static_initialization_and_destruction_0ii [8] ----------------------------------------------- granularity: each sample hit covers 4 byte(s) no time accumulated % cumulative self self total time seconds seconds calls ms/call ms/call name 0.0 0.00 0.00 2 0.00 0.00 _Z41__static_initialization_and_destruction_0ii [8] 0.0 0.00 0.00 1 0.00 0.00 _GLOBAL__D_main [9] 0.0 0.00 0.00 1 0.00 0.00 _GLOBAL__I_main [10] 0.0 0.00 0.00 1 0.00 0.00 main [2] Index by function name [9] _GLOBAL__D_main [8] _Z41__static_initia [10] _GLOBAL__I_main [2] main Object modules 1: z.out bash-2.05$ in this output the line "0.00 0.00 2/2 <external> [1]" shows details about shared library functions. But I want to get individual details about each shared library function. what did i do wrong here? or what is the correct way to get details about shared libraries? Thanks for spending your valuable time for me. _______________________________________________ help-gnu-utils mailing list help-gnu-utils@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-utils