VirtualBox

Changeset 5456 in vbox for trunk/src


Ignore:
Timestamp:
Oct 24, 2007 1:04:51 AM (17 years ago)
Author:
vboxsync
Message:

New RTTimeNanoTS/GIP code.

Location:
trunk/src/VBox/Runtime
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/Makefile.kmk

    r5428 r5456  
    189189        common/time/time.cpp \
    190190        common/time/timeprog.cpp \
     191        common/time/timesup.cpp \
    191192        generic/critsect-generic.cpp \
    192193        generic/env-generic.cpp \
     
    206207        r3/process.cpp \
    207208        r3/stream.cpp \
    208         r3/tcp.cpp \
     209        r3/tcp.cpp
     210
     211#if1of ($(BUILD_TARGET_ARCH),amd64 x86)
     212# RuntimeR3_SOURCES += common/time/timesupA.asm
     213#else
     214 RuntimeR3_SOURCES += common/time/timesupref.cpp
     215#endif
    209216
    210217ifdef IPRT_WITH_KLDR
     
    235242
    236243RuntimeR3_SOURCES.win = \
    237         common/time/timesup.cpp \
    238244        generic/rand-stubs-generic.cpp \
    239245        generic/RTDirQueryInfo-generic.cpp \
     
    267273
    268274RuntimeR3_SOURCES.linux = \
    269         common/time/timesup.cpp \
    270275        generic/pathhost-generic.cpp \
    271276        generic/RTDirQueryInfo-generic.cpp \
     
    302307
    303308RuntimeR3_SOURCES.os2   = \
    304         common/time/timesup.cpp \
    305309        generic/pathhost-generic.cpp \
    306310        generic/rand-stubs-generic.cpp \
     
    336340
    337341RuntimeR3_SOURCES.darwin = \
    338         common/time/timesup.cpp \
    339342        darwin/RTErrConvertFromDarwinCOM.cpp \
    340343        darwin/RTErrConvertFromDarwinIO.cpp \
     
    370373## @todo Make BSD sched.
    371374RuntimeR3_SOURCES.freebsd = \
    372         common/time/timesup.cpp \
    373375        generic/pathhost-generic.cpp \
    374376        generic/RTDirQueryInfo-generic.cpp \
     
    401403
    402404RuntimeR3_SOURCES.solaris = \
    403         common/time/timesup.cpp \
    404405        generic/pathhost-generic.cpp \
    405406        generic/RTDirQueryInfo-generic.cpp \
     
    446447
    447448RuntimeR3L4_SOURCES = \
    448         common/time/timesup.cpp \
    449449        generic/fs-stubs-generic.cpp \
    450450        generic/pathhost-generic.cpp \
     
    680680        VBox/strformat-vbox.cpp
    681681
     682if1of ($(BUILD_TARGET_ARCH),amd64 x86)
     683 RuntimeR0_SOURCES += common/time/timesupA.asm
     684else
     685 RuntimeR0_SOURCES += common/time/timesupref.cpp
     686endif
     687
    682688RuntimeR0_SOURCES.win.amd64 = $(RuntimeWin64ASM_SOURCES)
    683689
     
    10041010        VBox/strformat-vbox.cpp \
    10051011
     1012if1of ($(BUILD_TARGET_ARCH),amd64 x86)
     1013 RuntimeGC_SOURCES += common/time/timesupA.asm
     1014else
     1015 RuntimeGC_SOURCES += common/time/timesupref.cpp
     1016endif
     1017
    10061018ifeq ($(VBOX_LDR_FMT32),lx)
    1007 RuntimeGC_SOURCES += os2/sys0.asm
     1019 RuntimeGC_SOURCES += os2/sys0.asm
    10081020endif
    10091021
  • trunk/src/VBox/Runtime/common/time/timesup.cpp

    r5408 r5456  
    2525#include <iprt/assert.h>
    2626#include <iprt/err.h>
    27 #include <VBox/sup.h>
     27#include <iprt/log.h>
     28#ifndef IN_GUEST
     29# include <VBox/sup.h>
     30# include <VBox/x86.h>
     31#endif
    2832#include "internal/time.h"
     33
     34
     35/*******************************************************************************
     36*   Internal Functions                                                         *
     37*******************************************************************************/
     38#ifndef IN_GUEST
     39static DECLCALLBACK(void)     rtTimeNanoTSInternalBitch(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev, uint64_t u64PrevNanoTS);
     40static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalFallback(PRTTIMENANOTSDATA pData);
     41static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalRediscover(PRTTIMENANOTSDATA pData);
     42#endif
    2943
    3044
     
    3347*******************************************************************************/
    3448#ifndef IN_GUEST
    35 /** The previously returned nano TS.
    36  * This handles TSC drift on SMP systems and expired interval.
    37  * This is a valid range u64NanoTS to u64NanoTS + 1000000000 (ie. 1sec).
    38  */
    39 static uint64_t volatile    s_u64PrevNanoTS = 0;
    40 /**
    41  * Number of times we've had to resort to 1ns walking. */
    42 static uint32_t volatile    g_c1nsSteps = 0;
    43 #endif
    44 
    45 
    46 /**
    47  * Calculate NanoTS using the information in the global information page (GIP)
    48  * which the support library (SUPLib) exports.
    49  *
    50  * This function guarantees that the returned timestamp is later (in time) than
    51  * any previous calls in the same thread.
    52  *
    53  * @returns Nanosecond timestamp.
    54  *
    55  * @remark  The way the ever increasing time guarantee is currently implemented means
    56  *          that if you call this function at a freqency higher than 1GHz you're in for
    57  *          trouble. We currently assume that no idiot will do that for real life purposes.
    58  */
    59 DECLINLINE(uint64_t) rtTimeNanoTSInternal(void)
    60 {
    61 #ifndef IN_GUEST
    62     uint64_t    u64Delta;
    63     uint32_t    u32NanoTSFactor0;
    64     uint64_t    u64TSC;
    65     uint64_t    u64NanoTS;
    66     uint32_t    u32UpdateIntervalTSC;
    67     uint32_t    u32TransactionId;
    68     PSUPGLOBALINFOPAGE pGip;
    69 
    70     /*
    71      * Read the data.
    72      */
    73     for (;;)
     49/** The RTTimeNanoTS data structure that's passed down to the worker functions.  */
     50static RTTIMENANOTSDATA g_TimeNanoTSData =
     51{
     52    /* .u64Prev       = */ 0,
     53    /* .c1nsSteps     = */ 0,
     54    /* .cExpired      = */ 0,
     55    /* .cBadPrev      = */ 0,
     56    /* .cUpdateRaces  = */ 0,
     57    /* .pfnBad        = */ rtTimeNanoTSInternalBitch,
     58    /* .pfnRediscover = */ rtTimeNanoTSInternalRediscover
     59};
     60
     61/** The index into g_apfnWorkers for the function to use.
     62 * This cannot be a pointer because that'll break down in GC due to code relocation. */
     63static uint32_t             g_iWorker = 0;
     64/** Array of rtTimeNanoTSInternal worker functions.
     65 * This array is indexed by g_iWorker. */
     66static const PFNTIMENANOTSINTERNAL g_apfnWorkers[] =
     67{
     68#define RTTIMENANO_WORKER_DETECT        0
     69    rtTimeNanoTSInternalRediscover,
     70#define RTTIMENANO_WORKER_SYNC_CPUID    1
     71    RTTimeNanoTSLegacySync,
     72#define RTTIMENANO_WORKER_ASYNC_CPUID   2
     73    RTTimeNanoTSLegacyAsync,
     74#define RTTIMENANO_WORKER_SYNC_LFENCE   3
     75    RTTimeNanoTSLFenceSync,
     76#define RTTIMENANO_WORKER_ASYNC_LFENCE  4
     77    RTTimeNanoTSLFenceAsync,
     78#define RTTIMENANO_WORKER_FALLBACK      5
     79    rtTimeNanoTSInternalFallback,
     80};
     81
     82
     83/**
     84 * Helper function that's used by the assembly routines when something goes bust.
     85 *
     86 * @param   pData           Pointer to the data structure.
     87 * @param   u64NanoTS       The calculated nano ts.
     88 * @param   u64DeltaPrev    The delta relative to the previously returned timestamp.
     89 * @param   u64PrevNanoTS   The previously returned timestamp (as it was read it).
     90 */
     91static DECLCALLBACK(void) rtTimeNanoTSInternalBitch(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev, uint64_t u64PrevNanoTS)
     92{
     93    pData->cBadPrev++;
     94    if ((int64_t)u64DeltaPrev < 0)
     95        LogRel(("TM: u64DeltaPrev=%RI64 u64PrevNanoTS=0x%016RX64 u64NanoTS=0x%016RX64\n",
     96                u64DeltaPrev, u64PrevNanoTS, u64NanoTS));
     97    else
     98        Log(("TM: u64DeltaPrev=%RI64 u64PrevNanoTS=0x%016RX64 u64NanoTS=0x%016RX64 (debugging?)\n",
     99             u64DeltaPrev, u64PrevNanoTS, u64NanoTS));
     100}
     101
     102/**
     103 * Fallback function.
     104 */
     105static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalFallback(PRTTIMENANOTSDATA pData)
     106{
     107    PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
     108    if (    pGip
     109        &&  pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC
     110        &&  (   pGip->u32Mode == SUPGIPMODE_SYNC_TSC
     111             || pGip->u32Mode == SUPGIPMODE_ASYNC_TSC))
     112        return rtTimeNanoTSInternalRediscover(pData);
     113    NOREF(pData);
     114    return RTTimeSystemNanoTS();
     115}
     116
     117
     118/**
     119 * Called the first time somebody asks for the time or when the GIP
     120 * is mapped/unmapped.
     121 */
     122static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalRediscover(PRTTIMENANOTSDATA pData)
     123{
     124    uint32_t iWorker;
     125    PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
     126    if (    pGip
     127        &&  pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC
     128        &&  (   pGip->u32Mode == SUPGIPMODE_SYNC_TSC
     129             || pGip->u32Mode == SUPGIPMODE_ASYNC_TSC))
    74130    {
    75         pGip = g_pSUPGlobalInfoPage;
    76 #ifdef IN_RING3
    77         if (!pGip || pGip->u32Magic != SUPGLOBALINFOPAGE_MAGIC)
    78             return RTTimeSystemNanoTS();
    79 #endif
    80 
    81         if (pGip->u32Mode != SUPGIPMODE_ASYNC_TSC)
    82         {
    83             u32TransactionId = pGip->aCPUs[0].u32TransactionId;
    84 #ifdef RT_OS_L4
    85             Assert((u32TransactionId & 1) == 0);
    86 #endif
    87             u32UpdateIntervalTSC = pGip->aCPUs[0].u32UpdateIntervalTSC;
    88             u64NanoTS = pGip->aCPUs[0].u64NanoTS;
    89             u64TSC = pGip->aCPUs[0].u64TSC;
    90             u32NanoTSFactor0 = pGip->u32UpdateIntervalNS;
    91             u64Delta = ASMReadTSC();
    92             if (RT_UNLIKELY(    pGip->aCPUs[0].u32TransactionId != u32TransactionId
    93                             ||  (u32TransactionId & 1)))
    94                 continue;
    95         }
     131        if (ASMCpuId_EDX(1) & X86_CPUID_FEATURE_EDX_SSE2)
     132            iWorker = pGip->u32Mode == SUPGIPMODE_SYNC_TSC
     133                    ? RTTIMENANO_WORKER_SYNC_LFENCE
     134                    : RTTIMENANO_WORKER_ASYNC_LFENCE;
    96135        else
    97         {
    98             /* SUPGIPMODE_ASYNC_TSC */
    99             PSUPGIPCPU pGipCpu;
    100 
    101             uint8_t u8ApicId = ASMGetApicId();
    102             if (RT_LIKELY(u8ApicId < RT_ELEMENTS(pGip->aCPUs)))
    103                 pGipCpu = &pGip->aCPUs[u8ApicId];
    104             else
    105             {
    106                 AssertMsgFailed(("%x\n", u8ApicId));
    107                 pGipCpu = &pGip->aCPUs[0];
    108             }
    109 
    110             u32TransactionId = pGipCpu->u32TransactionId;
    111 #ifdef RT_OS_L4
    112             Assert((u32TransactionId & 1) == 0);
    113 #endif
    114             u32UpdateIntervalTSC = pGipCpu->u32UpdateIntervalTSC;
    115             u64NanoTS = pGipCpu->u64NanoTS;
    116             u64TSC = pGipCpu->u64TSC;
    117             u32NanoTSFactor0 = pGip->u32UpdateIntervalNS;
    118             u64Delta = ASMReadTSC();
    119             if (RT_UNLIKELY(u8ApicId != ASMGetApicId()))
    120                 continue;
    121             if (RT_UNLIKELY(    pGipCpu->u32TransactionId != u32TransactionId
    122                             ||  (u32TransactionId & 1)))
    123                 continue;
    124         }
    125         break;
    126     }
    127 
    128     /*
    129      * Calc NanoTS delta.
    130      */
    131     u64Delta -= u64TSC;
    132     if (u64Delta > u32UpdateIntervalTSC)
    133     {
    134         /*
    135          * We've expired the interval. Do 1ns per call until we've
    136          * got valid TSC deltas again (s_u64PrevNanoTS takes care of this).
    137          */
    138         u64Delta = u32UpdateIntervalTSC;
    139     }
    140 #if !defined(_MSC_VER) || defined(RT_ARCH_AMD64) /* GCC makes very pretty code from these two inline calls, while MSC cannot. */
    141     u64Delta = ASMMult2xU32RetU64((uint32_t)u64Delta, u32NanoTSFactor0);
    142     u64Delta = ASMDivU64ByU32RetU32(u64Delta, u32UpdateIntervalTSC);
    143 #else
    144     __asm
    145     {
    146         mov     eax, dword ptr [u64Delta]
    147         mul     dword ptr [u32NanoTSFactor0]
    148         div     dword ptr [u32UpdateIntervalTSC]
    149         mov     dword ptr [u64Delta], eax
    150         xor     edx, edx
    151         mov     dword ptr [u64Delta + 4], edx
    152     }
    153 #endif
    154 
    155     /*
    156      * The most frequent case is that the delta is either too old
    157      * or that our timestamp is higher (relative to u64NanoTS) than it.
    158      */
    159     uint64_t u64;
    160     uint64_t u64PrevNanoTS = ASMAtomicReadU64(&s_u64PrevNanoTS);
    161     uint64_t u64DeltaPrev = u64PrevNanoTS - u64NanoTS;
    162     if (    u64DeltaPrev > 1000000000                       /* (invalid prev) */
    163         ||  (uint32_t)u64DeltaPrev < (uint32_t)u64Delta)    /* (we're later) */
    164     {
    165         u64 = u64Delta + u64NanoTS;
    166         if (ASMAtomicCmpXchgU64(&s_u64PrevNanoTS, u64, u64PrevNanoTS))
    167             return u64;
     136            iWorker = pGip->u32Mode == SUPGIPMODE_SYNC_TSC
     137                    ? RTTIMENANO_WORKER_SYNC_CPUID
     138                    : RTTIMENANO_WORKER_ASYNC_CPUID;
    168139    }
    169140    else
    170     {
    171         /*
    172          * Our timestamp is lower than the last returned timestamp;
    173          * advance 1ns beyond that.
    174          */
    175         u64Delta = u64DeltaPrev + 1;
    176         u64 = u64Delta + u64NanoTS;
    177         ASMAtomicIncU32(&g_c1nsSteps);
    178     }
    179 
    180     /*
    181      * Attempt updating the previous value.
    182      *      u64 == timestamp, u64Delta == delta relative to u64NanoTS.
    183      */
    184     for (int cTries = 100;;)
    185     {
    186         u64PrevNanoTS = ASMAtomicReadU64(&s_u64PrevNanoTS);
    187         u64DeltaPrev = u64PrevNanoTS - u64NanoTS;
    188         if (u64DeltaPrev > u64Delta)
    189             break;
    190         if (ASMAtomicCmpXchgU64(&s_u64PrevNanoTS, u64, u64PrevNanoTS))
    191             break;
    192         if (--cTries <= 0)
    193         {
    194             AssertBreakpoint(); /* (recursion) */
    195             break;
    196         }
    197     }
    198 
    199     return u64;
    200 #else /* IN_GUEST */
     141        iWorker = RTTIMENANO_WORKER_FALLBACK;
     142
     143    ASMAtomicXchgU32((uint32_t volatile *)&g_iWorker, iWorker);
     144    return g_apfnWorkers[iWorker](pData);
     145}
     146
     147#endif /* !IN_GUEST */
     148
     149
     150/**
     151 * Internal worker for getting the current nanosecond timestamp.
     152 */
     153DECLINLINE(uint64_t) rtTimeNanoTSInternal(void)
     154{
     155#ifndef IN_GUEST
     156    return g_apfnWorkers[g_iWorker](&g_TimeNanoTSData);
     157#else
    201158    return RTTimeSystemNanoTS();
    202 #endif /* IN_GUEST */
     159#endif
    203160}
    204161
     
    230187 * Debugging the time api.
    231188 *
    232  * @returns the number of 1ns steps which has been applied by rtTimeNanoTSInternal().
    233  */
    234 RTDECL(uint32_t) RTTime1nsSteps(void)
    235 {
    236     return g_c1nsSteps;
    237 }
    238 #endif
     189 * @returns the number of 1ns steps which has been applied by RTTimeNanoTS().
     190 */
     191RTDECL(uint32_t) RTTimeDbgSteps(void)
     192{
     193    return g_TimeNanoTSData.c1nsSteps;
     194}
     195
     196
     197/**
     198 * Debugging the time api.
     199 *
     200 * @returns the number of times the TSC interval expired RTTimeNanoTS().
     201 */
     202RTDECL(uint32_t) RTTimeDbgExpired(void)
     203{
     204    return g_TimeNanoTSData.cExpired;
     205}
     206
     207
     208/**
     209 * Debugging the time api.
     210 *
     211 * @returns the number of bad previous values encountered by RTTimeNanoTS().
     212 */
     213RTDECL(uint32_t) RTTimeDbgBad(void)
     214{
     215    return g_TimeNanoTSData.cBadPrev;
     216}
     217
     218
     219/**
     220 * Debugging the time api.
     221 *
     222 * @returns the number of update races in RTTimeNanoTS().
     223 */
     224RTDECL(uint32_t) RTTimeDbgRaces(void)
     225{
     226    return g_TimeNanoTSData.cUpdateRaces;
     227}
     228#endif
  • trunk/src/VBox/Runtime/testcase/tstTime-2.cpp

    r4071 r5456  
    1919*   Header Files                                                               *
    2020*******************************************************************************/
    21 #ifdef RT_OS_WINDOWS
    22 # include <Windows.h>
    23 
    24 #elif defined RT_OS_L4
    25 
    26 #else /* posix */
    27 # include <sys/time.h>
    28 #endif
    29 
    3021#include <iprt/time.h>
    3122#include <iprt/stream.h>
     
    3324#include <iprt/thread.h>
    3425#include <VBox/sup.h>
    35 
    36 DECLINLINE(uint64_t) OSNanoTS(void)
    37 {
    38 #ifdef RT_OS_WINDOWS
    39     uint64_t u64; /* manual say larger integer, should be safe to assume it's the same. */
    40     GetSystemTimeAsFileTime((LPFILETIME)&u64);
    41     return u64 * 100;
    42 
    43 #elif defined RT_OS_L4
    44     /** @todo fix a different timesource on l4. */
    45     return RTTimeNanoTS();
    46 
    47 #else /* posix */
    48 
    49     struct timeval tv;
    50     gettimeofday(&tv, NULL);
    51     return (uint64_t)tv.tv_sec  * (uint64_t)(1000 * 1000 * 1000)
    52          + (uint64_t)(tv.tv_usec * 1000);
    53 #endif
    54 }
    5526
    5627
     
    6132    int i;
    6233    RTR3Init();
    63 SUPInit();
    6434    RTPrintf("tstTime-2: TESTING...\n");
    6535
     
    6939     */
    7040
    71     OSNanoTS(); RTTimeNanoTS(); RTThreadYield();
     41    RTTimeSystemNanoTS(); RTTimeNanoTS(); RTThreadYield();
    7242    uint64_t u64RTStartTS = RTTimeNanoTS();
    73     uint64_t u64OSStartTS = OSNanoTS();
     43    uint64_t u64OSStartTS = RTTimeSystemNanoTS();
    7444#define NUMBER_OF_CALLS (100*_1M)
    7545
     
    7848
    7949    uint64_t u64RTElapsedTS = RTTimeNanoTS();
    80     uint64_t u64OSElapsedTS = OSNanoTS();
     50    uint64_t u64OSElapsedTS = RTTimeSystemNanoTS();
    8151    u64RTElapsedTS -= u64RTStartTS;
    8252    u64OSElapsedTS -= u64OSStartTS;
     
    9262                 u64OSElapsedTS, u64RTElapsedTS, u64OSElapsedTS - u64RTElapsedTS);
    9363
    94 #if defined RT_OS_WINDOWS || defined RT_OS_LINUX
    95     RTPrintf("tstTime-2: RTTime1nsSteps -> %u out of %u calls\n", RTTime1nsSteps(), NUMBER_OF_CALLS);
    96 #endif
     64    RTPrintf("tstTime-2: %u calls to RTTimeNanoTS\n", NUMBER_OF_CALLS);
     65    RTPrintf("tstTime-2: RTTimeDbgSteps   -> %u (%d ppt)\n", RTTimeDbgSteps(),   ((uint64_t)RTTimeDbgSteps() * 1000) / NUMBER_OF_CALLS);
     66    RTPrintf("tstTime-2: RTTimeDbgExpired -> %u (%d ppt)\n", RTTimeDbgExpired(), ((uint64_t)RTTimeDbgExpired() * 1000) / NUMBER_OF_CALLS);
     67    RTPrintf("tstTime-2: RTTimeDbgBad     -> %u (%d ppt)\n", RTTimeDbgBad(),     ((uint64_t)RTTimeDbgBad() * 1000) / NUMBER_OF_CALLS);
     68    RTPrintf("tstTime-2: RTTimeDbgRaces   -> %u (%d ppt)\n", RTTimeDbgRaces(),   ((uint64_t)RTTimeDbgRaces() * 1000) / NUMBER_OF_CALLS);
     69
    9770    if (!cErrors)
    9871        RTPrintf("tstTime-2: SUCCESS\n");
  • trunk/src/VBox/Runtime/testcase/tstTime.cpp

    r4071 r5456  
    1919*   Header Files                                                               *
    2020*******************************************************************************/
    21 #ifdef RT_OS_WINDOWS
    22 # include <Windows.h>
    23 
    24 #elif defined RT_OS_L4
    25 
    26 #else /* posix */
    27 # include <sys/time.h>
    28 #endif
    29 
    3021#include <iprt/time.h>
    3122#include <iprt/stream.h>
    32 #include <iprt/runtime.h>
     23#include <iprt/initterm.h>
    3324#include <iprt/thread.h>
    3425#include <VBox/sup.h>
    35 
    36 DECLINLINE(uint64_t) OSNanoTS(void)
    37 {
    38 #ifdef RT_OS_WINDOWS
    39     uint64_t u64; /* manual say larger integer, should be safe to assume it's the same. */
    40     GetSystemTimeAsFileTime((LPFILETIME)&u64);
    41     return u64 * 100;
    42 
    43 #elif defined RT_OS_L4
    44     /** @todo fix a different timesource on l4. */
    45     return RTTimeNanoTS();
    46 
    47 #else /* posix */
    48 
    49     struct timeval tv;
    50     gettimeofday(&tv, NULL);
    51     return (uint64_t)tv.tv_sec  * (uint64_t)(1000 * 1000 * 1000)
    52          + (uint64_t)(tv.tv_usec * 1000);
    53 #endif
    54 }
    55 
    5626
    5727
     
    6131    int i;
    6232    RTR3Init();
    63 SUPInit();
    6433    RTPrintf("tstTime: TESTING...\n");
    6534
     
    6938     */
    7039
    71     OSNanoTS(); RTTimeNanoTS(); RTThreadYield();
     40    RTTimeSystemNanoTS(); RTTimeNanoTS(); RTThreadYield();
    7241    uint64_t u64RTStartTS = RTTimeNanoTS();
    73     uint64_t u64OSStartTS = OSNanoTS();
     42    uint64_t u64OSStartTS = RTTimeSystemNanoTS();
    7443
    7544    uint64_t u64Prev = RTTimeNanoTS();
     
    10170    }
    10271
    103     OSNanoTS(); RTTimeNanoTS(); RTThreadYield();
     72    RTTimeSystemNanoTS(); RTTimeNanoTS(); RTThreadYield();
    10473    uint64_t u64RTElapsedTS = RTTimeNanoTS();
    105     uint64_t u64OSElapsedTS = OSNanoTS();
     74    uint64_t u64OSElapsedTS = RTTimeSystemNanoTS();
    10675    u64RTElapsedTS -= u64RTStartTS;
    10776    u64OSElapsedTS -= u64OSStartTS;
     
    11786                 u64OSElapsedTS, u64RTElapsedTS, u64OSElapsedTS - u64RTElapsedTS);
    11887
    119     RTPrintf("RTTime1nsSteps -> %u (%d ppt)\n", RTTime1nsSteps(), (RTTime1nsSteps() * 1000) / i);
     88    RTPrintf("RTTimeDbgSteps   -> %u (%d ppt)\n", RTTimeDbgSteps(),   ((uint64_t)RTTimeDbgSteps() * 1000) / i);
     89    RTPrintf("RTTimeDbgExpired -> %u (%d ppt)\n", RTTimeDbgExpired(), ((uint64_t)RTTimeDbgExpired() * 1000) / i);
     90    RTPrintf("RTTimeDbgBad     -> %u (%d ppt)\n", RTTimeDbgBad(),     ((uint64_t)RTTimeDbgBad() * 1000) / i);
     91    RTPrintf("RTTimeDbgRaces   -> %u (%d ppt)\n", RTTimeDbgRaces(),   ((uint64_t)RTTimeDbgRaces() * 1000) / i);
    12092    if (!cErrors)
    12193        RTPrintf("tstTime: SUCCESS\n");
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