[lttng-dev] Apache instrumentation for User Space Tracing

Mehran Khan i at mehrankhan.com
Tue Jan 21 20:47:09 EST 2014


Hello everyone,
I have been trying to instrument the Apache web server, the latest version
(2.4.7 from the URL http://httpd.apache.org/download.cgi#apache24) for
LTTng UST tracing
1. To start with the simplest case, I created a *.tp file named
*smallestTracePoint.tp* with the content below
    TRACEPOINT_EVENT(
    mk,


    apache_process_entry,
    TP_ARGS(),
    TP_FIELDS()
  )
2. Then I ran the following
   lttng-gen-tp smallestTracePoint.tp -o smallestTracePoint.h -o
smallestTracePoint.c

which generated the files smallestTracePoint.c and smallestTracePoint.h

3. Then, I put the *smallestTracePoint.h* and *smallestTracePoint.c* in
*httpd-2.4.7/server* directory,
included  *smallestTracePoint.h *in the *main.c  *file and added trace
points in the int *main(int argc, const char * const argv[])* and
**init_process(int
*argc, const char * const * *argv)* functions.

4. Then I added *-finstrument-functions* in the *configure* file (Line
number 2830) in the extracted *httpd-2.4.7* directory, full line below
  ac_compile='$CC -c $CFLAGS -finstrument-functions $CPPFLAGS
conftest.$ac_ext >&5'

5. Then, from the /httpd-2.4.7 directory, I ran the following command to
configure the installation, it completed without any error.
    ./configure --libdir=/usr/lib/usr/lib/liblttng-ust.so
--with-included-apr

6. When I ran the command 'make', I get the following error after a while
...
make[1]: Entering directory `/root/httpd-2.4.7'
/root/httpd-2.4.7/srclib/apr/libtool --silent --mode=compile gcc
-std=gnu99  -g -O2 -pthread      -DLINUX -D_REENTRANT -D_GNU_SOURCE     -I.
-I/root/httpd-2.4.7/os/unix -I/root/httpd-2.4.7/include
-I/root/httpd-2.4.7/srclib/apr/include
-I/root/httpd-2.4.7/srclib/apr-util/include
-I/root/httpd-2.4.7/srclib/apr-util/xml/expat/lib
-I/root/httpd-2.4.7/modules/aaa -I/root/httpd-2.4.7/modules/cache
-I/root/httpd-2.4.7/modules/core -I/root/httpd-2.4.7/modules/database
-I/root/httpd-2.4.7/modules/filters -I/root/httpd-2.4.7/modules/ldap
-I/root/httpd-2.4.7/modules/loggers -I/root/httpd-2.4.7/modules/lua
-I/root/httpd-2.4.7/modules/proxy -I/root/httpd-2.4.7/modules/session
-I/root/httpd-2.4.7/modules/ssl -I/root/httpd-2.4.7/modules/test
-I/root/httpd-2.4.7/server -I/root/httpd-2.4.7/modules/arch/unix
-I/root/httpd-2.4.7/modules/dav/main -I/root/httpd-2.4.7/modules/generators
-I/root/httpd-2.4.7/modules/mappers  -prefer-non-pic -static -c modules.c
&& touch modules.lo
gcc -std=gnu99  -g -O2 -pthread      -DLINUX -D_REENTRANT -D_GNU_SOURCE
-I. -I/root/httpd-2.4.7/os/unix -I/root/httpd-2.4.7/include
-I/root/httpd-2.4.7/srclib/apr/include
-I/root/httpd-2.4.7/srclib/apr-util/include
-I/root/httpd-2.4.7/srclib/apr-util/xml/expat/lib
-I/root/httpd-2.4.7/modules/aaa -I/root/httpd-2.4.7/modules/cache
-I/root/httpd-2.4.7/modules/core -I/root/httpd-2.4.7/modules/database
-I/root/httpd-2.4.7/modules/filters -I/root/httpd-2.4.7/modules/ldap
-I/root/httpd-2.4.7/modules/loggers -I/root/httpd-2.4.7/modules/lua
-I/root/httpd-2.4.7/modules/proxy -I/root/httpd-2.4.7/modules/session
-I/root/httpd-2.4.7/modules/ssl -I/root/httpd-2.4.7/modules/test
-I/root/httpd-2.4.7/server -I/root/httpd-2.4.7/modules/arch/unix
-I/root/httpd-2.4.7/modules/dav/main -I/root/httpd-2.4.7/modules/generators
-I/root/httpd-2.4.7/modules/mappers  -c /root/httpd-2.4.7/server/buildmark.c
/root/httpd-2.4.7/srclib/apr/libtool --silent --mode=link gcc -std=gnu99
-g -O2 -pthread         -o httpd  modules.lo buildmark.o -export-dynamic
server/libmain.la modules/core/libmod_so.la
modules/http/libmod_http.laserver/mpm/event/
libevent.la os/unix/libos.la -L/usr/lib/x86_64-linux-gnu -lpcre
/root/httpd-2.4.7/srclib/apr-util/libaprutil-1.la/root/httpd-2.4.7/srclib/apr-util/xml/expat/
libexpat.la /root/httpd-2.4.7/srclib/apr/libapr-1.la -luuid -lrt -lcrypt
-lpthread -ldl
server/.libs/libmain.a(main.o): In function `main':
/root/httpd-2.4.7/server/main.c:443: undefined reference to
`__tracepoint_mk___apache_process_entry'
server/.libs/libmain.a(main.o): In function `init_process':
/root/httpd-2.4.7/server/main.c:284: undefined reference to
`__tracepoint_mk___apache_process_entry'
server/.libs/libmain.a(main.o): In function
`__tracepoint_cb_mk___apache_process_entry':
/root/httpd-2.4.7/server/smallestTracePoint.h:13: undefined reference to
`tracepoint_dlopen'
/root/httpd-2.4.7/server/smallestTracePoint.h:13: undefined reference to
`__tracepoint_mk___apache_process_entry'
/root/httpd-2.4.7/server/smallestTracePoint.h:13: undefined reference to
`tracepoint_dlopen'
/root/httpd-2.4.7/server/smallestTracePoint.h:13: undefined reference to
`tracepoint_dlopen'
/root/httpd-2.4.7/server/smallestTracePoint.h:13: undefined reference to
`tracepoint_dlopen'
/root/httpd-2.4.7/server/smallestTracePoint.h:13: undefined reference to
`__tracepoint_mk___apache_process_entry'
/root/httpd-2.4.7/server/smallestTracePoint.h:13: undefined reference to
`tracepoint_dlopen'
/root/httpd-2.4.7/server/smallestTracePoint.h:13: undefined reference to
`tracepoint_dlopen'
collect2: ld returned 1 exit status
make[1]: *** [httpd] Error 1
make[1]: Leaving directory `/root/httpd-2.4.7'
make: *** [all-recursive] Error 1

I have tried including the *smallestTracePoint.c* file in the local
makefile (*/root/httpd-2.4.7/MakeFile)*... didn't do me any good.
Any idea what I am doing wrong ?


LTTng version on the instance: 2.4.0-rc2 - Époque Opaque

Linux Distribution: Ubuntu 12.04.3 LTS


Thanks,


-- 
Mehran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20140121/1158c9e0/attachment.html>


More information about the lttng-dev mailing list