Parsing ETL traces yourself, part 1: wpaexporter
The Windows Performance Analyzer (WPA) gives you a graphical view of the contents of an ETL (event trace log) file. But sometimes you want to process these log files programmatically, say, because you have a large number of these traces and you want to do some bulk analysis over them.
One option is to use the wpaexporter tool that comes with the Windows Performance Analyzer. The idea behind this tool is that you WPA to set up a view that contains what you want to export, and then save it as a profile, let’s call it export.wpaProfile.
You then feed that profile to the wpaexporter program alongside an ETL file, and it will load the ETL file, apply the profile, and then output the view as a comma-separated-values (CSV) file.¹
The wpaexporter program is a bit finicky about its command line, in ways not mentioned in its documentation: The command line switches are sensitive to order.
The command line switches fall into categories, and the categories have an order. The switches within a category can appear in any order (as far as I can tell), but the categories themselves need to be ordered.
|Trace||-range start end
-marks start end
¹ The poor-man’s version of this is to use WPA to get the view you like,² then hit Ctrl+A to select all, then Ctrl+C to copy the view to the clipboard. You can then paste it into a text file or directly into a spreadsheet. Note, however, that the format of the copied text is almost-but-not-quite CSV: If the text in a column contains a comma, the Ctrl+C command does not protect the comma with quotation marks. This is particularly troublesome when the column contains numbers, because WPA inserts thousands separators into large numbers. You can postprocess this out by noticing that Ctrl+C uses a comma followed by a space to separate columns.
² Here are some handy tricks for getting the view you like:
- Right-click a cell and select Expand Column to expand all the nodes in this column.
- Right-click a cell and select Filter To Selection or Filter Out Selection to apply a quick filter.
- Use the View Editor (click the gear icon in the mini-title-bar or hit Ctrl+E) to configure the columns all at one go.
- In the View Editor, click Advanced to do even more stuff. My favorites are the Filter tab to apply a custom filter and the Expansion tab to preconfigure which rows are expanded.