VirtualBox

Changeset 54253 in vbox


Ignore:
Timestamp:
Feb 17, 2015 7:44:15 PM (10 years ago)
Author:
vboxsync
Message:

tstRTInlineAsm.cpp: Benchmark ASMReadTSC, ASMReadTscWithAux and ASMGetIDTR.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstRTInlineAsm.cpp

    r52454 r54253  
    4242#if !defined(GCC44_32BIT_PIC) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
    4343# include <iprt/asm-amd64-x86.h>
     44# include <iprt/x86.h>
    4445#else
    4546# include <iprt/time.h>
     
    16851686    BENCH(s_u8 = ASMGetApicId(),                "ASMGetApicId");
    16861687#endif
     1688#if !defined(GCC44_32BIT_PIC) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
     1689    BENCH(s_u64 = ASMReadTSC(),                 "ASMReadTSC");
     1690    uint32_t uAux;
     1691    if (   ASMHasCpuId()
     1692        && ASMIsValidExtRange(ASMCpuId_EAX(0x80000000))
     1693        && (ASMCpuId_EDX(0x80000001) & X86_CPUID_EXT_FEATURE_EDX_RDTSCP) )
     1694        BENCH(s_u64 = ASMReadTscWithAux(&uAux),  "ASMReadTscWithAux");
     1695    union
     1696    {
     1697        uint64_t    u64[2];
     1698        RTIDTR      Unaligned;
     1699        struct
     1700        {
     1701            uint16_t abPadding[3];
     1702            RTIDTR   Aligned;
     1703        } s;
     1704    } uBuf;
     1705    Assert(((uintptr_t)&uBuf.Unaligned.pIdt & (sizeof(uintptr_t) - 1)) != 0);
     1706    BENCH(ASMGetIDTR(&uBuf.Unaligned),            "ASMGetIDTR/unaligned");
     1707    Assert(((uintptr_t)&uBuf.s.Aligned.pIdt & (sizeof(uintptr_t) - 1)) == 0);
     1708    BENCH(ASMGetIDTR(&uBuf.s.Aligned),            "ASMGetIDTR/aligned");
     1709#endif
    16871710
    16881711#undef BENCH
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