-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Register thread to WR's profiler and the external profiler. #2014
Register thread to WR's profiler and the external profiler. #2014
Conversation
…is created and deleted.
@@ -1787,33 +1787,60 @@ impl Renderer { | |||
let debug_flags = options.debug_flags; | |||
let payload_tx_for_backend = payload_tx.clone(); | |||
let recorder = options.recorder; | |||
let worker_config = ThreadPoolConfig::new() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The worker_config is only used when we don't have the thread pool. So, move the config into the worker's unwrap_or_else() block.
pub enable_render_on_scroll: bool, | ||
pub debug_flags: DebugFlags, | ||
pub renderer_id: Option<u64>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might have multiple renderer in the same process. Use this renderer_id for identification.
Please check: |
Reviewed 2 of 2 files at r1. webrender/src/renderer.rs, line 1799 at r1 (raw file):
I think the start and end handlers are only called when the worker thread is created and destroyed. If so, that won't actually be useful for profiling - since we won't know when the thread is doing work or idle? webrender/src/renderer.rs, line 1816 at r1 (raw file):
This could be something like: let thread_name = format!("WRRenderBackend {}", options.renderer_id.unwrap_or(0)); Comments from Reviewable |
@bors-servo r+ |
📌 Commit e9f943c has been approved by |
…hread creation/destruction.
e9f943c
to
7c03ad8
Compare
@bors-servo r+ |
📌 Commit 7c03ad8 has been approved by |
Register thread to WR's profiler and the external profiler. The gecko profiler needs the thread to register itself to gecko profiler before collecting the performance data. In this patch, we have a new "thread listener" interface to do somethings when the thread is created and deleted. Then, we could put the registering function inside the listener interface. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2014) <!-- Reviewable:end -->
💔 Test failed - status-travis |
@bors-servo retry |
Register thread to WR's profiler and the external profiler. The gecko profiler needs the thread to register itself to gecko profiler before collecting the performance data. In this patch, we have a new "thread listener" interface to do somethings when the thread is created and deleted. Then, we could put the registering function inside the listener interface. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2014) <!-- Reviewable:end -->
☀️ Test successful - status-appveyor, status-travis |
Wow, I had not extensively used the Gecko CPU profiler before. It's really excellent - and with this addition we get perfect callstacks for profiling in the WR backend thread. @mrobinson @kvark heads up - next time you need to profile some CPU code in WR, you should try this out! :) Thanks @JerryShih and others who worked on the patch. |
The gecko profiler needs the thread to register itself to gecko profiler before collecting the performance data. In this patch, we have a new "thread listener" interface to do somethings when the thread is created and deleted. Then, we could put the registering function inside the listener interface.
This change is