smourier/TraceSpy

high CPU usage and non responsive UI while running the tool in background

Closed this issue · 4 comments

I had your tool running and wanted to start capturing ETW events. Because your tool doesn't support the *EventSource syntax to start providers, I've opened an .ETL file in Perfview, to dump the provider and get the GUID.

Here I noticed that your tool gets frozen and uses 1 full CPU core. So I used Windows Performance Recorder to start a trace and captured the CPU Sampling data and viewed them in Windows Performance Analyzer which shows that you use a Timer to check if the ListViewItems are visible (System.Windows.Forms.ni.dll!System.Windows.Forms.ListViewItem.EnsureVisible())

grafik

Is this really required? Try to avoid the check to reduce CPU usage.

Hi,

Not sure what you mean by the "*EventSource syntax"? The tool is really targeting only traces as strings, written to ETW using WriteMessageString. ETW has other full-featured tool for all cases.

Concerning perf, yes, the bottleneck is really on Winforms. It can take quite a time to write big load of traces, but it shouldn't have any impact on the process that writes events. You can try uncheck "auto scroll" to enhance some of it. What I also regularly do is clear the whole traces (CTRL-X). But there's no magic bullet. Since traces information are only kept in the tool, I can't use virtualized listview.

I've been using the tool for many years now, and I've not really been annoyed to the point I felt a need for a big rewrite. But this is open source, If you see simple improvements, don't hesitate to propose them

as I wrote, to capture ETW providers you need to register them and use the GUID in your tool. This sucks and here comes the new syntax. This avoids registration. To know the GUID of my Eventsource Providers I opened an ETL in perfview and saw the issue with the CPU usage.

Nope. You don't need to register anything to use WriteMessageEvent. The small sample shown in https://github.com/smourier/TraceSpy demonstrates what you only need (you do need a guid, yes, but nothing to register).

TraceSpy targets these ETW scenarios only, it's far from being a generic ETW capture tool. It only supports simple strings created with WriteMessageEvent.

ok, this is sad. I'll code my own tool