cmd line concurrency tools

Tracing and Analyzing application from within VS2019 using Concurrency Visualizer often keeps crashing for me. Also, I have been looking into some sort of cmd line support to make it seamless with automated workflows.

Found that there is a Concurrency Visualizer Cmd utility and even though it is versioned as VS2015 it still works just fine.

Typically it will be installed in c:\program files\Microsoft Concurrency Visualizer Collection Tools\ directory, so getting in path with those spaces is a pain, but that’s what it is..

Launching/Attaching is quite breeze and so in analyzing the trace. Here is one such case where i have provided with pid instead of process-name.

CVCollectionCmd.exe /attach /process 58284 /outdir  D:\scratch\ConcurrencyViz
CVCollectionCmd.exe /detach

set _NT_SYMBOL_PATH=D:\workdir\application\pdbs;srv*c:\Symbols*http://msdl.microsoft.com/download/symbols
CVCollectionCmd.exe /Analyze "D:\scratch\ConcurrencyViz\application_2020-05-14_121119.CvTrace"

Analysis is where it starts looking up the symbols and does a lot of heavy lifting. Note it will overwrite your traces with new symbols information. In case this messes up there is no way to get back traced data (better to have a copy if you are worried about it).

CVCollectionCmd.exe /Analyze "D:\scratch\ConcurrencyViz\application_2020-05-14_121119.CvTrace"
Microsoft (R) Concurrency Visualizer Collection Tool Version 14.0.50916.4
Copyright (C) Microsoft Corp. All rights reserved.

Event Parsing... 1%
Event Parsing... 2%
...
Event Parsing... 100%
Downloading PDBs... 0%
Downloading PDBs... 100%
Resolving Symbols... 0%
Resolving Symbols... 1%
Resolving Symbols... 2%
...
Resolving Symbols... 98%
Resolving Symbols... 99%
Resolving Symbols... 100%
Analyzing... 1%
Analyzing... 2%
...
Analyzing... 100%
Analysis of trace "D:\scratch\ConcurrencyViz\application_2020-05-14_121119.CvTrace" completed successfully.

ensure cmd is started with admin privileges, else the traces after analysis will be garbage

We don’t need to specify symbols path for tracing, in my case i ran the application and provided the pid for attaching. Now the funny thing is that even if the traced process exited colection won’t stop, you have to manually detach to stop. The comes the bit about specifying the symbol-paths and analyzing.

That’s it really, works pretty cool..