google / UIforETW

User interface for recording and managing ETW traces

Home Page:https://randomascii.wordpress.com/2015/04/14/uiforetw-windows-performance-made-easier/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can ETW capture Task Queue events related to Chrome?

rainkin1993 opened this issue · comments

In my understanding, when chrome download a file from a URL,

  1. A Socket thread will dequeue a network request from it's task queue. And try to connect and receive data from a certain URL.
  • If data is available, it will receive the data, and create and enqueu a new task to another File IO thread's task queue. The File IO thrad is responsible for writing received data to a disk file.
  • If data is not available, it will execute other tasks.
  1. A File IO thread will dequeue a request from it's task queue, and obtain the received data and write it to disk file.

My question is whether ETW can capture the task 1) enqueue and dequeue event 2) details of the task, such as id of task?

UIforETW can ask Chrome to emit ETW events for particular tracing categories. This requires cooperation between UIforETW and Chrome as they have to agree on how to map between category names and a bit mask. So, look in the UIforETW settings and the Chrome source code to see if the categories you care about can be monitored.

The Chrome ETW events will show up in WPA's Generic Events table. They aren't in the tidiest format ever, but sometimes they can be helpful. Improving this integration would be great but nobody is currently working on it.

I have one more question, how can I know which categories Chrome export to ETW? I mean whether Chrome export all logs of chrome://tracing to ETW?

After reading code from: https://cs.chromium.org/chromium/src/base/trace_event/trace_event_etw_export_win.cc?q=f:trace_event_etw_export_win.cc&sq=package:chromium&g=0&l=65

It seems that Chrome only export limited categories to ETW.

That source code is code that controls what categories can be requested. If we want to add more categories to that list (and to the equivalent list in UIforETW) then that is easy enough to do. We can't add all categories because we are ultimately squeezing them in to a bit mask, but there is still lots of room.

Very thanks for your help.

I also open a discussion thread in Chrome-dev google group.
https://groups.google.com/a/chromium.org/forum/#!mydiscussions/chromium-dev/9tHXHi0NScI


The following is the new question I copy from the link above:

My goal is to build a tool which can convert ETW traces of Chrome provider to json file which can be loaded in chrome://tracing.
Hopefully, recording trace for same chrome activities, the json my tool generated is the same as the json exported by chrome://tracing.
I have already noticed that someone proposed this kind of tool in this link: https://bugs.chromium.org/p/chromium/issues/detail?id=508663

Now I have the following problems:

  1. It seems that Chrome emit incomplete field listed in Trace Event Foramt which is used by the Chrome://tracing tool.

For example, browser process send a IPC message to render process.
There should be two events, send ipc and receive ipc.
Each event has a field called bind_id, which can be used to connect two event.

{"pid":18252,"tid":4756,"ts":614252235944,"ph":"X","cat":"disabled-by-default-ipc.flow","name":"MessagePipeReader::Send","args":{},"dur":2,"tdur":2,"tts":448747888,"id":"0x0","bind_id":"0xd31a3a02","flow_out":true},

{"pid":10636,"tid":3476,"ts":614252235989,"ph":"X","cat":"disabled-by-default-ipc.flow","name":"MessagePipeReader::Receive","args":{},"dur":4,"tdur":4,"tts":2558781,"id":"0x0","bind_id":"0xd31a3a02","flow_in":true}

The following is raw event I obtained from ETW:

"MessagePipeReader::Send", "Complete", "", "", "", "", "", ""

"MessagePipeReader::Receive", "Complete", "", "", "", "", "", ""

The conclusion is that I cannot recover the results showed in chrome://tracing due to incomplete events. Please correct me if I misunderstand ETW traces.

  1. Is there any other tools which can capture the same events as chrome://tracing but these tools can be executed outside Chrome, just like ETW?
    Or does chrome support automatically saving events of chrome://tracing to disk in background without touching the chrome://tracing page manually.

Thanks