Title: [230474] trunk/Source/bmalloc
- Revision
- 230474
- Author
- utatane....@gmail.com
- Date
- 2018-04-10 00:58:19 -0700 (Tue, 10 Apr 2018)
Log Message
[bmalloc] Name Scavenger thread "bmalloc scavenger"
https://bugs.webkit.org/show_bug.cgi?id=166684
Reviewed by Saam Barati.
We name the thread for bmalloc Scavenger "bmalloc scavenger".
It is useful for debugging. In Linux environment, it will be
shown in GDB.
* bmalloc/Scavenger.cpp:
(bmalloc::Scavenger::threadRunLoop):
(bmalloc::Scavenger::setName):
* bmalloc/Scavenger.h:
Modified Paths
Diff
Modified: trunk/Source/bmalloc/ChangeLog (230473 => 230474)
--- trunk/Source/bmalloc/ChangeLog 2018-04-10 06:30:54 UTC (rev 230473)
+++ trunk/Source/bmalloc/ChangeLog 2018-04-10 07:58:19 UTC (rev 230474)
@@ -1,3 +1,19 @@
+2018-04-09 Yusuke Suzuki <utatane....@gmail.com>
+
+ [bmalloc] Name Scavenger thread "bmalloc scavenger"
+ https://bugs.webkit.org/show_bug.cgi?id=166684
+
+ Reviewed by Saam Barati.
+
+ We name the thread for bmalloc Scavenger "bmalloc scavenger".
+ It is useful for debugging. In Linux environment, it will be
+ shown in GDB.
+
+ * bmalloc/Scavenger.cpp:
+ (bmalloc::Scavenger::threadRunLoop):
+ (bmalloc::Scavenger::setName):
+ * bmalloc/Scavenger.h:
+
2018-04-09 Michael Catanzaro <mcatanz...@igalia.com>
Rename UNUSED to BUNUSED
Modified: trunk/Source/bmalloc/bmalloc/Scavenger.cpp (230473 => 230474)
--- trunk/Source/bmalloc/bmalloc/Scavenger.cpp 2018-04-10 06:30:54 UTC (rev 230473)
+++ trunk/Source/bmalloc/bmalloc/Scavenger.cpp 2018-04-10 07:58:19 UTC (rev 230474)
@@ -226,6 +226,7 @@
void Scavenger::threadRunLoop()
{
setSelfQOSClass();
+ setThreadName("bmalloc scavenger");
// This loop ratchets downward from most active to least active state. While
// we ratchet downward, any other thread may reset our state.
@@ -270,6 +271,20 @@
}
}
+void Scavenger::setThreadName(const char* name)
+{
+ BUNUSED(name);
+#if BOS(DARWIN)
+ pthread_setname_np(name);
+#elif BOS(LINUX)
+ // Truncate the given name since Linux limits the size of the thread name 16 including null terminator.
+ std::array<char, 16> buf;
+ strncpy(buf.data(), name, buf.size() - 1);
+ buf[buf.size() - 1] = '\0';
+ pthread_setname_np(pthread_self(), buf.data());
+#endif
+}
+
void Scavenger::setSelfQOSClass()
{
#if BOS(DARWIN)
Modified: trunk/Source/bmalloc/bmalloc/Scavenger.h (230473 => 230474)
--- trunk/Source/bmalloc/bmalloc/Scavenger.h 2018-04-10 06:30:54 UTC (rev 230473)
+++ trunk/Source/bmalloc/bmalloc/Scavenger.h 2018-04-10 07:58:19 UTC (rev 230474)
@@ -83,6 +83,7 @@
void threadRunLoop();
void setSelfQOSClass();
+ void setThreadName(const char*);
std::atomic<State> m_state { State::Sleep };
size_t m_scavengerBytes { 0 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes