You can save Quantify reports and messages to a log file. This allows you to run a Quantify'd program and then inspect the output from Quantify at your convenience.
You can use the -logfile option to reroute Quantify output, separating it from the program's normal output:
% setenv QUANTIFYOPTIONS '-logfile=/tmp/pureout \ -write-summary-file=none'
% a.out
Hello, World
%
Notice that there is no Quantify banner. Quantify writes the banner to the log file. The option -write-summary-file=none prevents the printing of the program summary report, which will not be added to the log file. You can print the program summary report later, using the command:
% qv -write-summary-file=- a.out.<pid>.0.qv
To view the program output and Quantify output at the same time, open a separate terminal window and view the log file in this window while your program is running. Use the command:
% tail -f /tmp/pureout
You can add informative messages to the log file by calling one of several Quantify API functions from your program.
The function pure_printf adds a message to all forms of Quantify output.
The function pure_logfile_printf is a variation, adding a message if the output goes to a log file.
These functions take a format string and a variable number of arguments just like printf.
The full % escape syntax of printf is not supported. You must limit escapes to simple %d, %u, %n, %s, %c, %e, %f, or %g. No field width or precision specifiers are allowed, and %e, %f, %g are equivalent to %10.2f.
To interleave your program's output with Quantify messages, use the option -copy-fd-output-to-logfile. Specify a list of file-descriptor numbers. For example, specifying 1,2 causes Quantify to copy all output written on file descriptors 1 and 2, interleaving it with Quantify output.