Capture Options

NI Spy

Capture Options

To view or modify your NI Spy capture options, select Spy»Options. By default, NI Spy displays 1000 calls in the capture window, displays buffers in Small buffer mode, and does not enable file logging.

Note  You can modify NI Spy options only when capture is stopped.

Call History Depth

The Call history depth reflects the maximum number of API calls that NI Spy can display. When the number of captured API calls exceeds the Call history depth, only the most recent calls are kept. If your computer runs out of memory, NI Spy stops capture and displays a message box saying it is out of memory.

Start NI Spy with Capture On

Select the Start NI Spy with capture on checkbox to start NI Spy capture automatically. By default, this option is not selected, and NI Spy starts with capture off.

Buffer Limit Per Parameter

When NI Spy records an API call that includes a buffer, the buffer contents are displayed in NI Spy. You can specify how much of the buffer to record and save by choosing Small buffer or Large buffer mode. Small buffer mode displays up to 64 bytes of data. If there are more than 64 bytes of data, NI Spy displays only the first and last 32 bytes of data. Large buffer mode displays up to 64 KB of data, but may significantly slow down your application. If there are more than 64 KB of data, NI Spy displays only the first and last 32 KB of data. Both buffer modes use an entire row of dashes to signify omitted data.

File Logging

If file logging is enabled, NI Spy writes all recorded calls to the specified log file. NI Spy can save calls in three formats: a binary Spy Capture format, a plain text file, and a comma-separated variable (CSV) file. Only NI Spy can open a Spy Capture file, which is much more efficient to create. Using the plain text file and CSV formats creates logs that a wide variety of editors can read, but the logs contain less information and are much slower to create while logging.

To log calls, you must specify the name of a file to store the logged calls. Calls can either allow NI Spy to schedule writing or write to file as soon as possible.

By default, Allow NI Spy to schedule writing is selected. Selecting Allow NI Spy to schedule writing writes to the logfile for each captured call, but does not flush the logfile until capture is halted. This mode of file logging is much faster than specifying Write to file as soon as possible, but if your system crashes, at least some of the logfile likely will be lost.

Note  The use of file logging slows down the performance of all running applications, and if you are low on disk space, you are likely to run out of disk space.

Selecting Write to file as soon as possible ensures that the call is logged quickly. In a Spy Capture file, the call is written to file before returning control to the calling application, ensuring that the logfile is complete even if the system crashes. When writing to a plain text file or CSV file, the file is written when NI Spy displays it, and the call may not be logged if there is a crash.

File logging is useful in debugging an application that causes the system to crash. If you use file logging to log a Spy Capture file with Write to file as soon as possible selected, you can open the saved .spy file after your system has restarted to examine the API calls captured up to the point where the system crashed. If file logging is used in tandem with a plain text file or CSV file and Write to file as soon as possible is selected, other applications can use the output without having to stop logging.