Hallo oxe1976!
Danke für den Tip. Ich denke, gprof ist genau das Tool, das mir helfen könnte. Das Problem ist nur, ich weiss nicht, wie ich es zum Laufen bringe.
Also, diese LIVE555 codes bestehen aus haufenweise Verzeichnissen und Unterverzeichnissen und fast in jedem ist ein Makefile drin. Um die Codes zu bauen, musste ich ganz am Anfang
ausführen und dann einfach
eingeben. Das nur so zur Info.
Ich habe hier ein "Tutorial" für gprof gefunden: http://74.125.77.132/search?q=cache:-ByNpxMrA6oJ:linuxgazette.net/100/vinayak.html+gprof+Linux+Tutorial&hl=de&ct=clnk&cd=1&gl=de
Dort steht:
How to gather profiling information ??
The source code has to be compiled with the -pg option ( also with -g if you want line-by-line profiling ). If the number of lines in the Make file is small you can append these options to each compilation command. However if the number of compilation commands is large then you can define/redefine the CFLAGS/CXXFLAGS parameter in the makefile and add this to every compilation command in the makefile. I will demonstrate the use of gprof using the gnu make utility.
Unpack the gzipped tarball
$ tar zxf make-3.80.tar.gz
$ cd make-3.80
Run the configure script to create the makefiles
$ ./configure
[configure output snipped]
Edit the CFLAGS parameter in the makefile generated to remove optimization flags and add -pg to CFLAGS. GCC optimization flags are removed as compiler optimization can sometimes cause problems while profiling. Especially if you are doing line-by-line profiling, certain lines may be removed while optimizing source code.
Build the source code
$ make
[build output snipped]
We can use this make to build other software such as Apache, lynx and cvs. We build apache using this make as an example. When we untar, configure and run make on the source of Apache , a file called gmon.out containing profiling information is generated. You may observe that make may run slower than expected as it is logging the profile data. An important thing to be remembered while collecting profile data is that we have to run the program giving it the inputs we give it normally and then exiting when it is all done. This way you would have simulated a real-world scenario to collect data.
Daraufhin habe ich die config.linux-Datei geöffnet und das -pg eigefügt. Meine jetzige config.linux-Datei sieht jetzt so aus:
COMPILE_OPTS = $(INCLUDES) -I. -O2 -pg -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
C = c
C_COMPILER = cc
C_FLAGS = $(COMPILE_OPTS)
CPP = cpp
CPLUSPLUS_COMPILER = c++
CPLUSPLUS_FLAGS = $(COMPILE_OPTS) -Wall -DBSD=1
OBJ = o
LINK = c++ -o
LINK_OPTS = -L.
CONSOLE_LINK_OPTS = $(LINK_OPTS)
LIBRARY_LINK = ld -o
LIBRARY_LINK_OPTS = $(LINK_OPTS) -r -Bstatic
LIB_SUFFIX = a
LIBS_FOR_CONSOLE_APPLICATION =
LIBS_FOR_GUI_APPLICATION =
EXE =
Die -pg Option habe ich gleich in die erste Zeile eingefügt.
So. Dann habe ich wieder
./genMakefiles
aufgerufen und dann
make
. Laut dem Tutorial soll jetzt ein binäres File da sein, dass ich mit
gprof make gmon.out > name.txt
in eine für Menschen lesbare Datei umwandeln kann, wo dann drin steht, welche Funktion wieviel Zeit braucht.
Nur gibt es bei mir die Datei gmon.out nicht. Wird nicht erzeugt. Woran kann das liegen?
@Hello World!
An gdb hatte ich auch gedacht, aber hier brauche ich wirklich zu wissen, welche Funktion wieviel Zeit benötigt und das kann mir gdb doch nicht sagen. Danke aber für den Tip.
liebe Grüße
Anna