diff --git a/LabScripts/GeneralTracing/set_vars.bat b/LabScripts/GeneralTracing/set_vars.bat index 98942d17..a9015299 100644 --- a/LabScripts/GeneralTracing/set_vars.bat +++ b/LabScripts/GeneralTracing/set_vars.bat @@ -26,12 +26,6 @@ set DX_Flags=DX:0x2F :Windows8 -rem These are some typical flags used by UIforETW: -rem Kernel flags: Latency+POWER+DISPATCHER+DISK_IO_INIT+FILE_IO+FILE_IO_INIT+VIRT_ALLOC+MEMINFO -rem Stackwalk flags: Profile+CSwitch+ReadyThread+VirtualAlloc+VirtualFree -rem Buffer size flags: -buffersize 1024 -minbuffers 1200 -maxbuffers 1200 -rem User session flags: Microsoft-Windows-Win32k:0xfdffffffefffffff+Multi-MAIN+Multi-FrameRate+Multi-Input+Multi-Worker+Microsoft-Windows-Kernel-Memory:0xE0+Microsoft-Windows-Kernel-Power+chrome:0x8000000000000200 - rem %temp% should be a good location for temporary traces. rem Make sure this is a fast drive, preferably an SSD. set xperftemptracedir=%temp% @@ -41,5 +35,14 @@ set userfile=%xperftemptracedir%\user.etl set SessionName=usersession set FileName=trace.etl set FileAndCompressFlags="%FileName%" -compress + +rem PROC_THREAD+LOADER are required in order to know what binaries are loaded +rem and what threads are running. +rem CSWITCH records context switch data so that precise CPU usage and context +rem switch counts can be recorded. So, these three flags are our minimum set +rem of kernel providers. set KernelProviders=PROC_THREAD+LOADER+CSWITCH + +rem These user providers record GPU usage, window-in-focus, eventemitter events +rem (if emitted), and process working-set samples. set UserProviders=%DX_Flags%+Microsoft-Windows-Win32k:0xfdffffffefffffff+Multi-MAIN+Multi-FrameRate+Multi-Input+Multi-Worker+Microsoft-Windows-Kernel-Memory:0xE0 diff --git a/LabScripts/GeneralTracing/start_tracing.bat b/LabScripts/GeneralTracing/start_tracing.bat index 097afae9..28ee37cb 100644 --- a/LabScripts/GeneralTracing/start_tracing.bat +++ b/LabScripts/GeneralTracing/start_tracing.bat @@ -30,12 +30,20 @@ rem running. Otherwise the start command will fail with incredibly cryptic rem errors. Ignore all warnings because in most cases they are expected. xperf -stop %SessionName% -stop 2>nul -rem PROC_THREAD+LOADER is required in order to know what binaries are loaded -rem what threads are running. -rem CSWITCH records context switch data so that precise CPU usage and contxt -rem switch counts can be recorded. - +if "%1" == "detailed" goto detailed xperf.exe -start %logger% -on %KernelProviders% -buffersize 1024 -minbuffers 60 -maxbuffers 60 -f "%kernelfile%" -start %SessionName% -on %UserProviders% -f "%userfile% +goto skipdetailed +:detailed +rem These are some typical flags used by UIforETW to get more detailed traces, +rem which we optionally enable for lab tracing. +rem This extra information will distort timings. This is particularly true +rem of the CSwitch and ReadyThread stackwalk flags. +set KernelProviders=%KernelProviders%+CSWITCH+DISK_IO+HARD_FAULTS+DPC+INTERRUPT+PROFILE +set KernelProviders=%KernelProviders%+POWER+DISPATCHER+DISK_IO_INIT+FILE_IO+FILE_IO_INIT+VIRT_ALLOC+MEMINFO +set StackWalkFlags=Profile+CSwitch+ReadyThread +xperf.exe -start %logger% -on %KernelProviders% -stackwalk %StackWalkFlags% -buffersize 1024 -minbuffers 160 -maxbuffers 160 -f "%kernelfile%" -start %SessionName% -on %UserProviders% -f "%userfile% +:skipdetailed + rem You have to invoke -capturestate because otherwise the ETW gnomes will not rem reliably record the user-mode data to your trace. Do not anger the gnomes. xperf.exe -capturestate %SessionName% %UserProviders%