Changeset 33155 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Oct 15, 2010 12:07:44 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 66689
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 15 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r33153 r33155 1492 1492 r0drv/nt/thread2-r0drv-nt.cpp \ 1493 1493 r0drv/nt/time-r0drv-nt.cpp \ 1494 r0drv/nt/timer-r0drv-nt.cpp 1494 r0drv/nt/timer-r0drv-nt.cpp \ 1495 r0drv/nt/RTTimerGetSystemGranularity-r0drv-nt.cpp 1495 1496 1496 1497 RuntimeR0Drv_SOURCES.win.amd64 = $(RuntimeWin64ASM_SOURCES) -
trunk/src/VBox/Runtime/r0drv/darwin/semevent-r0drv-darwin.cpp
r33047 r33155 389 389 } 390 390 391 392 RTDECL(uint32_t) RTSemEventGetResolution(void) 393 { 394 uint32_t cNs = absolutetime_to_nanoseconds(1); 395 if (cNs == 0) 396 cNs = 1; 397 return cNs; 398 } 399 -
trunk/src/VBox/Runtime/r0drv/darwin/semeventmulti-r0drv-darwin.cpp
r33047 r33155 403 403 } 404 404 405 406 RTDECL(uint32_t) RTSemEventMultiGetResolution(void) 407 { 408 uint32_t cNs = absolutetime_to_nanoseconds(1); 409 if (cNs == 0) 410 cNs = 1; 411 return cNs; 412 } 413 -
trunk/src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c
r25724 r33155 294 294 } 295 295 296 297 RTDECL(uint32_t) RTSemEventGetResolution(void) 298 { 299 return 1000000000 / hz; 300 } 301 -
trunk/src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c
r25724 r33155 304 304 } 305 305 306 307 RTDECL(uint32_t) RTSemEventMultiGetResolution(void) 308 { 309 return 1000000000 / hz; 310 } 311 -
trunk/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c
r33043 r33155 256 256 RT_EXPORT_SYMBOL(RTSemEventWaitExDebug); 257 257 258 259 RTDECL(uint32_t) RTSemEventGetResolution(void) 260 { 261 return rtR0SemLnxWaitGetResolution(); 262 } 263 RT_EXPORT_SYMBOL(RTSemEventGetResolution); 264 -
trunk/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c
r33043 r33155 321 321 RT_EXPORT_SYMBOL(RTSemEventMultiWaitExDebug); 322 322 323 324 RTDECL(uint32_t) RTSemEventMultiGetResolution(void) 325 { 326 return rtR0SemLnxWaitGetResolution(); 327 } 328 RT_EXPORT_SYMBOL(RTSemEventMultiGetResolution); 329 -
trunk/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h
r33019 r33155 35 35 #include <iprt/string.h> 36 36 #include <iprt/time.h> 37 38 /** The resolution (nanoseconds) specified when using 39 * schedule_hrtimeout_range. */ 40 #define RTR0SEMLNXWAIT_RESOLUTION 50000 37 41 38 42 … … 213 217 else if (pWait->fHighRes) 214 218 { 215 int rc = schedule_hrtimeout (&pWait->u.KtTimeout, HRTIMER_MODE_ABS);219 int rc = schedule_hrtimeout_range(&pWait->u.KtTimeout, HRTIMER_MODE_ABS, RTR0SEMLNXWAIT_RESOLUTION); 216 220 if (!rc) 217 221 pWait->fTimedOut = true; … … 265 269 266 270 267 #endif 268 271 /** 272 * Gets the max resolution of the timeout machinery. 273 * 274 * @returns Resolution specified in nanoseconds. 275 */ 276 DECLINLINE(uint32_t) rtR0SemLnxWaitGetResolution(void) 277 { 278 #ifdef IPRT_LINUX_HAS_HRTIMER 279 return RTR0SEMLNXWAIT_RESOLUTION; 280 #else 281 return 1000000000 / HZ; /* ns */ 282 #endif 283 } 284 285 #endif 286 -
trunk/src/VBox/Runtime/r0drv/nt/RTTimerGetSystemGranularity-r0drv-nt.cpp
r33145 r33155 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - Timers, Ring-0 Driver, NT.3 * IPRT - RTTimerGetSystemGranularity, Ring-0 Driver, NT. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-20 08Oracle Corporation7 * Copyright (C) 2006-2010 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 31 31 32 32 #include <iprt/timer.h> 33 #include <iprt/mp.h>34 #include <iprt/cpuset.h>35 33 #include <iprt/err.h> 36 34 #include <iprt/asm.h> 37 35 #include <iprt/assert.h> 38 #include <iprt/alloc.h>39 36 40 37 #include "internal-r0drv-nt.h" 41 38 #include "internal/magics.h" 42 43 44 /*******************************************************************************45 * Structures and Typedefs *46 *******************************************************************************/47 /**48 * A sub timer structure.49 *50 * This is used for keeping the per-cpu tick and DPC object.51 */52 typedef struct RTTIMERNTSUBTIMER53 {54 /** The tick counter. */55 uint64_t iTick;56 /** Pointer to the parent timer. */57 PRTTIMER pParent;58 /** The NT DPC object. */59 KDPC NtDpc;60 } RTTIMERNTSUBTIMER;61 /** Pointer to a NT sub-timer structure. */62 typedef RTTIMERNTSUBTIMER *PRTTIMERNTSUBTIMER;63 64 /**65 * The internal representation of an Linux timer handle.66 */67 typedef struct RTTIMER68 {69 /** Magic.70 * This is RTTIMER_MAGIC, but changes to something else before the timer71 * is destroyed to indicate clearly that thread should exit. */72 uint32_t volatile u32Magic;73 /** Flag indicating the timer is suspended. */74 bool volatile fSuspended;75 /** Whether the timer must run on one specific CPU or not. */76 bool fSpecificCpu;77 /** Whether the timer must run on all CPUs or not. */78 bool fOmniTimer;79 /** The CPU it must run on if fSpecificCpu is set.80 * The master CPU for an omni-timer. */81 RTCPUID idCpu;82 /** Callback. */83 PFNRTTIMER pfnTimer;84 /** User argument. */85 void *pvUser;86 /** The timer interval. 0 if one-shot. */87 uint64_t u64NanoInterval;88 /** The Nt timer object. */89 KTIMER NtTimer;90 /** The number of sub-timers. */91 RTCPUID cSubTimers;92 /** Sub-timers.93 * Normally there is just one, but for RTTIMER_FLAGS_CPU_ALL this will contain94 * an entry for all possible cpus. In that case the index will be the same as95 * for the RTCpuSet. */96 RTTIMERNTSUBTIMER aSubTimers[1];97 } RTTIMER;98 99 100 101 /**102 * Timer callback function for the non-omni timers.103 *104 * @returns HRTIMER_NORESTART or HRTIMER_RESTART depending on whether it's a one-shot or interval timer.105 * @param pDpc Pointer to the the DPC.106 * @param pvUser Pointer to our internal timer structure.107 * @param SystemArgument1 Some system argument.108 * @param SystemArgument2 Some system argument.109 */110 static void _stdcall rtTimerNtSimpleCallback(IN PKDPC pDpc, IN PVOID pvUser, IN PVOID SystemArgument1, IN PVOID SystemArgument2)111 {112 PRTTIMER pTimer = (PRTTIMER)pvUser;113 AssertPtr(pTimer);114 #ifdef RT_STRICT115 if (KeGetCurrentIrql() < DISPATCH_LEVEL)116 RTAssertMsg2Weak("rtTimerNtSimpleCallback: Irql=%d expected >=%d\n", KeGetCurrentIrql(), DISPATCH_LEVEL);117 #endif118 119 /*120 * Check that we haven't been suspended before doing the callout.121 */122 if ( !ASMAtomicUoReadBool(&pTimer->fSuspended)123 && pTimer->u32Magic == RTTIMER_MAGIC)124 pTimer->pfnTimer(pTimer, pTimer->pvUser, ++pTimer->aSubTimers[0].iTick);125 126 NOREF(pDpc); NOREF(SystemArgument1); NOREF(SystemArgument2);127 }128 129 130 /**131 * The slave DPC callback for an omni timer.132 *133 * @param pDpc The DPC object.134 * @param pvUser Pointer to the sub-timer.135 * @param SystemArgument1 Some system stuff.136 * @param SystemArgument2 Some system stuff.137 */138 static void _stdcall rtTimerNtOmniSlaveCallback(IN PKDPC pDpc, IN PVOID pvUser, IN PVOID SystemArgument1, IN PVOID SystemArgument2)139 {140 PRTTIMERNTSUBTIMER pSubTimer = (PRTTIMERNTSUBTIMER)pvUser;141 PRTTIMER pTimer = pSubTimer->pParent;142 143 AssertPtr(pTimer);144 #ifdef RT_STRICT145 if (KeGetCurrentIrql() < DISPATCH_LEVEL)146 RTAssertMsg2Weak("rtTimerNtOmniSlaveCallback: Irql=%d expected >=%d\n", KeGetCurrentIrql(), DISPATCH_LEVEL);147 int iCpuSelf = RTMpCpuIdToSetIndex(RTMpCpuId());148 if (pSubTimer - &pTimer->aSubTimers[0] != iCpuSelf)149 RTAssertMsg2Weak("rtTimerNtOmniSlaveCallback: iCpuSelf=%d pSubTimer=%p / %d\n", iCpuSelf, pSubTimer, pSubTimer - &pTimer->aSubTimers[0]);150 #endif151 152 /*153 * Check that we haven't been suspended before doing the callout.154 */155 if ( !ASMAtomicUoReadBool(&pTimer->fSuspended)156 && pTimer->u32Magic == RTTIMER_MAGIC)157 pTimer->pfnTimer(pTimer, pTimer->pvUser, ++pSubTimer->iTick);158 159 NOREF(pDpc); NOREF(SystemArgument1); NOREF(SystemArgument2);160 }161 162 163 /**164 * The timer callback for an omni-timer.165 *166 * This is responsible for queueing the DPCs for the other CPUs and167 * perform the callback on the CPU on which it is called.168 *169 * @param pDpc The DPC object.170 * @param pvUser Pointer to the sub-timer.171 * @param SystemArgument1 Some system stuff.172 * @param SystemArgument2 Some system stuff.173 */174 static void _stdcall rtTimerNtOmniMasterCallback(IN PKDPC pDpc, IN PVOID pvUser, IN PVOID SystemArgument1, IN PVOID SystemArgument2)175 {176 PRTTIMERNTSUBTIMER pSubTimer = (PRTTIMERNTSUBTIMER)pvUser;177 PRTTIMER pTimer = pSubTimer->pParent;178 int iCpuSelf = RTMpCpuIdToSetIndex(RTMpCpuId());179 180 AssertPtr(pTimer);181 #ifdef RT_STRICT182 if (KeGetCurrentIrql() < DISPATCH_LEVEL)183 RTAssertMsg2Weak("rtTimerNtOmniMasterCallback: Irql=%d expected >=%d\n", KeGetCurrentIrql(), DISPATCH_LEVEL);184 if (pSubTimer - &pTimer->aSubTimers[0] != iCpuSelf)185 RTAssertMsg2Weak("rtTimerNtOmniMasterCallback: iCpuSelf=%d pSubTimer=%p / %d\n", iCpuSelf, pSubTimer, pSubTimer - &pTimer->aSubTimers[0]);186 #endif187 188 /*189 * Check that we haven't been suspended before scheduling the other DPCs190 * and doing the callout.191 */192 if ( !ASMAtomicUoReadBool(&pTimer->fSuspended)193 && pTimer->u32Magic == RTTIMER_MAGIC)194 {195 RTCPUSET OnlineSet;196 RTMpGetOnlineSet(&OnlineSet);197 for (int iCpu = 0; iCpu < RTCPUSET_MAX_CPUS; iCpu++)198 if ( RTCpuSetIsMemberByIndex(&OnlineSet, iCpu)199 && iCpuSelf != iCpu)200 KeInsertQueueDpc(&pTimer->aSubTimers[iCpu].NtDpc, 0, 0);201 202 pTimer->pfnTimer(pTimer, pTimer->pvUser, ++pSubTimer->iTick);203 }204 205 NOREF(pDpc); NOREF(SystemArgument1); NOREF(SystemArgument2);206 }207 208 209 210 RTDECL(int) RTTimerStart(PRTTIMER pTimer, uint64_t u64First)211 {212 /*213 * Validate.214 */215 AssertPtrReturn(pTimer, VERR_INVALID_HANDLE);216 AssertReturn(pTimer->u32Magic == RTTIMER_MAGIC, VERR_INVALID_HANDLE);217 218 if (!ASMAtomicUoReadBool(&pTimer->fSuspended))219 return VERR_TIMER_ACTIVE;220 if ( pTimer->fSpecificCpu221 && !RTMpIsCpuOnline(pTimer->idCpu))222 return VERR_CPU_OFFLINE;223 224 /*225 * Start the timer.226 */227 PKDPC pMasterDpc = pTimer->fOmniTimer228 ? &pTimer->aSubTimers[RTMpCpuIdToSetIndex(pTimer->idCpu)].NtDpc229 : &pTimer->aSubTimers[0].NtDpc;230 231 uint64_t u64Interval = pTimer->u64NanoInterval / 1000000; /* This is ms, believe it or not. */232 ULONG ulInterval = (ULONG)u64Interval;233 if (ulInterval != u64Interval)234 ulInterval = MAXLONG;235 else if (!ulInterval && pTimer->u64NanoInterval)236 ulInterval = 1;237 238 LARGE_INTEGER DueTime;239 DueTime.QuadPart = -(int64_t)(u64First / 100); /* Relative, NT time. */240 if (DueTime.QuadPart)241 DueTime.QuadPart = -1;242 243 ASMAtomicWriteBool(&pTimer->fSuspended, false);244 KeSetTimerEx(&pTimer->NtTimer, DueTime, ulInterval, pMasterDpc);245 return VINF_SUCCESS;246 }247 248 249 /**250 * Worker function that stops an active timer.251 *252 * Shared by RTTimerStop and RTTimerDestroy.253 *254 * @param pTimer The active timer.255 */256 static void rtTimerNtStopWorker(PRTTIMER pTimer)257 {258 /*259 * Just cancel the timer, dequeue the DPCs and flush them (if this is supported).260 */261 ASMAtomicWriteBool(&pTimer->fSuspended, true);262 KeCancelTimer(&pTimer->NtTimer);263 264 for (RTCPUID iCpu = 0; iCpu < pTimer->cSubTimers; iCpu++)265 KeRemoveQueueDpc(&pTimer->aSubTimers[iCpu].NtDpc);266 267 /*268 * I'm a bit uncertain whether this should be done during RTTimerStop269 * or only in RTTimerDestroy()... Linux and Solaris will wait AFAIK,270 * which is why I'm keeping this here for now.271 */272 if (g_pfnrtNtKeFlushQueuedDpcs)273 g_pfnrtNtKeFlushQueuedDpcs();274 }275 276 277 RTDECL(int) RTTimerStop(PRTTIMER pTimer)278 {279 /*280 * Validate.281 */282 AssertPtrReturn(pTimer, VERR_INVALID_HANDLE);283 AssertReturn(pTimer->u32Magic == RTTIMER_MAGIC, VERR_INVALID_HANDLE);284 285 if (ASMAtomicUoReadBool(&pTimer->fSuspended))286 return VERR_TIMER_SUSPENDED;287 288 /*289 * Call the worker we share with RTTimerDestroy.290 */291 rtTimerNtStopWorker(pTimer);292 return VINF_SUCCESS;293 }294 295 296 RTDECL(int) RTTimerChangeInterval(PRTTIMER pTimer, uint64_t u64NanoInterval)297 {298 AssertPtrReturn(pTimer, VERR_INVALID_HANDLE);299 AssertReturn(pTimer->u32Magic == RTTIMER_MAGIC, VERR_INVALID_HANDLE);300 301 return VERR_NOT_SUPPORTED;302 }303 304 305 RTDECL(int) RTTimerDestroy(PRTTIMER pTimer)306 {307 /* It's ok to pass NULL pointer. */308 if (pTimer == /*NIL_RTTIMER*/ NULL)309 return VINF_SUCCESS;310 AssertPtrReturn(pTimer, VERR_INVALID_HANDLE);311 AssertReturn(pTimer->u32Magic == RTTIMER_MAGIC, VERR_INVALID_HANDLE);312 313 /*314 * Invalidate the timer, stop it if it's running and finally315 * free up the memory.316 */317 ASMAtomicWriteU32(&pTimer->u32Magic, ~RTTIMER_MAGIC);318 if (!ASMAtomicUoReadBool(&pTimer->fSuspended))319 rtTimerNtStopWorker(pTimer);320 RTMemFree(pTimer);321 322 return VINF_SUCCESS;323 }324 325 326 RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_t fFlags, PFNRTTIMER pfnTimer, void *pvUser)327 {328 *ppTimer = NULL;329 330 /*331 * Validate flags.332 */333 if (!RTTIMER_FLAGS_ARE_VALID(fFlags))334 return VERR_INVALID_PARAMETER;335 if ( (fFlags & RTTIMER_FLAGS_CPU_SPECIFIC)336 && (fFlags & RTTIMER_FLAGS_CPU_ALL) != RTTIMER_FLAGS_CPU_ALL337 && !RTMpIsCpuPossible(RTMpCpuIdFromSetIndex(fFlags & RTTIMER_FLAGS_CPU_MASK)))338 return VERR_CPU_NOT_FOUND;339 340 /*341 * Allocate the timer handler.342 */343 RTCPUID cSubTimers = 1;344 if ((fFlags & RTTIMER_FLAGS_CPU_ALL) == RTTIMER_FLAGS_CPU_ALL)345 {346 cSubTimers = RTMpGetMaxCpuId() + 1;347 Assert(cSubTimers <= RTCPUSET_MAX_CPUS); /* On Windows we have a 1:1 relationship between cpuid and set index. */348 }349 350 PRTTIMER pTimer = (PRTTIMER)RTMemAllocZ(RT_OFFSETOF(RTTIMER, aSubTimers[cSubTimers]));351 if (!pTimer)352 return VERR_NO_MEMORY;353 354 /*355 * Initialize it.356 */357 pTimer->u32Magic = RTTIMER_MAGIC;358 pTimer->fSuspended = true;359 pTimer->fSpecificCpu = (fFlags & RTTIMER_FLAGS_CPU_SPECIFIC) && (fFlags & RTTIMER_FLAGS_CPU_ALL) != RTTIMER_FLAGS_CPU_ALL;360 pTimer->fOmniTimer = (fFlags & RTTIMER_FLAGS_CPU_ALL) == RTTIMER_FLAGS_CPU_ALL;361 pTimer->idCpu = pTimer->fSpecificCpu ? RTMpCpuIdFromSetIndex(fFlags & RTTIMER_FLAGS_CPU_MASK) : NIL_RTCPUID;362 pTimer->cSubTimers = cSubTimers;363 pTimer->pfnTimer = pfnTimer;364 pTimer->pvUser = pvUser;365 pTimer->u64NanoInterval = u64NanoInterval;366 KeInitializeTimerEx(&pTimer->NtTimer, SynchronizationTimer);367 if (pTimer->fOmniTimer)368 {369 /*370 * Initialize the per-cpu "sub-timers", select the first online cpu371 * to be the master.372 * ASSUMES that no cpus will ever go offline.373 */374 pTimer->idCpu = NIL_RTCPUID;375 for (unsigned iCpu = 0; iCpu < cSubTimers; iCpu++)376 {377 pTimer->aSubTimers[iCpu].iTick = 0;378 pTimer->aSubTimers[iCpu].pParent = pTimer;379 380 if ( pTimer->idCpu == NIL_RTCPUID381 && RTMpIsCpuOnline(RTMpCpuIdFromSetIndex(iCpu)))382 {383 pTimer->idCpu = RTMpCpuIdFromSetIndex(iCpu);384 KeInitializeDpc(&pTimer->aSubTimers[iCpu].NtDpc, rtTimerNtOmniMasterCallback, &pTimer->aSubTimers[iCpu]);385 }386 else387 KeInitializeDpc(&pTimer->aSubTimers[iCpu].NtDpc, rtTimerNtOmniSlaveCallback, &pTimer->aSubTimers[iCpu]);388 KeSetImportanceDpc(&pTimer->aSubTimers[iCpu].NtDpc, HighImportance);389 KeSetTargetProcessorDpc(&pTimer->aSubTimers[iCpu].NtDpc, (int)RTMpCpuIdFromSetIndex(iCpu));390 }391 Assert(pTimer->idCpu != NIL_RTCPUID);392 }393 else394 {395 /*396 * Initialize the first "sub-timer", target the DPC on a specific processor397 * if requested to do so.398 */399 pTimer->aSubTimers[0].iTick = 0;400 pTimer->aSubTimers[0].pParent = pTimer;401 402 KeInitializeDpc(&pTimer->aSubTimers[0].NtDpc, rtTimerNtSimpleCallback, pTimer);403 KeSetImportanceDpc(&pTimer->aSubTimers[0].NtDpc, HighImportance);404 if (pTimer->fSpecificCpu)405 KeSetTargetProcessorDpc(&pTimer->aSubTimers[0].NtDpc, (int)pTimer->idCpu);406 }407 408 *ppTimer = pTimer;409 return VINF_SUCCESS;410 }411 39 412 40 … … 432 60 } 433 61 434 435 RTDECL(int) RTTimerRequestSystemGranularity(uint32_t u32Request, uint32_t *pu32Granted)436 {437 if (!g_pfnrtNtExSetTimerResolution)438 return VERR_NOT_SUPPORTED;439 440 ULONG ulGranted = g_pfnrtNtExSetTimerResolution(u32Request / 100, TRUE);441 if (pu32Granted)442 *pu32Granted = ulGranted * 100; /* NT -> ns */443 return VINF_SUCCESS;444 }445 446 447 RTDECL(int) RTTimerReleaseSystemGranularity(uint32_t u32Granted)448 {449 if (!g_pfnrtNtExSetTimerResolution)450 return VERR_NOT_SUPPORTED;451 452 g_pfnrtNtExSetTimerResolution(0 /* ignored */, FALSE);453 NOREF(u32Granted);454 return VINF_SUCCESS;455 }456 457 458 RTDECL(bool) RTTimerCanDoHighResolution(void)459 {460 return false;461 }462 -
trunk/src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp
r33043 r33155 266 266 } 267 267 268 269 RTDECL(uint32_t) RTSemEventGetResolution(void) 270 { 271 return RTTimerGetSystemGranularity(); 272 } 273 -
trunk/src/VBox/Runtime/r0drv/nt/semeventmulti-r0drv-nt.cpp
r33043 r33155 290 290 } 291 291 292 293 RTDECL(uint32_t) RTSemEventMultiGetResolution(void) 294 { 295 return RTTimerGetSystemGranularity(); 296 } 297 -
trunk/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp
r32572 r33155 5 5 6 6 /* 7 * Copyright (C) 2006-20 08Oracle Corporation7 * Copyright (C) 2006-2010 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 411 411 412 412 413 RTDECL(uint32_t) RTTimerGetSystemGranularity(void)414 {415 /*416 * Get the default/max timer increment value, return it if ExSetTimerResolution417 * isn't available. Accoring to the sysinternals guys NtQueryTimerResolution418 * is only available in userland and they find it equally annoying.419 */420 ULONG ulTimeInc = KeQueryTimeIncrement();421 if (!g_pfnrtNtExSetTimerResolution)422 return ulTimeInc * 100; /* The value is in 100ns, the funny NT unit. */423 424 /*425 * Use the value returned by ExSetTimerResolution. Since the kernel is keeping426 * count of these calls, we have to do two calls that cancel each other out.427 */428 ULONG ulResolution1 = g_pfnrtNtExSetTimerResolution(ulTimeInc, TRUE);429 ULONG ulResolution2 = g_pfnrtNtExSetTimerResolution(0 /*ignored*/, FALSE);430 AssertMsg(ulResolution1 == ulResolution2, ("%ld, %ld\n", ulResolution1, ulResolution2)); /* not supposed to change it! */431 return ulResolution2 * 100; /* NT -> ns */432 }433 434 435 413 RTDECL(int) RTTimerRequestSystemGranularity(uint32_t u32Request, uint32_t *pu32Granted) 436 414 { -
trunk/src/VBox/Runtime/r0drv/os2/semevent-r0drv-os2.cpp
r25724 r33155 232 232 } 233 233 234 235 RTDECL(uint32_t) RTSemEventGetResolution(void) 236 { 237 return 32000000; /* 32ms */ 238 } 239 -
trunk/src/VBox/Runtime/r0drv/os2/semeventmulti-r0drv-os2.cpp
r25724 r33155 241 241 } 242 242 243 244 RTDECL(uint32_t) RTSemEventMultiGetResolution(void) 245 { 246 return 32000000; /* 32ms */ 247 } 248 -
trunk/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c
r33151 r33155 334 334 } 335 335 336 337 RTDECL(uint32_t) RTSemEventGetResolution(void) 338 { 339 return rtR0SemSolWaitGetResolution(); 340 } 341 342 -
trunk/src/VBox/Runtime/r0drv/solaris/semeventmulti-r0drv-solaris.c
r33144 r33155 340 340 341 341 342 RTDECL(uint32_t) RTSemEventMultiGetResolution(void) 343 { 344 return rtR0SemSolWaitGetResolution(); 345 } 346
Note:
See TracChangeset
for help on using the changeset viewer.