Manoj S P wrote:
> I have created a small shared library and linked the
> same with an C executable. If i execute the C program
> it works fine. Even 'ldd <c program>' shows me that
> the c program uses the shared library.
> ~/tests # ldd test_lib
> libmatrix.so.0 => /root/tests/libmatrix.so.0
> libc.so.6 => /lib64/tls/libc.so.6
> /lib/ld64.so.1 => /lib/ld64.so.1
> Next step, started OProfile and executed the 'C'
> program. But OPreport doesnot show any sign of the c
> programs execution.
> I created the shared library using the following
> 1. gcc -fPIC -Wall -g -c libmatrix.c
> 2. gcc -g -shared -Wl,-soname,libmatrix.so.0 -o
> libmatrix.so.0.0 libmatrix.o -lc
> 3. /sbin/ldconfig -n .
> 4. ln -sf libmatrix.so.0 libmatrix.so
> 5. gcc -Wall -g -c demo_use.c -o demo_use.o
> 6. gcc -g -o demo_use demo_use.o -L. -lhello
> 7. LD_LIBRARY_PATH="."
> 8. ./demo_use
Use "time ./demo_use" to see how long your program takes to run. Looking
at the data below you are using the timer interrupt mechanism that is
going to be sampling at a relatively low rate, e.g. 100 times a second.
If your program runs for a very short amount of time it is possible that
are now samples.
Another thing to keep in mind is that OProfile doesn't immediately write
the data to the sample databases. After running your program you
probably want to do the following to flush the data from the kernel buffer:
You might also want to look at the "--seperate=library" for opcontrol to
associate samples for a shared library with the executable to determine
whether samples for libc.so.6 are for your ./demo_use or some other program.
> The opreport data are below (without any sign of the C
> program or the Library)
> :~/tests # opreport
> CPU: CPU with timer interrupt, speed 0 MHz (estimated)
> Profiling through timer interrupt
> samples| %|
> 5467 99.8539 vmlinux
> 4 0.0731 bash
> 1 0.0183 ld-2.3.3.so
> 1 0.0183 libc.so.6
> 1 0.0183 libcrypto.so.0.9.7
> 1 0.0183 oprofiled