tstTime-2.cpp revision 1e40f57c72c881067b0314f898e1004211bb7650
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth * innotek Portable Runtime Testcase - Simple RTTime test.
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth * Copyright (C) 2006-2007 innotek GmbH
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth * This file is part of VirtualBox Open Source Edition (OSE), as
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth * available from http://www.virtualbox.org. This file is free software;
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth * you can redistribute it and/or modify it under the terms of the GNU
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth * General Public License as published by the Free Software Foundation,
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth * distribution. VirtualBox OSE is distributed in the hope that it will
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth * be useful, but WITHOUT ANY WARRANTY of any kind.
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth/*******************************************************************************
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth* Header Files *
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth*******************************************************************************/
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth unsigned cErrors = 0;
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth * RTNanoTimeTS() shall never return something which
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth * is less or equal to the return of the previous call.
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth for (i = 0; i < NUMBER_OF_CALLS; i++)
9a70fc3be3b1e966bf78825cdb8d509963a6f0a1Mark J. Nelson int64_t i64Diff = u64OSElapsedTS >= u64RTElapsedTS ? u64OSElapsedTS - u64RTElapsedTS : u64RTElapsedTS - u64OSElapsedTS;
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth RTPrintf("tstTime-2: error: total time differs too much! u64OSElapsedTS=%#llx u64RTElapsedTS=%#llx delta=%lld\n",
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth u64OSElapsedTS, u64RTElapsedTS, u64OSElapsedTS - u64RTElapsedTS);
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth RTPrintf("tstTime-2: total time difference: u64OSElapsedTS=%#llx u64RTElapsedTS=%#llx delta=%lld\n",
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth u64OSElapsedTS, u64RTElapsedTS, u64OSElapsedTS - u64RTElapsedTS);
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth RTPrintf("tstTime-2: %u calls to RTTimeNanoTS\n", NUMBER_OF_CALLS);
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth RTPrintf("tstTime-2: RTTimeDbgSteps -> %u (%d ppt)\n", RTTimeDbgSteps(), ((uint64_t)RTTimeDbgSteps() * 1000) / NUMBER_OF_CALLS);
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth RTPrintf("tstTime-2: RTTimeDbgExpired -> %u (%d ppt)\n", RTTimeDbgExpired(), ((uint64_t)RTTimeDbgExpired() * 1000) / NUMBER_OF_CALLS);
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth RTPrintf("tstTime-2: RTTimeDbgBad -> %u (%d ppt)\n", RTTimeDbgBad(), ((uint64_t)RTTimeDbgBad() * 1000) / NUMBER_OF_CALLS);
1e1ddd6cc98ab5af8293f7ebd132be62900730fdcth RTPrintf("tstTime-2: RTTimeDbgRaces -> %u (%d ppt)\n", RTTimeDbgRaces(), ((uint64_t)RTTimeDbgRaces() * 1000) / NUMBER_OF_CALLS);