Changeset 59527 in vbox for trunk/src/VBox/Runtime/testcase
- Timestamp:
- Jan 31, 2016 11:54:20 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstRTInlineAsm.cpp
r57358 r59527 1596 1596 static int64_t volatile s_i64; 1597 1597 register unsigned i; 1598 const unsigned cRounds = _2M; 1598 const unsigned cRounds = _2M; /* Must be multiple of 8 */ 1599 1599 register uint64_t u64Elapsed; 1600 1600 … … 1616 1616 RTThreadYield(); \ 1617 1617 u64Elapsed = RTTimeNanoTS(); \ 1618 for (i = cRounds; i > 0; i--) \ 1618 for (i = cRounds / 8; i > 0; i--) \ 1619 { \ 1619 1620 op; \ 1621 op; \ 1622 op; \ 1623 op; \ 1624 op; \ 1625 op; \ 1626 op; \ 1627 op; \ 1628 } \ 1620 1629 u64Elapsed = RTTimeNanoTS() - u64Elapsed; \ 1621 1630 RTTestValue(g_hTest, str, u64Elapsed / cRounds, RTTESTUNIT_NS_PER_CALL); \ 1622 1631 } while (0) 1632 #endif 1633 #if (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)) && !defined(GCC44_32BIT_PIC) 1634 # define BENCH_TSC(op, str) \ 1635 do { \ 1636 RTThreadYield(); \ 1637 u64Elapsed = ASMReadTSC(); \ 1638 for (i = cRounds / 8; i > 0; i--) \ 1639 { \ 1640 op; \ 1641 op; \ 1642 op; \ 1643 op; \ 1644 op; \ 1645 op; \ 1646 op; \ 1647 op; \ 1648 } \ 1649 u64Elapsed = ASMReadTSC() - u64Elapsed; \ 1650 RTTestValue(g_hTest, str, u64Elapsed / cRounds, /*RTTESTUNIT_TICKS_PER_CALL*/ RTTESTUNIT_NONE); \ 1651 } while (0) 1652 #else 1653 # define BENCH_TSC(op, str) BENCH(op, str) 1623 1654 #endif 1624 1655 … … 1682 1713 BENCH(ASMAtomicUoAndU32(&s_u32, 0xffffffff), "ASMAtomicUoAndU32"); 1683 1714 BENCH(ASMAtomicUoOrU32(&s_u32, 0xffffffff), "ASMAtomicUoOrU32"); 1715 BENCH_TSC(ASMSerializeInstructionCpuId(), "ASMSerializeInstructionCpuId"); 1716 BENCH_TSC(ASMSerializeInstructionIRet(), "ASMSerializeInstructionIRet"); 1684 1717 1685 1718 /* The Darwin gcc does not like this ... */ … … 1688 1721 #endif 1689 1722 #if !defined(GCC44_32BIT_PIC) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)) 1690 BENCH(s_u64 = ASMReadTSC(), "ASMReadTSC");1691 1723 uint32_t uAux; 1692 1724 if ( ASMHasCpuId() 1693 1725 && ASMIsValidExtRange(ASMCpuId_EAX(0x80000000)) 1694 1726 && (ASMCpuId_EDX(0x80000001) & X86_CPUID_EXT_FEATURE_EDX_RDTSCP) ) 1727 { 1728 BENCH_TSC(ASMSerializeInstructionRdTscp(), "ASMSerializeInstructionRdTscp"); 1695 1729 BENCH(s_u64 = ASMReadTscWithAux(&uAux), "ASMReadTscWithAux"); 1730 } 1731 BENCH(s_u64 = ASMReadTSC(), "ASMReadTSC"); 1696 1732 union 1697 1733 {
Note:
See TracChangeset
for help on using the changeset viewer.