Changeset 230474 in webkit


Ignore:
Timestamp:
Apr 10, 2018 12:58:19 AM (6 years ago)
Author:
Yusuke Suzuki
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:
Location:
trunk/Source/bmalloc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/bmalloc/ChangeLog

    r230463 r230474  
     12018-04-09  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [bmalloc] Name Scavenger thread "bmalloc scavenger"
     4        https://bugs.webkit.org/show_bug.cgi?id=166684
     5
     6        Reviewed by Saam Barati.
     7
     8        We name the thread for bmalloc Scavenger "bmalloc scavenger".
     9        It is useful for debugging. In Linux environment, it will be
     10        shown in GDB.
     11
     12        * bmalloc/Scavenger.cpp:
     13        (bmalloc::Scavenger::threadRunLoop):
     14        (bmalloc::Scavenger::setName):
     15        * bmalloc/Scavenger.h:
     16
    1172018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
    218
  • trunk/Source/bmalloc/bmalloc/Scavenger.cpp

    r230308 r230474  
    227227{
    228228    setSelfQOSClass();
     229    setThreadName("bmalloc scavenger");
    229230   
    230231    // This loop ratchets downward from most active to least active state. While
     
    271272}
    272273
     274void Scavenger::setThreadName(const char* name)
     275{
     276    BUNUSED(name);
     277#if BOS(DARWIN)
     278    pthread_setname_np(name);
     279#elif BOS(LINUX)
     280    // Truncate the given name since Linux limits the size of the thread name 16 including null terminator.
     281    std::array<char, 16> buf;
     282    strncpy(buf.data(), name, buf.size() - 1);
     283    buf[buf.size() - 1] = '\0';
     284    pthread_setname_np(pthread_self(), buf.data());
     285#endif
     286}
     287
    273288void Scavenger::setSelfQOSClass()
    274289{
  • trunk/Source/bmalloc/bmalloc/Scavenger.h

    r230308 r230474  
    8484   
    8585    void setSelfQOSClass();
     86    void setThreadName(const char*);
    8687
    8788    std::atomic<State> m_state { State::Sleep };
Note: See TracChangeset for help on using the changeset viewer.