Profiling

== Profiling using the GNU profiler gprof ==

Prerequisites:
 – gcc (tested /w 4.2.3)
 – gprof (test /w 2.18.50)

1) Build/Link your executable using the gcc -pf option
  For most makefile based projects this could be done by adding
  CFLAGS="-pg" and/or CXXFLAGS="-pg" and LDFLAGS="-pg"
  to the make call
  For a standard makefile project:
   $ make CFLAGS="-pg" CXXFLAGS="-pg" LDFLAGS="-pg"

2) Change to the folder of the executabe and run it.
  This creates a file called gmon.out in the current directory.

3) Run: gprof ${Name_Of_Executable} > profile.txt
 -> This creates a simple textfile "profile.txt" which contains a nice
profile of the execution.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s