google / UIforETW

User interface for recording and managing ETW traces
https://randomascii.wordpress.com/2015/04/14/uiforetw-windows-performance-made-easier/
Apache License 2.0
1.55k stars 201 forks source link

the result .etl is too big #94

Closed chena1982 closed 7 years ago

chena1982 commented 7 years ago

my application is a mmo game.it's easily grow up to few GBs just record few minutes. i want just record the virtualalloc, i don't need the information about cpu usage. can you add some options? thanks.

randomascii commented 7 years ago

You could try doing shorter traces, or unchecking the two call stack checkboxes on the main window - that will lower the data rate significantly.

Or you could try this batch file that just records VirtAlloc events with alloc/free call stacks.

@if not "%etwtracedir%" == "" goto TraceDirSet @set etwtracedir=%homedrive%%homepath%\documents\etwtraces :TraceDirSet

@if exist "%etwtracedir%" goto TraceDirExists @mkdir "%etwtracedir%" :TraceDirExists

@for /F "tokens=2-4 delims=/- " %%A in ('date/T') do @set datevar=%%C-%%A-%%B @for /F "tokens=1-3 delims=:-. " %%A in ('echo %time%') do @set timevar=%%A-%%B-%%C&set hour=%%A @if %hour% LSS 10 set timevar=0%timevar% @set FileName=%etwtracedir%\%datevar%_%timevar%virtalloc%username%

@set FileName=%FileName%.etl

@set userproviders=Microsoft-Windows-Kernel-Memory:0xE0

xperf.exe -start "NT Kernel Logger" -on PROC_THREAD+LOADER+VIRT_ALLOC -stackwalk VirtualAlloc+VirtualFree -buffersize 1024 -minbuffers 1200 -maxbuffers 1200 -f "%temp%\kernel.etl" -start UIforETWSession -on %userproviders% -f "%temp%\user.etl" xperf.exe -capturestate UIforETWSession %userproviders% @pause xperf.exe -stop UIforETWSession -stop "NT Kernel Logger" xperf.exe -merge "%temp%\kernel.etl" "%temp%\user.etl" "%FileName%" -compress

chena1982 commented 7 years ago

use this bat, the etl file is very small, but i can't get the stack. i see it already use the parmas -stackwalk. how to get the stack? thanks

chena1982 commented 7 years ago

i found the most alloc is in Low Fragmentation Heap, etc file size is 2.97GB, and low fragmentation heap alloc count is 6.9M. is possible to not recorde some alloc accord the low fragmentation heap bucket size? sometimes i dont care the small size alloc.

thanks.

chena1982 commented 7 years ago

is possible to export stack as a address array not as a string? if export as a string, it's slow and can't get the file line number.

randomascii commented 7 years ago

The traces produced by that batch file will have two different call stacks in the Virtual Alloc tables - one for allocations and one for frees. Those are off by default (thanks Microsoft) so you'll have to enable them and rearrange the columns to suit your needs.

The batch file I supplied does not record heap allocations directly, it only records VirtualAlloc allocations. This reduces the data rate greatly, but it makes the results harder to interpret because it is unpredictable which heap allocations will lead to VirtualAlloc calls.

Stacks are recorded in the traces as an address array. They are translated to strings when you load symbols in WPA, not before.

Remember that UIforETW is just a wrapper around xperf.exe, ETW, and WPA.exe. It can't do anything that isn't supported by those tools.

This is not really an issue or feature request (file too big is a vague wish not a concrete request) so I'm going to close this. For discussions of how to use UIforETW the mailing list at https://groups.google.com/forum/#!forum/uiforetw may be a better choice. For discussions of how to use xperf and WPA... well, Microsoft doesn't have much of a support forum, but twitter might be a good option.