Please enable JavaScript to view this site.

Performance Validator Help

Navigation: » No topics above this level «

API

Scroll Prev Top Next More

 

The Performance Validator API

 

There are some features of Performance Validator that are useful to call directly from your program, including tracking of memory in custom heap managers.

 

Performance Validator has an API that makes this possible; just include svlPVAPI.c and svlPVAPI.h to your codebase. There is no library to link to, dlls to copy.

 

 

Source files

 

The source files can be found in the API directory in the Performance Validator install directory.

 

 svlPVAPI.h

 svlPVAPI.c

 

Just add these files to your project and build.
 
If you are using precompiled headers you will need to disable them for svlPVAPI.c.

 

 

Working with services?

 

If you are working with services you to attach Performance Validator to a service and to start Performance Validator, you should use the NT Service API, not the functions in this API.

 

All the other functions in this API can be used with applications and with services.

 

 

Unicode or ANSI?

 

All the API functions are provided in Unicode and ANSI variants where strings are used. We've also provided a character width neutral #define in the same fashion that the Windows.h header files do.

 

For example the function for naming a heap is provided as pvSetHeapNameA(), pvSetHeapNameW() with the character width neutral pvSetHeapName() mapping to pvSetHeapNameW() for unicode and pvSetHeapNameA() for ANSI.

 

In this document we're going to use TCHAR like the Window.h header files do.

 

 

Deploying on a customer machine

 

You can use the API without incurring any dependency on Performance Validator.

 

If Performance Validator is not installed on the machine the software runs on, nothing will happen.

 

This allows you to add the Performance Validator API to your software without need to have a separate build for use with Performance Validator.

 

 

Loading the Profiler

 

For most use cases won't need to load the profiler, as the profiler will have been loaded when your launched your program from Performance Validator, or when you injected into your program using Inject or Wait For Application.

 

However if you're running your program from outside of Performance Validator and want to load the profiler from inside your program you can use pvLoadProfiler() to do that. You'll then need to call pvStartProfiler() to start it.

 

 

Starting the Profiler

 

To start the profiler from your API code you need to call the function pvStartProfiler() from your code before you call any API functions. Ideally you should call this function as early in your program as possible.

 

If you prefer to start the profiler from the user interface or command line you can omit the pvStartProfiler() call. You can leave it present if you wish to start Performance Validator from your program.

 

 

Naming threads

 

You can name threads using the pvSetThreadNameA() and pvSetThreadNameW() functions.

 

 

Turning data collection on and off

 

You can turn data collection on and off using the pvSetCollect() function.
 
You can use pvGetCollect() to inspect the data collection status.