Changeset 9950 in vbox
- Timestamp:
- Jun 26, 2008 11:56:57 AM (16 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/timer-win.cpp
r9444 r9950 78 78 /* from sysinternals. */ 79 79 NTSYSAPI LONG NTAPI NtSetTimerResolution(IN ULONG DesiredResolution, IN BOOLEAN SetResolution, OUT PULONG CurrentResolution); 80 NTSYSAPI LONG NTAPI NtQueryTimerResolution(OUT PULONG M inimumResolution, OUT PULONG MaximumResolution, OUT PULONG CurrentResolution);80 NTSYSAPI LONG NTAPI NtQueryTimerResolution(OUT PULONG MaximumResolution, OUT PULONG MinimumResolution, OUT PULONG CurrentResolution); 81 81 __END_DECLS 82 82 … … 290 290 * we start the timer. 291 291 */ 292 ULONG Min= ~0;293 ULONG Max= ~0;294 ULONG Cur = ~0;295 NtQueryTimerResolution(& Min, &Max, &Cur);296 Log(("NtQueryTimerResolution -> Min=%lu Max=%lu Cur=%lu (100ns)\n", Min, Max,Cur));297 if ( Cur > Max &&Cur > 10000 /* = 1ms */)298 { 299 if (NtSetTimerResolution(10000, TRUE, & Cur) >= 0)292 ULONG ulMax = ~0; 293 ULONG ulMin = ~0; 294 ULONG ulCur = ~0; 295 NtQueryTimerResolution(&ulMax, &ulMin, &ulCur); 296 Log(("NtQueryTimerResolution -> ulMax=%lu00ns ulMin=%lu00ns ulCur=%lu00ns\n", ulMax, ulMin, ulCur)); 297 if (ulCur > ulMin && ulCur > 10000 /* = 1ms */) 298 { 299 if (NtSetTimerResolution(10000, TRUE, &ulCur) >= 0) 300 300 Log(("Changed timer resolution to 1ms.\n")); 301 else if (NtSetTimerResolution(20000, TRUE, & Cur) >= 0)301 else if (NtSetTimerResolution(20000, TRUE, &ulCur) >= 0) 302 302 Log(("Changed timer resolution to 2ms.\n")); 303 else if (NtSetTimerResolution(40000, TRUE, & Cur) >= 0)303 else if (NtSetTimerResolution(40000, TRUE, &ulCur) >= 0) 304 304 Log(("Changed timer resolution to 4ms.\n")); 305 else if ( Max <= 50000 && NtSetTimerResolution(Max, TRUE, &Cur) >= 0)306 Log(("Changed timer resolution to %lu *100ns.\n", Max));305 else if (ulMin <= 50000 && NtSetTimerResolution(ulMin, TRUE, &ulCur) >= 0) 306 Log(("Changed timer resolution to %lu *100ns.\n", ulMin)); 307 307 else 308 308 { … … 330 330 if (pTimer->TimerId) 331 331 { 332 ULONG Min= ~0;333 ULONG Max= ~0;334 ULONG Cur = ~0;335 NtQueryTimerResolution(& Min, &Max, &Cur);336 Log(("NtQueryTimerResolution -> Min=%lu Max=%lu Cur=%lu (100ns)\n", Min, Max,Cur));332 ULONG ulMax = ~0; 333 ULONG ulMin = ~0; 334 ULONG ulCur = ~0; 335 NtQueryTimerResolution(&ulMax, &ulMin, &ulCur); 336 Log(("NtQueryTimerResolution -> ulMax=%lu00ns ulMin=%lu00ns ulCur=%lu00ns\n", ulMax, ulMin, ulCur)); 337 337 338 338 *ppTimer = pTimer; -
trunk/src/VBox/Runtime/testcase/ntGetTimerResolution.cpp
r8245 r9950 39 39 extern "C" { 40 40 /* from sysinternals. */ 41 NTSYSAPI LONG NTAPI NtQueryTimerResolution(OUT PULONG M inimumResolution, OUT PULONG MaximumResolution, OUT PULONG CurrentResolution);41 NTSYSAPI LONG NTAPI NtQueryTimerResolution(OUT PULONG MaximumResolution, OUT PULONG MinimumResolution, OUT PULONG CurrentResolution); 42 42 } 43 43 … … 48 48 ULONG Max = ~0; 49 49 ULONG Cur = ~0; 50 NtQueryTimerResolution(&M in, &Max, &Cur);51 printf("NtQueryTimerResolution -> M in=%lu Max=%lu Cur=%lu (100ns)\n", Min, Max, Cur);50 NtQueryTimerResolution(&Max, &Min, &Cur); 51 printf("NtQueryTimerResolution -> Max=%lu00ns Min=%lu00ns Cur=%lu00ns\n", Min, Max, Cur); 52 52 53 53 #if 0
Note:
See TracChangeset
for help on using the changeset viewer.