VirtualBox

Changeset 1206 in vbox


Ignore:
Timestamp:
Mar 5, 2007 12:58:31 AM (18 years ago)
Author:
vboxsync
Message:

use the mscount member of the GIS for system monotonic time source on OS/2.

Location:
trunk/src/VBox/Runtime
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/Makefile

    r1205 r1206  
    314314        generic/semnoint-generic.cpp \
    315315        generic/sched-generic.cpp \
    316         r3/posix/time-posix.cpp \
     316        r3/os2/time-os2.cpp \
    317317        r3/posix/timer-posix.cpp \
    318318        r3/posix/RTTimeNow-posix.cpp \
  • trunk/src/VBox/Runtime/r0drv/os2/assert-r0drv-os2.cpp

    r1191 r1206  
    22/** @file
    33 * 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.
    429 */
    530
  • trunk/src/VBox/Runtime/r3/os2/time-os2.cpp

    r1204 r1206  
    55
    66/*
    7  * Copyright (C) 2006 InnoTek Systemberatung GmbH
     7 * Copyright (c) 2007 knut st. osmundsen <[email protected]>
    88 *
    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:
    1617 *
    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.
    2029 */
    2130
     
    2534*******************************************************************************/
    2635#define LOG_GROUP RTLOGGROUP_TIME
    27 #define RTTIME_INCL_TIMEVAL
    28 #include <sys/time.h>
    29 #include <time.h>
     36#include <InnoTekLIBC/FastInfoBlocks.h>
    3037
    3138#include <iprt/time.h>
    3239#include "internal/time.h"
    3340
     41/** @todo mscount will roll over after ~48 days. */
    3442
    35 DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void)
     43RTDECL(uint64_t) RTTimeSystemNanoTS(void)
    3644{
    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);
    5546}
    5647
    5748
    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)
     49RTDECL(uint64_t) RTTimeSystemMilliTS(void)
    6750{
    68     return rtTimeGetSystemNanoTS();
     51    return fibGetMsCount();
    6952}
    7053
    71 
    72 /**
    73  * Gets the current millisecond timestamp.
    74  *
    75  * This differs from RTTimeNanoTS in that it will use system APIs and not do any
    76  * 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  
    121121                 u64OSElapsedTS, u64RTElapsedTS, u64OSElapsedTS - u64RTElapsedTS);
    122122
    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);
    126124    if (!cErrors)
    127125        RTPrintf("tstTime: SUCCESS\n");
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette