VirtualBox

Changeset 72426 in vbox for trunk/src


Ignore:
Timestamp:
Jun 4, 2018 11:38:23 AM (7 years ago)
Author:
vboxsync
Message:

IPRT,VMM: Added custom thread name for ring-0 logging (VMM).

Location:
trunk/src/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/log/log.cpp

    r69969 r72426  
    175175    char * volatile         pchRingBufCur;
    176176    /** @} */
     177
     178    /** Thread name for use in ring-0 with RTLOGFLAGS_PREFIX_THREAD. */
     179    char                    szR0ThreadName[16];
    177180
    178181# ifdef IN_RING3 /* Note! Must be at the end! */
     
    826829        pLogger->pInt->pfnPrefix                = NULL;
    827830        pLogger->pInt->pvPrefixUserArg          = NULL;
    828         pLogger->pInt->afPadding1[0]            = false;
    829         pLogger->pInt->afPadding1[1]            = false;
    830831        pLogger->pInt->fCreated                 = false;
     832        RT_ZERO(pLogger->pInt->szR0ThreadName);
    831833        pLogger->pInt->cMaxGroups               = cGroups;
    832834        pLogger->pInt->papszGroups              = papszGroups;
     
    12741276RTDECL(int) RTLogCreateForR0(PRTLOGGER pLogger, size_t cbLogger,
    12751277                             RTR0PTR pLoggerR0Ptr, RTR0PTR pfnLoggerR0Ptr, RTR0PTR pfnFlushR0Ptr,
    1276                              uint32_t fFlags, uint32_t fDestFlags)
     1278                             uint32_t fFlags, uint32_t fDestFlags, char const *pszThreadName)
    12771279{
    12781280    /*
     
    12841286    AssertReturn(pLoggerR0Ptr != NIL_RTR0PTR, VERR_INVALID_PARAMETER);
    12851287    AssertReturn(pfnLoggerR0Ptr != NIL_RTR0PTR, VERR_INVALID_PARAMETER);
     1288    size_t const cchThreadName = pszThreadName ? strlen(pszThreadName) : 0;
     1289    AssertReturn(cchThreadName < sizeof(pLogger->pInt->szR0ThreadName), VERR_INVALID_NAME);
    12861290
    12871291    /*
     
    13271331    else
    13281332        pInt->pacEntriesPerGroup= NULL;
     1333
     1334    RT_ZERO(pInt->szR0ThreadName);
     1335    if (cchThreadName)
     1336        memcpy(pInt->szR0ThreadName, pszThreadName, cchThreadName);
    13291337
    13301338    pInt->fCreated              = true;
     
    38153823                    const char *pszName = "EMT-RC";
    38163824#else
    3817                     const char *pszName = "R0";
     3825                    const char *pszName = pLogger->pInt->szR0ThreadName[0] ? pLogger->pInt->szR0ThreadName : "R0";
    38183826#endif
    38193827                    psz = rtLogStPNCpyPad(psz, pszName, 16, 8);
  • trunk/src/VBox/VMM/VMMR3/VMM.cpp

    r71222 r72426  
    10171017                AssertReleaseMsgRCReturn(rc, ("vmmR0LoggerFlush not found! rc=%Rra\n", rc), rc);
    10181018
     1019                char szR0ThreadName[16];
     1020                RTStrPrintf(szR0ThreadName, sizeof(szR0ThreadName), "EMT-%u-R0", i);
    10191021                rc = RTLogCreateForR0(&pR0LoggerR3->Logger, pR0LoggerR3->cbLogger,
    10201022                                      pVCpu->vmm.s.pR0LoggerR0 + RT_OFFSETOF(VMMR0LOGGER, Logger),
    10211023                                      pfnLoggerWrapper, pfnLoggerFlush,
    1022                                       RTLOGFLAGS_BUFFERED, RTLOGDEST_DUMMY);
     1024                                      RTLOGFLAGS_BUFFERED, RTLOGDEST_DUMMY, szR0ThreadName);
    10231025                AssertReleaseMsgRCReturn(rc, ("RTLogCreateForR0 failed! rc=%Rra\n", rc), rc);
    10241026
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette