Understanding Visual Studio Analyzer Event Logs

   

Visual Studio Analyzer stores the events it collects in an event log. Once created and used for recording events, event logs never change. You use event logs in conjunction with filters and views to analyze your application with Visual Studio Analyzer. A filter defines the contents of an event log; that is, which events are collected. You open views on event logs so you can see the contents of the log. As you refine the filter, you exclude from the view the components and events that do not show evidence of a problem.

Comparing Visual Studio Analyzer Event Logs and Standard Log Files

A Visual Studio Analyzer event log provides you with more control over data than a standard log file. Through it you can:

  • Filter events in the log, both when you collect them and when you analyze them. Filtering keeps the log from getting too large. See Understanding Visual Studio Analyzer Filters for more information on filters.

  • Use predefined categories for events, gaining an extra level of structure in the log.

Creating Event Logs

If you use the Visual Studio Analyzer Wizard to create your Visual Studio Analyzer project, one event log is created for you. If you don't use the Analyzer Wizard, you need to create an event log manually before you can collect any events. You can create as many event logs as you like; the amount is limited only by available system resources, but you can have only one active event log at a time. Visual Studio Analyzer stores event logs uncompressed and accesses them directly from disk, for the highest performance. Event logs can become very large. Therefore, each time you stop recording on an event log, the event log closes and you need to create a new event log if you want to run your application again and collect data from it.

See Defining an Event Log for the steps to create an event log.

Filters and Event Logs

You can reduce the set of events displayed in a Visual Studio Analyzer view by applying a filter to the view. When you open an event log in one of Visual Studio Analyzer's views, the view is autofiltered — that is, the filter applied to any other open view is also applied to the view in which you open the event log. If there are no other open views, or if none of the other open views have filters applied, the view is unfiltered, which means that you see all the events in the event log.

You can apply any filter you want to the view or you can edit the existing filter. Remember that if the view is autofiltered, changes you make to the filter will be reflected in all views. A filter changes what you see of an event log. It does not affect the actual contents of the event log.

You need both a recording filter and an event log in order to collect events from your application. The order in which you specify these items does not matter, as long as you set a recording filter and then start recording on the event log you want. Once you have started recording on an event log, you can run your application. Visual Studio Analyzer will collect the events that your application generates into that event log. You can then pause, resume, or stop recording on that event log.

Event Logs and Views

The events in the selected event log populate the Visual Studio Analyzer view you choose; you can also open views on multiple event logs, as long as only one log is active. The active log can be recording events from your application at the same time you are looking at it in a view; you can also have views open on more than one event log at any time. For example, you might have log 1, which is active, open in a Block Diagram view and, at the same time, have log 2 open in another Event List view. The logs are independent of each other. You can open as many views on a log as you wish.

Exporting and Importing Event Logs

You can export a Visual Studio Analyzer event log to a standard comma-separated variable (.csv) file, which you can then open in Microsoft® Access or Microsoft® Excel for further analysis and manipulation. You can also import an exported event log back into Visual Studio Analyzer. You must create a new empty event log to hold the imported log.

Note:   Some programs, such as Microsoft Excel, might treat exported Visual Studio Analyzer data as numeric, even when the data is enclosed in quotes. This can cause data to be translated incorrectly; for example, the hex value "1e8" might be incorrectly translated into the exponential value 1.0 E+8 = 100000000. If you run into this conversion problem with your data, then you might want to explicitly import your data into these programs as text. For Excel, this means renaming the .csv file to an alternate extension. Once you rename the file extension, Excel will prompt you for the data type of each field.

Event Log Files

A Visual Studio Analyzer event log is stored as a file with the .val extension. You can save an event log and then copy the event log to other Visual Studio Analyzer projects. You can open a saved event log and include it with your Visual Studio Analyzer project. This makes it easier to share event logs among team members.

Event Overflow

If your application is generating a lot of events, it's possible for Visual Studio Analyzer to get behind on data collection. When this happens, Visual Studio Analyzer generates an Overflow event that signals possible data loss. Visual Studio Analyzer contains a setting in the Options dialog that lets you control whether you want to pause your application so Visual Studio Analyzer can catch up or just continue to generate events without pausing your application.

There is a trade-off between pausing the application if it is generating a lot of events and continuing to collect data. If you don't want to pause the application, you risk missing events — the Overflow event indicates this condition. As a result, events have been lost, and you should be aware of that. Some Visual Studio Analyzer views might not look correct as the result of the Overflow event; for example, you might miss the return event of a call.