<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>This sounds great to me!<br><br>-Filip</div><div><br>On Jan 4, 2017, at 20:28, Yusuke SUZUKI <<a href="mailto:utatane.tea@gmail.com">utatane.tea@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Hi WebKittens!<div><br></div><div>Recently, I started naming threads in Linux. And I also started naming threads created by WTF::AutomaticThread.</div><div>Previously, all the thread is not named in Linux. It makes difficult to find problematic threads when using GDB in Linux.</div><div>For example, if you run the JSC shell, all the threads are named as "jsc" (this is the name of the process).</div><div><br></div><div>The problem raised here is that we have no consistent policy for thread names.</div><div>I picked several names in WebKit.</div><div><br></div><div>In WebCore,</div><div> IDB server is "IndexedDatabase Server"</div><div> AsyncAudioDecoder is "Audio Decoder"</div><div> GCController is "WebCore: GCController"</div><div> Icon Database is "WebCore: IconDatabase"</div><div> Audio's ReverbConvolver is "convolution background thread"</div><div>The thread name used by WorkQueue in WebCore is,</div><div> Crypto Queue is "com.apple.WebKit.CryptoQueue"</div><div> Image decoder is "org.webkit.ImageDecoder"</div><div> Blob utility is "org.webkit.BlobUtility"</div><div> Data URL decoder is "org.webkit.DataURLDecoder"</div><div>In JSC</div><div> Before this patch, all the AutomaticThreads (including JIT worklist / DFG worklist) is "WTF::AutomaticThread"</div><div> Super Sampler thread is "JSC Super Sampler"</div><div> Asychronous Disasm is "Asynchronous Disassembler"</div><div> Sampling profiler is "jsc.sampling-profiler.thread"</div><div> WASM compiler thread is "jsc.wasm-b3-compilation.thread"</div><div>In WebKit2</div><div> Network Cache is "IOChannel::readSync"</div><div> IPC workqueue is "com.apple.IPC.ReceiveQueue"</div><div><br></div><div>To choose the appropriate naming policy, there are two requirements.</div><div>This is discussed in <a href="https://bugs.webkit.org/show_bug.cgi?id=166678">https://bugs.webkit.org/show_bug.cgi?id=166678</a> and <a href="https://bugs.webkit.org/show_bug.cgi?id=166684">https://bugs.webkit.org/show_bug.cgi?id=166684</a></div><div><br></div><div>1. We should have super descriptive name including the iformation "This thread is related to WebKit".</div><div>If we use WebKit as the framework, WebKit will launch several threads along with the user application's threads.</div><div>So if the thread name does not include the above information, it is quite confusing: Is this crash related to WebKit OR user's applications?</div><div>This should be met at least in macOS port. In the Linux port, this requirement is a bit difficult to be met due to the second requirement.</div><div><br></div><div>2. The thread name should be <= 15 characters in Linux. <= 31 characters in Windows.</div><div>This is super unfortunate. But we need this requirement. But in macOS, I think we do not have any limitation like that (correct?)</div><div>I cannot find "PTHREAD_MAX_NAMELEN_NP" definition in macOS.</div><div><br></div><div>To meet the above requirements as much as possible, I suggest the name, "<a href="http://org.webkit.MODULE.NAME">org.webkit.MODULE.NAME</a>(15characters)".</div><div>This policy is derived from the WorkQueue's naming policy, like "org.webkit.ImageDecoder".</div><div>For example, we will name DFG compiler worklist thread as "org.webkit.jsc.DFGCompiler" or "org.webkit.JavaScriptCore.DFGCompiler".</div><div><br></div><div>In Linux / Windows, we have the system to normalize the above name to "NAME(15characters)".</div><div>For example, when you specify "org.webkit.jsc.DFGCompiler", it will be shown as "DFGCompiler" in Linux.</div><div>This naming policy meets (1) in macOS. And (2) in all the environments. In macOS, the name is not modified.</div><div>So we can see the full name "org.webkit.jsc.DFGCompiler".</div><div>In Linux, we can see "DFGCompiler", it is quite useful compared to nameless threads.</div><div><br></div><div>What do you think of?</div><div><br></div><div>Best regards,</div><div>Yusuke Suzuki</div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>webkit-dev mailing list</span><br><span><a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a></span><br><span><a href="https://lists.webkit.org/mailman/listinfo/webkit-dev">https://lists.webkit.org/mailman/listinfo/webkit-dev</a></span><br></div></blockquote></body></html>