Skip to content

Usage: Integrate CxxProf into your project

Nils Brinkmann edited this page Apr 25, 2014 · 7 revisions

We currently have no binary releases for CxxProf, so you'll need to compile the necessary components yourself. Don't worry it's not that hard and should work out of the box. We have a DevGuide online, where the compilation is explained.

After that it's quite simple to integrate CxxProf into your project:

##Integration

  1. Define the Preprocessor directive USECXXPROF. If this define is not set, CxxProf will not include anything into your code. You can later use this mechanism to remove CxxProf from your Release builds.
  2. Link to cxxprof_static.lib
  3. Add the CxxProf macros to your project. This is described in great detail in the Coding guide.
  4. Add a CXXPROF_SHUTDOWN at the very end of your application. This call terminates any open activities and sends them to the server.
  5. You should be able to compile everything as usually. If there are any problems please do not hesitate to contact us or directly open an issue.

##Execution

  1. As cxxprof_static loads a plugin from the working directory you should now put cxxprof_dyn_network.dll into your execution directory. If the plugin is not found, CxxProf will do nothing. So if you do not want to use CxxProf you can simply leave the plugin out of your execution directory and everything runs as usually.
  2. CxxProf needs some Thirdparty in order to run. If you built CxxProf on Windows and used our provided Thirdparty package you can find all the needed DLLs in the bin directory of each library. You need to enhance your PATH or LD_LIBRARY_PATH (depending on the system you're using) with the following Thirdparty:
    • Boost
    • Pluma
    • Zmq
  3. Before starting your application you need to start the cxxprof_server. This application receives and manages all the data that CxxProf is generating.
  4. Now you simply need to start your application and wait for the data to come in

##Analysis When you've finished testing simply shutdown your application and the cxxprof_server. When you're looking at the servers directory, you'll find a session_date_time.db. This is a SQLite database with all your profiled data. You can use a SQLite viewer to view your data.

As you probably have generated a lot of data it is difficult to get an overview about what happened when. We're currently using Google Chromes Tracing view to display the data in a more clear way. There is a guide available which explains how you can use it.

##Afterword We want to make the usage of CxxProf as easy as possible. So if you found that something was not explained in sufficient detail please leave a note or create an issue.

We're collecting usage examples on our Examples Page. So if you have some interesting data or even a user story about how CxxProf helped you find something improvement-worthy in your software, we would be thrilled to hear about it.