Calling Quantify API functions

You can call Quantify API functions from a debugger or from your program.

Note: Quantify can also collect performance data for Java applications running on a Solaris SPARC 32-bit Java virtual machine (JVM). For information about calling API methods from Java code, click

Calling API functions from a debugger

You can use Quantify's API functions by setting breakpoints in your debugger and then calling the appropriate function when the breakpoint is reached:

(gdb) call quantify_clear_data()
(dbx) print quantify_clear_data()
(xdb) p quantify_clear_data()

You can get help about using the API functions at run time by calling the API function quantify_help(). This function prints a list of the Quantify API functions, and supports cut and paste of the function names into the debugger.

Calling API functions from your program

To call Quantify functions from ANSI C and C++ programs, include the file quantify.h:

# include <quantify.h>

This header file is located in the same directory as Quantify. You might need to add the compiler option -I<quantifyhome> in your makefile to locate it.

After embedding API functions in your code, you must recompile your program.

If you call Quantify functions in your program, you should link with the Quantify API stubs library. This is a small library that stubs out all the Quantify API functions when you are not using Quantify. When you are using Quantify, the stubs are ignored.

Add the library <quantifyhome>/libquantify_stubs.a to your link line.

Here is an example of a makefile:

# Build Hello World
# Use: make -f Makefile.hello_world a.out.pure

# Quantify-related flags
QDIR        = `quantify -print-home-dir`
QFLAGS      = -ignore-runtime-options
QUANTIFY    = quantify $(QFLAGS)
QSTUBS      = $(QDIR)/quantify_stubs.a

# General flags
CC          = cc
CFLAGS      = -g -I$(QDIR)

# Targets
all:     a.out a.out.pure

a.out:   hello_world.c
$(CC) $(CFLAGS) -o $@ $? $(QSTUBS)

a.out.pure: hello_world.c
$(QUANTIFY) $(CC) $(CFLAGS) -o $@ $? $(QSTUBS)