Table of Contents
1 - Introduction2 - Profiling your application
1 - Integrating the SDK
4 - Block types
5 - Event attributes
6 - Defining expressions
3 - User interface reference2 - Initialising the profiler
3 - Profile events4 - Block types
5 - Event attributes
6 - Defining expressions
4 - SDK Reference
Contact Information
Sales
Sales and licensing related questions should be sent to our sales team at:Feedback
If you have feedback regarding this website or any of our products, please use the following email address:Support
Questions related to problems you have encountered with either this website or any of our products should be directed to our support team at:Enquiries
Any other questions, or general enquiries should be sent to the following email address:2.2 - Initialising the profiler
Once the Oso Memory Profiler SDK is compiled into your application, the only thing left to do is actually initialise it.Technically speaking, the profiler responds to memory allocation requests from the host application, and partially initialises itself. You still have to implement a single function (OsoMP_InitialiseCallback) that is called by the profiler as part of the initialisation procedure.
It is the responsibility of your implementation of this function to complete the initialisation process by calling OsoMP_Initialise. The parameters you pass to this function determine whether your profile data will be stored on the local file system (or on a mapped network share), or whether it will be sent via TCP directly to the Oso Memory Profiler. Or both.
It should be noted that this function will most probably be called as soon as the runtime libraries begin initialising themselves, so as a rule you cannot rely on global variables to be initialised before your callback function is called. You should also not try to allocate memory using standard language memory allocation functions. (I.e., the functions that you are profiling.) It should be safe to call OS-level functions to allocate memory if necessary.
Local Profiling
An extremely simple example implementation of your callback function to initialise for local profiling is as follows:void OsoMP_InitialiseCallback() { OsoMP_Initialise( "C:\\myapp.memoryprofile", NULL, 0, 0 ); }
Remote Profiling
An alternative example callback function to initialise for remote profiling is as follows:void OsoMP_InitialiseCallback() { OsoMP_Initialise( NULL, "127.0.0.1", OSOMP_PortNumber, 0 ); }
The astute reader will notice that it is possible to pass both a filename and network connection settings to OsoMP_Initialise. Doing so will enable both local and remote profiling in a single session.
Additional Setup
Once OsoMP_Initialise returns, your implementation of this function should register any other settings required for your profiling session. These can include none, some, or all of the following:- Defining the session name through a call to OsoMP_SessionName.
- Setting the name of the main thread with OsoMP_ThreadName.
- Defining new attribute types through calls to OsoMP_NewAttributeType.
- Registering new block types with OsoMP_NewBlockType.
- Adding new warning and error conditions through calls to OsoMP_NewWarningCondition and OsoMP_NewErrorCondition respectively.