cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * IPRT Testcase - RTThreadGetExecution.
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * Copyright (C) 2010 Oracle Corporation
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * available from http://www.virtualbox.org. This file is free software;
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * you can redistribute it and/or modify it under the terms of the GNU
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * General Public License (GPL) as published by the Free Software
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * The contents of this file may alternatively be used under the terms
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * of the Common Development and Distribution License Version 1.0
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * VirtualBox OSE distribution, in which case the provisions of the
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * CDDL are applicable instead of those of the GPL.
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * You may elect to license modified versions of this file under the
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync * terms and conditions of either the GPL or the CDDL or both.
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync/*******************************************************************************
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync* Header Files *
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync*******************************************************************************/
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync/*******************************************************************************
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync* Global Variables *
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync*******************************************************************************/
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsyncstatic DECLCALLBACK(int) testThread(RTTHREAD hSelf, void *pvUser)
50be00ffcd2f0cdb310af876a0ae4179c1b07ccbvboxsync RTThreadGetExecutionTimeMilli(&kernelStart, &userStart);
50be00ffcd2f0cdb310af876a0ae4179c1b07ccbvboxsync RTPrintf("kernel = %4lldms, user = %4lldms\n", kernel - kernelStart, user - userStart);
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync for (unsigned i = 0; i < RT_ELEMENTS(hThread); i++)
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync RTTESTI_CHECK_RC_RETV(RTThreadCreate(&hThread[i], testThread, NULL, 0, RTTHREADTYPE_DEFAULT,
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync for (unsigned i = 0; i < RT_ELEMENTS(hThread); i++)
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync RTTESTI_CHECK_RC(RTThreadWait(hThread[i], RT_INDEFINITE_WAIT, NULL), VINF_SUCCESS);
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync RTPrintf("sum kernel = %lldms, sum user = %lldms\n", g_kernel, g_user);
cfc61eb1cf1a2418102f57ccc29ae617d165e492vboxsync RTEXITCODE rcExit = RTTestInitAndCreate("tstRTThreadExecutionTime", &g_hTest);