|
Profiling (with gcc)
Profiling allows you to view statistics on the processing time of portions of your
program. Hence, if you're trying to optimize your code, it is important to know the
portions of your program which do the most processing.
Step 1:
Compile your code for profiling.
Include the -gp option when compiling the source code. You might have to include the -lc or -lc_p libraries.
ex. gcc -o test main.cpp -pg
Step 2:
Execute your code.
Make sure your code exits normally, if you get a segmentation fault it will not work.
Step 3:
Run profiler.
Include the -gp option when compiling the source code. You might have to include the -lc or -lc_p libraries.
ex. gcc -o test main.cpp -pg -lc
|