Changeset 72778 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Jun 29, 2018 8:02:35 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/log/log.cpp
r72426 r72778 60 60 # include <iprt/alloca.h> 61 61 # include <stdio.h> 62 # include "internal/time.h" /* For g_u64ProgramStartNanoTS. */ 62 63 #endif 63 64 … … 176 177 /** @} */ 177 178 179 /** Program time base for ring-0 (copy of g_u64ProgramStartNanoTS). */ 180 uint64_t nsR0ProgramStart; 178 181 /** Thread name for use in ring-0 with RTLOGFLAGS_PREFIX_THREAD. */ 179 182 char szR0ThreadName[16]; … … 207 210 208 211 /** The revision of the internal logger structure. */ 209 # define RTLOGGERINTERNAL_REV UINT32_C(1 0)212 # define RTLOGGERINTERNAL_REV UINT32_C(11) 210 213 211 214 # ifdef IN_RING3 … … 829 832 pLogger->pInt->pfnPrefix = NULL; 830 833 pLogger->pInt->pvPrefixUserArg = NULL; 834 pLogger->pInt->fPendingPrefix = true; 831 835 pLogger->pInt->fCreated = false; 836 pLogger->pInt->nsR0ProgramStart = 0; 832 837 RT_ZERO(pLogger->pInt->szR0ThreadName); 833 838 pLogger->pInt->cMaxGroups = cGroups; … … 1320 1325 pInt->pfnPrefix = NULL; 1321 1326 pInt->pvPrefixUserArg = NULL; 1322 pInt->fPendingPrefix = false;1327 pInt->fPendingPrefix = true; 1323 1328 pInt->cMaxGroups = cMaxGroups; 1324 1329 pInt->papszGroups = NULL; … … 1331 1336 else 1332 1337 pInt->pacEntriesPerGroup= NULL; 1333 1338 pInt->nsR0ProgramStart = g_u64ProgramStartNanoTS; 1334 1339 RT_ZERO(pInt->szR0ThreadName); 1335 1340 if (cchThreadName) … … 1401 1406 RT_EXPORT_SYMBOL(RTLogCopyGroupsAndFlagsForR0); 1402 1407 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);1421 1408 1422 1409 RTDECL(void) RTLogFlushR0(PRTLOGGER pLogger, PRTLOGGER pLoggerR0) … … 3724 3711 uint64_t u64 = RTTimeProgramMilliTS(); 3725 3712 #else 3726 uint64_t u64 = 0;3713 uint64_t u64 = (RTTimeNanoTS() - pLogger->pInt->nsR0ProgramStart) / 1000000; 3727 3714 #endif 3728 3715 /* 1E8 milliseconds = 27 hours */ … … 3758 3745 #if defined(IN_RING3) || defined(IN_RC) 3759 3746 uint64_t u64 = RTTimeProgramMicroTS(); 3747 #else 3748 uint64_t u64 = (RTTimeNanoTS() - pLogger->pInt->nsR0ProgramStart) / 1000; 3749 3750 #endif 3760 3751 psz += RTStrFormatNumber(psz, (uint32_t)(u64 / RT_US_1HOUR), 10, 2, 0, RTSTR_F_ZEROPAD); 3761 3752 *psz++ = ':'; … … 3769 3760 psz += RTStrFormatNumber(psz, u32 % RT_US_1SEC, 10, 6, 0, RTSTR_F_ZEROPAD); 3770 3761 *psz++ = ' '; 3771 #else3772 memset(psz, ' ', 16);3773 psz += 16;3774 #endif3775 3762 } 3776 3763 #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.