perfview
perfview copied to clipboard
Command line for Thread time (with Tasks) Stacks
From command line, if I use :
PerfView.exe /BufferSizeMB:1024 /InMemoryCircularBuffer /zip:false /merge:false /circularmb:2048 /nogui /ThreadTime collect perfdetails.etl
And then if I open perfdetails.etl in PerfView, I don’t see Thread time (with Tasks) Stacks
. I only see Thread Time Stacks
.
What is the command line parameter for generating etl that can show Tasks stack
in PerfView ?
If, like me, you were looking for the Thread Time checkbox in the UI, it's waaaaayyyy out of sequence. It's near the top. The switch is /threadTime.
See:
And:
Same problem here Thread time (with Tasks) Stacks
is missing, only Thread Time Stacks
...
@kirsan31, you will also need to enable the TPL events. These are not enabled by default as they are quite verbose and can impact CPU sampling results.
@brianrob
you will also need to enable the TPL events. These are not enabled by default as they are quite verbose and can impact CPU sampling results.
Yes, sure. I tested it now from gui (with test app + Visual studio running) and have it. But in trace from our app it's absent 🤷♂️
Command line was:
[EXECUTING: PerfView /DataFile:D:\MMExtData\PerfView\4.81.8091.30106_2022.03.02.11.02.19.etl /Merge:true /zip:true /BufferSizeMB:256 /StackCompression /CircularMB:500 /MaxCollectSec:20 /KernelEvents:ThreadTime /TplEvents:Default /FocusProcess:13748 /logFile=D:\MMExtData\PerfView\perfViewRun.log /AcceptEula collect]
Interesting. Are you by chance able to share the trace? It looks like this view should show up as long as you specify /ThreadTime and TPL events.
@brianrob do you need full trace or only log? If full - can I some how send it to you in private manner?
Yes, I will need the full trace. Feel free to post it to a site such as OneDrive and then send a link to me at brianrob [at] microsoft.
Yes, I will need the full trace. Feel free to post it to a site such as OneDrive and then send a link to me at brianrob [at] microsoft.
Sent from golikova at gmail.
Got it. Thanks.
The issue is that you are capturing the TPL events, but it appears that stacks are not being collected, and this view requires stacks on these events in order to be useful. When I test this on my local machine, I do get the views that you're expecting:

Looking at the code, we filter the set of stacks to enable down to just TaskScheduled, TaskWaitSend, and AwaitTaskContinuationScheduled to avoid additional stack walking overhead since this provider is quite verbose. This is done by a Win8+ API that we check for by checking the version number of %Windir%\system32\Kernel32.dll
. Given that you captured this trace on Win 10, I have to believe that something is going wrong with this check - perhaps PerfView isn't properly opening the file, or something like that.
One thing that you can try is rather than specifying /TPLEvents:Default
, specify /Providers:.NETTasks:0x1ff:@StacksEnabled=true
. This will turn on stacks for all of the TPL events, and will bypass the check that seems to be failing on this machine.
Thank you!
This is done by a Win8+ API that we check for by checking the version number of
%Windir%\system32\Kernel32.dll
. Given that you captured this trace on Win 10, I have to believe that something is going wrong with this check - perhaps PerfView isn't properly opening the file, or something like that.
Maybe this is due to the fact that we have a rare version of the OS - win 10 for workstation
?
That's a good question - I don't know, and I'm not even quite sure where to get a copy to check.
That's a good question - I don't know, and I'm not even quite sure where to get a copy to check.
I think I can do some experiments, if you interested and have any ideas about this...
Yes, if you're able, it would be awesome to see what happens here in a debugger. This line ends up opening kernel32.dll
and that's where I think things are going wrong on your machine. If you're able to build a copy of PerfView and debug it, that would be great.
@brianrob
I've build a version from perfview-3.0 branch (because I have
only vs2022) with extra debug logging.
Result:
winDir C:\WINDOWS; kernel32 C:\WINDOWS\system32\Kernel32.dll
versionInfo 10.0.19041.1503 (WinBuild.160101.0800)
check have passed and Thread time (with Tasks) Stacks
is present.
Then I reverted to def. version and collected traces several times - Thread time (with Tasks) Stacks
was always present.
So this is intermittent problem 🤷♂️
Interesting. That one I can't explain...