Collecting CAP Data
There are three ways to capture CAP profiling data:
-
Upon termination of the application, profiling data is written to a text file. The name of the text file is APPNAME.END.
-
Using the CapDump utility (CAPDUMP.EXE). The name of the text file is APPNAME.CAP. You can use the CapDump utility to stop profiling and clear or write profiling data for all applications being profiled, at any time. You can also use CapDump to change the extension of the output file. CapDump generates a log file, CAPDUMP.LOG. It will contain any errors that occur during operation. For error-free operation, CAPDUMP.LOG will be empty.
-
Using the CAP exported routines. These functions were declared using the standard-call calling convention; they take no parameters and have no return value. The function are:
-
StartCAP: Clear profiling data and start profiling.
-
StopCAP: Stop profiling.
-
DumpCAP: Write data for the current instance of CAP.DLL. The name of the text file is APPNAME.CAP.
Data files are created in the same directory as the application that is being profiled. Data is appended to data files with each write operation. A separate call tree is generated for each thread in the process. Different sections in the data file indicate data for different threads in the process. The following data is written:
-
Call depth in the tree
-
Function name
-
Number of calls
-
Total time for the function+callees
-
Time per call for the function+callees
-
Total time of the function only
-
Time per call of the function only
-
First time (function+callees)
-
Minimum time (function+callees)
-
Maximum time (function+callees)
You can use the CapStats utility (CAPSTATS.EXE) for parsing and summarizing data stored in .CAP files. CapStats can be used to:
-
Extract data for one or more individual threads from a .CAP file.
-
Write summary information into .CSV format that can be read into a data processing application, such as Microsoft Excel.
-
List callers and callees of any function that appears in the profile data.
-
Convert .CAP files to .CAB (CAP Binary) files, which CapStats can parse 10-100 times more quickly.
For example, to convert SOL.CAP to SOL.CAB, type:
capstats /B:sol.cab sol.cap
To summarize all functions in your file for import into a data processing application, type:
capstats /D sol.cab > sol.csv
The following samples can be used to get more detail about a particular function:
capstats /C:<funcname> sol.cab
or
capstats /T:<funcname> /B:<funcname>.cab sol.cab
For complete command-line syntax, type:
capstats /?