다음을 통해 공유


Data Access Tracing (Legacy)

This procedure was available prior to Windows 8. See Data Access Tracing (Windows 8) for the data access tracing procedure that is available on Windows 8. General information about data access tracing can be found at Data Access Tracing.

WDAC includes tracing support. A simple tracing scenario is to find bugs and performance issues in an (ODBC, OLE DB, or ADO) application that connects to a database.

The trace can show you the order of code execution from the application through the various WDAC components, and error code path that allows you to see problems.

Data Access (BID) Tracing

The following information will make it easier to perform data access tracing with WDAC.

Setting Up the Trace

You must register the BID Adapter and the data tracing schema before starting the trace.

Register BID Adapter

Warning

Before modifying the registry, make a back up and be ready to restore the registry, if a problem occurs.

  1. Open the Registry Editor by typing regedit in the Run dialog box, which you can open from the Start menu.

  2. In the tree view, locate the following registry key: HKEY_LOCAL_MACHINE\Software\Microsoft\BidInterface\Loader

    One exception is when tracing a 32-bit application on 64-bit platform (WOW). In this case, please use the registry key in Wow6432Node as follows: HKEY_LOCAL_MACHINE\software\Wow6432Node\Microsoft\BidInterface\Loader

    If you do not see the Loader key, right click the BidInterface key and select New, then Key. Name the key Loader.

  3. Right click the Loader key and select New, then String. Name the value :Path. Note that the colon before Path is significant.

  4. Right-click the new registry value that you just added and select Modify. This will bring up the Edit String dialog box.

  5. In the Edit String dialog box, enter the value of this key: %SYSTEMROOT%\SYSTEM32\msdaDiag.dll

Register Data Tracing Schema

To register the data tracing schema,

  1. Download the wdac.mof file to your computer. You can download wdac.mof from the download link in Data Access Tracing. (The download link is near the top of the article.)

  2. Run cmd.exe as administrator to open the console window:

    1. Change to the directory that contains wdac.mof.

    2. Run the command mofcomp wdac.mof to register the tracing schema.

    3. Verify that the ETW providers are correctly registered with the command logman query providers.

Running the Trace

After you register the BID Adapter and the data tracing schema, you can run the trace.

  1. Download the file ctrl.guid.mdac to your computer. You can download wdac.mof from the download link in Data Access Tracing.

  2. Run cmd.exe as administrator to open the console window:

    1. Change to the directory that contains ctrl.guid.mdac.

    2. Run the following command: Logman start MyTrace -pf ctrl.guid.mdac -ct perf -o Out.etl -ets

MyTrace is the name you select for the trace instance.

-pf ctrl.guid.mdac specifies the control GUID file that lists the Event Trace providers to be enabled.

-ct perf creates better time granularity within the trace captures. This is not available on Windows XP.

-o Out.etl specifies the output file name that stores the Event Trace Log.

-ets sends commands to the Event Trace Sessions directly without saving or scheduling.

This does not apply to Windows 2000. If you are trying to trace on Windows 2000, please see the Special Considerations for Tracing on Windows 2000 section in Data Access Tracing.

Stopping a Trace

In the console window, you can stop the trace (that you started in the previous section) with the following command:

Logman stop MyTrace -ets

Viewing Trace Output

You can view the trace output by running the following command in the console window:

TraceRPT /y out.etl

This command parses the Event Trace Log, and, by default, converts it to an XML file called dumpfile.xml.

The following command converts the Event Trace Log to a comma-separated value file called dumpfile.csv:

TraceRPT /y out.etl /f dumpfile.csv /of CSV