VirtualBox

Changeset 72778 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Jun 29, 2018 8:02:35 PM (6 years ago)
Author:
vboxsync
Message:

VMM,SUPDrv,IPRT: Redirect ring-0 release logging on EMTs to VBox.log.

  • VMM: Added release ring-0 logging on EMTs that writes to VBox.log.
  • IPRT: Made 'msprog' and 'timeprog' work for ring-0 logging on EMTs.
  • IPRT: Removed RTLogSetCustomPrefixCallbackForR0.
  • VMM: Removed vmmR0LoggerPrefix that was assoicated with the above API.
  • IPRT Fixed missing log prefix on the first log line.
  • SUPDrv: Turns out we require actual code for SUPR0GetDefaultLogRelInstanceEx and SUPR0GetDefaultLogInstanceEx.

Note! Requires updating the support driver.

File:
1 edited

Legend:

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

    r72426 r72778  
    6060# include <iprt/alloca.h>
    6161# include <stdio.h>
     62# include "internal/time.h" /* For g_u64ProgramStartNanoTS. */
    6263#endif
    6364
     
    176177    /** @} */
    177178
     179    /** Program time base for ring-0 (copy of g_u64ProgramStartNanoTS). */
     180    uint64_t                nsR0ProgramStart;
    178181    /** Thread name for use in ring-0 with RTLOGFLAGS_PREFIX_THREAD. */
    179182    char                    szR0ThreadName[16];
     
    207210
    208211/** The revision of the internal logger structure. */
    209 # define RTLOGGERINTERNAL_REV    UINT32_C(10)
     212# define RTLOGGERINTERNAL_REV    UINT32_C(11)
    210213
    211214# ifdef IN_RING3
     
    829832        pLogger->pInt->pfnPrefix                = NULL;
    830833        pLogger->pInt->pvPrefixUserArg          = NULL;
     834        pLogger->pInt->fPendingPrefix           = true;
    831835        pLogger->pInt->fCreated                 = false;
     836        pLogger->pInt->nsR0ProgramStart         = 0;
    832837        RT_ZERO(pLogger->pInt->szR0ThreadName);
    833838        pLogger->pInt->cMaxGroups               = cGroups;
     
    13201325    pInt->pfnPrefix             = NULL;
    13211326    pInt->pvPrefixUserArg       = NULL;
    1322     pInt->fPendingPrefix        = false;
     1327    pInt->fPendingPrefix        = true;
    13231328    pInt->cMaxGroups            = cMaxGroups;
    13241329    pInt->papszGroups           = NULL;
     
    13311336    else
    13321337        pInt->pacEntriesPerGroup= NULL;
    1333 
     1338    pInt->nsR0ProgramStart      = g_u64ProgramStartNanoTS;
    13341339    RT_ZERO(pInt->szR0ThreadName);
    13351340    if (cchThreadName)
     
    14011406RT_EXPORT_SYMBOL(RTLogCopyGroupsAndFlagsForR0);
    14021407
    1403 
    1404 RTDECL(int) RTLogSetCustomPrefixCallbackForR0(PRTLOGGER pLogger, RTR0PTR pLoggerR0Ptr,
    1405                                               RTR0PTR pfnCallbackR0Ptr, RTR0PTR pvUserR0Ptr)
    1406 {
    1407     AssertPtrReturn(pLogger, VERR_INVALID_POINTER);
    1408     AssertReturn(pLogger->u32Magic == RTLOGGER_MAGIC, VERR_INVALID_MAGIC);
    1409 
    1410     /*
    1411      * Do the work.
    1412      */
    1413     PRTLOGGERINTERNAL pInt = (PRTLOGGERINTERNAL)((uintptr_t)pLogger->pInt - pLoggerR0Ptr + (uintptr_t)pLogger);
    1414     AssertReturn(pInt->uRevision == RTLOGGERINTERNAL_REV, VERR_LOG_REVISION_MISMATCH);
    1415     pInt->pvPrefixUserArg = (void *)pvUserR0Ptr;
    1416     pInt->pfnPrefix       = (PFNRTLOGPREFIX)pfnCallbackR0Ptr;
    1417 
    1418     return VINF_SUCCESS;
    1419 }
    1420 RT_EXPORT_SYMBOL(RTLogSetCustomPrefixCallbackForR0);
    14211408
    14221409RTDECL(void) RTLogFlushR0(PRTLOGGER pLogger, PRTLOGGER pLoggerR0)
     
    37243711                    uint64_t u64 = RTTimeProgramMilliTS();
    37253712#else
    3726                     uint64_t u64 = 0;
     3713                    uint64_t u64 = (RTTimeNanoTS() - pLogger->pInt->nsR0ProgramStart) / 1000000;
    37273714#endif
    37283715                    /* 1E8 milliseconds = 27 hours */
     
    37583745#if defined(IN_RING3) || defined(IN_RC)
    37593746                    uint64_t u64 = RTTimeProgramMicroTS();
     3747#else
     3748                    uint64_t u64 = (RTTimeNanoTS() - pLogger->pInt->nsR0ProgramStart) / 1000;
     3749
     3750#endif
    37603751                    psz += RTStrFormatNumber(psz, (uint32_t)(u64 / RT_US_1HOUR), 10, 2, 0, RTSTR_F_ZEROPAD);
    37613752                    *psz++ = ':';
     
    37693760                    psz += RTStrFormatNumber(psz, u32 % RT_US_1SEC, 10, 6, 0, RTSTR_F_ZEROPAD);
    37703761                    *psz++ = ' ';
    3771 #else
    3772                     memset(psz, ' ', 16);
    3773                     psz += 16;
    3774 #endif
    37753762                }
    37763763#define CCH_PREFIX_05   CCH_PREFIX_04 + (9+1+2+1+2+1+6+1)
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