diff options
author | bors-servo <servo-ops@mozilla.com> | 2021-07-24 12:26:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-24 12:26:27 -0400 |
commit | 052278d0580ec1cbd2c9887e65d259dbf5efa775 (patch) | |
tree | 76ef821540e7aff86d028929f6e0897f2f3325eb /components/script | |
parent | d4f37d466e9a5f0325e5d4776948b34596652748 (diff) | |
parent | 41b372627161c8473222d0cd83e5d904ba8c1799 (diff) | |
download | servo-052278d0580ec1cbd2c9887e65d259dbf5efa775.tar.gz servo-052278d0580ec1cbd2c9887e65d259dbf5efa775.zip |
Auto merge of #28550 - yvt:feat-shorter-thread-names, r=jdm
Shorten thread names to prevent information loss
The Linux kernel [imposes][1] a 15-byte limit on thread names. This means information that does not fit in this limit, e.g., the pipeline ID of layout and script threads, is lost in a debugger and profiler (see the first column of the table below).
This commit shortens the thread names used in Servo to maximize the amount of information conveyed. It also rectifies some inconsistencies in the names.
| Before | After |
|-------------------|-------------------|
| `BluetoothThread` | `Bluetooth` |
| `CanvasThread` | `Canvas` |
| `display alert d` | `AlertDialog` |
| `FontCacheThread` | `FontCache` |
| `GLPlayerThread` | `GLPlayer` |
| `HTML Parser` | `Parse:www.examp` |
| `LayoutThread Pi` | `Layout(1,1)` |
| `Memory profiler` | `MemoryProfiler` |
| `Memory profiler` | `MemoryProfTimer` |
| `OfflineAudioCon` | `OfflineACResolv` |
| `PullTimelineMar` | `PullTimelineDat` |
| `ScriptThread Pi` | `Script(1,1)` |
| `WebWorker for h` | `WW:www.example.` |
| `ServiceWorker f` | `SW:www.example.` |
| `ServiceWorkerMa` | `SvcWorkerManage` |
| `Time profiler t` | `TimeProfTimer` |
| `Time profiler` | `TimeProfiler` |
| `WebGL thread` | `WebGL` |
| `Choose a device` | `DevicePicker` |
| `Pick a file` | `FilePicker` |
| `Pick files` | `FilePicker` |
[1]: https://stackoverflow.com/questions/5026531/thread-name-longer-than-15-chars
---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #28548
---
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they don't affect Servo's primary functionality in any way
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/dedicatedworkerglobalscope.rs | 3 | ||||
-rw-r--r-- | components/script/dom/offlineaudiocontext.rs | 2 | ||||
-rw-r--r-- | components/script/dom/serviceworkerglobalscope.rs | 2 | ||||
-rw-r--r-- | components/script/dom/servoparser/async_html.rs | 2 | ||||
-rw-r--r-- | components/script/script_thread.rs | 2 | ||||
-rw-r--r-- | components/script/serviceworker_manager.rs | 2 |
6 files changed, 6 insertions, 7 deletions
diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index a638ce85257..6d1792f87c2 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -328,7 +328,6 @@ impl DedicatedWorkerGlobalScope { context_sender: Sender<ContextForRequestInterrupt>, ) -> JoinHandle<()> { let serialized_worker_url = worker_url.to_string(); - let name = format!("WebWorker for {}", serialized_worker_url); let top_level_browsing_context_id = TopLevelBrowsingContextId::installed(); let current_global = GlobalScope::current().expect("No current global object"); let origin = current_global.origin().immutable().clone(); @@ -337,7 +336,7 @@ impl DedicatedWorkerGlobalScope { let current_global_https_state = current_global.get_https_state(); thread::Builder::new() - .name(name) + .name(format!("WW:{}", worker_url.debug_compact())) .spawn(move || { thread_state::initialize(ThreadState::SCRIPT | ThreadState::IN_WORKER); diff --git a/components/script/dom/offlineaudiocontext.rs b/components/script/dom/offlineaudiocontext.rs index bbdf9e1a79f..878bdedd314 100644 --- a/components/script/dom/offlineaudiocontext.rs +++ b/components/script/dom/offlineaudiocontext.rs @@ -153,7 +153,7 @@ impl OfflineAudioContextMethods for OfflineAudioContext { .task_manager() .dom_manipulation_task_source_with_canceller(); Builder::new() - .name("OfflineAudioContextResolver".to_owned()) + .name("OfflineACResolver".to_owned()) .spawn(move || { let _ = receiver.recv(); let _ = task_source.queue_with_canceller( diff --git a/components/script/dom/serviceworkerglobalscope.rs b/components/script/dom/serviceworkerglobalscope.rs index 911c635e38d..934b9b88b3a 100644 --- a/components/script/dom/serviceworkerglobalscope.rs +++ b/components/script/dom/serviceworkerglobalscope.rs @@ -302,7 +302,7 @@ impl ServiceWorkerGlobalScope { let serialized_worker_url = script_url.to_string(); let origin = scope_url.origin(); thread::Builder::new() - .name(format!("ServiceWorker for {}", serialized_worker_url)) + .name(format!("SW:{}", script_url.debug_compact())) .spawn(move || { thread_state::initialize(ThreadState::SCRIPT | ThreadState::IN_WORKER); let runtime = new_rt_and_cx(None); diff --git a/components/script/dom/servoparser/async_html.rs b/components/script/dom/servoparser/async_html.rs index 8b0a156842d..538007d9057 100644 --- a/components/script/dom/servoparser/async_html.rs +++ b/components/script/dom/servoparser/async_html.rs @@ -256,7 +256,7 @@ impl Tokenizer { // will be generated from the input provided. These parser actions are then passed // onto the main thread to be executed. thread::Builder::new() - .name(String::from("HTML Parser")) + .name(format!("Parse:{}", tokenizer.url.debug_compact())) .spawn(move || { run( sink, diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 1b28c337d56..8b3ba539809 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -773,7 +773,7 @@ impl ScriptThreadFactory for ScriptThread { let (sender, receiver) = unbounded(); let layout_chan = sender.clone(); thread::Builder::new() - .name(format!("ScriptThread {:?}", state.id)) + .name(format!("Script{}", state.id)) .spawn(move || { thread_state::initialize(ThreadState::SCRIPT); PipelineNamespace::install(state.pipeline_namespace_id); diff --git a/components/script/serviceworker_manager.rs b/components/script/serviceworker_manager.rs index 46cf22531c8..e3db04c4235 100644 --- a/components/script/serviceworker_manager.rs +++ b/components/script/serviceworker_manager.rs @@ -499,7 +499,7 @@ impl ServiceWorkerManagerFactory for ServiceWorkerManager { let resource_port = ROUTER.route_ipc_receiver_to_new_crossbeam_receiver(resource_port); let _ = resource_sender.send(CoreResourceMsg::NetworkMediator(resource_chan, origin)); if thread::Builder::new() - .name("ServiceWorkerManager".to_owned()) + .name("SvcWorkerManager".to_owned()) .spawn(move || { ServiceWorkerManager::new( own_sender, |