-1

I use xperf to capture an ETW to a file.

As I set it, it only seems to write data on disc whenever -MaxFileLimit is reached.

xperf -start MySession -f Log.etl -on {GUID} -MaxFile 10 -FileMode Circular

Can I set it so it will write to file more frequent? I would like to be able to get the logs as soon as the events are happening.

LE: I want to log a trace to file, but also to keep the file from exceeding a size limit. And I want to be able to get copy of the file to see latest logged information without interrupting the logging session. (currently in order to get the useful info I have 2 options: to stop the session or to wait for the MaxFile to be reached). Hopefully my intent is clear now.

Alex
  • 39
  • 1
  • 7
  • create process that listens to the Event in realtime. TraceEvent class can do this: https://github.com/Microsoft/dotnet-samples/blob/master/Microsoft.Diagnostics.Tracing/TraceEvent/docs/TraceEvent.md#real-time-processing-of-events – magicandre1981 Jun 21 '18 at 14:32
  • If you don't mind, I'd be happy to understand better what problem are you trying to solve by increasing the flush timer. It seems likely that you're trying to solve an issue that is better addressed in a whole different way. – Sirotnikov Jun 21 '18 at 14:48
  • I have edited the question so to explain what I am trying to accomplish. – Alex Jun 22 '18 at 19:27
  • do what I told you. If you detect the event run xperf -stop command. – magicandre1981 Jun 23 '18 at 14:39

1 Answers1

0

Look at the -flushtimer option in https://learn.microsoft.com/en-us/windows-hardware/test/wpt/start

If you just want to make sure the logs are synced before you copy them (without stopping the session), you can issue a -flush command.

In most cases, I strongly suggest you let xperf do its thing. Otherwise you'll risk writing to disk so often it could have an impact on the performance problem you may be investigating, and you'll skew what ever it is you are measuring.

Sirotnikov
  • 444
  • 4
  • 10
  • I tried issuing a '-flush' command and also to set the 'flushtimer' both with no result. The log file has 0 bytes until I '-stop' the session. – Alex Jun 22 '18 at 16:33
  • weird. could you look at the settings of the active session in **Computer Management** > Performance > Data Collector Sets > Event Trace Sessions, find your xperf session and go to **properties** - then look at the "Trace Buffers" tab, and see the flush buffer timer value – Sirotnikov Jun 24 '18 at 19:04