tstPrfRT.cpp revision 02d794817c8ae6fbfd95404d558748b70a70692c
/* $Id$ */
/** @file
* IPRT testcase - profile some of the important functions.
*/
/*
* Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <iprt/initterm.h>
#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
# include <iprt/asm-amd64-x86.h>
void PrintResult(uint64_t u64Ticks, uint64_t u64MaxTicks, uint64_t u64MinTicks, unsigned cTimes, const char *pszOperation)
{
RTPrintf("tstPrfRT: %-32s %5lld / %5lld / %5lld ticks per call (%u calls %lld ticks)\n",
}
{ \
{ preexpr } \
{ expr } \
{ postexpr } \
{ \
i--; \
continue; \
} \
if (u64ElapsedTS < u64MinTS) \
u64MinTS = u64ElapsedTS; \
if (u64ElapsedTS > u64MaxTS) \
u64MaxTS = u64ElapsedTS; \
u64TotalTS += u64ElapsedTS; \
}
#else /* !AMD64 && !X86 */
void PrintResult(uint64_t cNs, uint64_t cNsMax, uint64_t cNsMin, unsigned cTimes, const char *pszOperation)
{
RTPrintf("tstPrfRT: %-32s %5lld / %5lld / %5lld ns per call (%u calls %lld ns)\n",
}
{ \
{ preexpr } \
{ expr } \
{ postexpr } \
{ \
i--; \
continue; \
} \
if (u64ElapsedTS < u64MinTS) \
u64MinTS = u64ElapsedTS; \
if (u64ElapsedTS > u64MaxTS) \
u64MaxTS = u64ElapsedTS; \
u64TotalTS += u64ElapsedTS; \
}
#endif /* !AMD64 && !X86 */
{
unsigned i;
RTPrintf("tstPrfRT: TESTING...\n");
/*
* RTTimeNanoTS, RTTimeProgramNanoTS, RTTimeMilliTS, and RTTimeProgramMilliTS.
*/
/*
* RTTimeNow
*/
/*
* RTLogDefaultInstance()
*/
/*
* RTThreadSelf and RTThreadNativeSelf
*/
RTPrintf("tstPrtRT: DONE\n");
return 0;
}