Changeset 1206 in vbox
- Timestamp:
- Mar 5, 2007 12:58:31 AM (18 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile
r1205 r1206 314 314 generic/semnoint-generic.cpp \ 315 315 generic/sched-generic.cpp \ 316 r3/ posix/time-posix.cpp \316 r3/os2/time-os2.cpp \ 317 317 r3/posix/timer-posix.cpp \ 318 318 r3/posix/RTTimeNow-posix.cpp \ -
trunk/src/VBox/Runtime/r0drv/os2/assert-r0drv-os2.cpp
r1191 r1206 2 2 /** @file 3 3 * InnoTek Portable Runtime - Assertion Workers, Ring-0 Drivers, OS/2. 4 */ 5 6 /* 7 * Copyright (c) 2007 knut st. osmundsen <[email protected]> 8 * 9 * Permission is hereby granted, free of charge, to any person 10 * obtaining a copy of this software and associated documentation 11 * files (the "Software"), to deal in the Software without 12 * restriction, including without limitation the rights to use, 13 * copy, modify, merge, publish, distribute, sublicense, and/or sell 14 * copies of the Software, and to permit persons to whom the 15 * Software is furnished to do so, subject to the following 16 * conditions: 17 * 18 * The above copyright notice and this permission notice shall be 19 * included in all copies or substantial portions of the Software. 20 * 21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 * OTHER DEALINGS IN THE SOFTWARE. 4 29 */ 5 30 -
trunk/src/VBox/Runtime/r3/os2/time-os2.cpp
r1204 r1206 5 5 6 6 /* 7 * Copyright ( C) 2006 InnoTek Systemberatung GmbH7 * Copyright (c) 2007 knut st. osmundsen <[email protected]> 8 8 * 9 * This file is part of VirtualBox Open Source Edition (OSE), as 10 * available from http://www.virtualbox.org. This file is free software; 11 * you can redistribute it and/or modify it under the terms of the GNU 12 * General Public License as published by the Free Software Foundation, 13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE 14 * distribution. VirtualBox OSE is distributed in the hope that it will 15 * be useful, but WITHOUT ANY WARRANTY of any kind. 9 * Permission is hereby granted, free of charge, to any person 10 * obtaining a copy of this software and associated documentation 11 * files (the "Software"), to deal in the Software without 12 * restriction, including without limitation the rights to use, 13 * copy, modify, merge, publish, distribute, sublicense, and/or sell 14 * copies of the Software, and to permit persons to whom the 15 * Software is furnished to do so, subject to the following 16 * conditions: 16 17 * 17 * If you received this file as part of a commercial VirtualBox 18 * distribution, then only the terms of your commercial VirtualBox 19 * license agreement apply instead of the previous paragraph. 18 * The above copyright notice and this permission notice shall be 19 * included in all copies or substantial portions of the Software. 20 * 21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 * OTHER DEALINGS IN THE SOFTWARE. 20 29 */ 21 30 … … 25 34 *******************************************************************************/ 26 35 #define LOG_GROUP RTLOGGROUP_TIME 27 #define RTTIME_INCL_TIMEVAL 28 #include <sys/time.h> 29 #include <time.h> 36 #include <InnoTekLIBC/FastInfoBlocks.h> 30 37 31 38 #include <iprt/time.h> 32 39 #include "internal/time.h" 33 40 41 /** @todo mscount will roll over after ~48 days. */ 34 42 35 DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void)43 RTDECL(uint64_t) RTTimeSystemNanoTS(void) 36 44 { 37 #if defined(CLOCK_MONOTONIC) && !defined(__L4__) && !defined(__OS2__) 38 /* check monotonic clock first. */ 39 static bool s_fMonoClock = true; 40 if (s_fMonoClock) 41 { 42 struct timespec ts; 43 if (!clock_gettime(CLOCK_MONOTONIC, &ts)) 44 return (uint64_t)ts.tv_sec * (uint64_t)(1000 * 1000 * 1000) 45 + ts.tv_nsec; 46 s_fMonoClock = false; 47 } 48 #endif 49 50 /* fallback to gettimeofday(). */ 51 struct timeval tv; 52 gettimeofday(&tv, NULL); 53 return (uint64_t)tv.tv_sec * (uint64_t)(1000 * 1000 * 1000) 54 + (uint64_t)(tv.tv_usec * 1000); 45 return fibGetMsCount() * UINT64_C(10000000); 55 46 } 56 47 57 48 58 /** 59 * Gets the current nanosecond timestamp. 60 * 61 * This differs from RTTimeNanoTS in that it will use system APIs and not do any 62 * resolution or performance optimizations. 63 * 64 * @returns nanosecond timestamp. 65 */ 66 RTDECL(uint64_t) RTTimeSystemNanoTS(void) 49 RTDECL(uint64_t) RTTimeSystemMilliTS(void) 67 50 { 68 return rtTimeGetSystemNanoTS();51 return fibGetMsCount(); 69 52 } 70 53 71 72 /**73 * Gets the current millisecond timestamp.74 *75 * This differs from RTTimeNanoTS in that it will use system APIs and not do any76 * resolution or performance optimizations.77 *78 * @returns millisecond timestamp.79 */80 RTDECL(uint64_t) RTTimeSystemMilliTS(void)81 {82 return rtTimeGetSystemNanoTS() / 1000000;83 }84 -
trunk/src/VBox/Runtime/testcase/tstTime.cpp
r1 r1206 121 121 u64OSElapsedTS, u64RTElapsedTS, u64OSElapsedTS - u64RTElapsedTS); 122 122 123 #if defined __WIN__ || defined __LINUX__ 124 RTPrintf("RTTime1nsSteps -> %u\n", RTTime1nsSteps()); 125 #endif 123 RTPrintf("RTTime1nsSteps -> %u (%d ppt)\n", RTTime1nsSteps(), (RTTime1nsSteps() * 1000) / i); 126 124 if (!cErrors) 127 125 RTPrintf("tstTime: SUCCESS\n");
Note:
See TracChangeset
for help on using the changeset viewer.