Saved Bookmarks
| 1. |
Solve : Batch coding - which command to use?? |
|
Answer» hmm.... SOMEBODY should write a small program that does the same thing as GetTickCount() and uptime, but instead uses QueryPerformanceFrequency() and QueryperformanceCounter().well, so if it measures time since system is up, how is it possible to measure time elapse between command executions? Quote from: ghostdog74 on March 18, 2009, 04:13:21 AM well, so if it measures time since system is up, how is it possible to measure time elapse between command executions? subtraction.Quote from: ghostdog74 on March 18, 2009, 04:13:21 AM well, so if it measures time since system is up, how is it possible to measure time elapse between command executions? You should read the code I posted earlier. I reproduce a relevant portion Code: [Select]set /a elapsed=%finshtime%-%starttime%Quote from: BC_Programmer on March 18, 2009, 04:10:57 AM hmm.... somebody should write a small program that does the same thing as GetTickCount() and uptime, but instead uses QueryPerformanceFrequency() and QueryperformanceCounter(). Beware http://www.virtualdub.org/blog/pivot/entry.php?id=106 Ok ... so i see what you are doing. its the same as using %time% except that %time% doesn't give you millseconds.Quote from: ghostdog74 on March 18, 2009, 04:22:20 AM that's not what i meant. What i meant is, you are taking the milliseconds from the tickcount.exe output correct? and what does this milliseconds mean? Is it the time since the system is up and running, or is it the time elapsed between 2 execution of a code. your system may be up since yesterday and assuming you have not shut down the computer, you are running this code only today. So is tickcount used for the correct purpose? it is the time since the system is running. you run it once. you store that value. you run some code to benchmark. you run it again, storing the new value. you take the difference between the values, thus getting the number of milliseconds that elapsed while the code was running. Anyway, I decided to go ahead and implement a QueryPerformanceCounter program; attached. run it without parameters, and it returns the current value given my QueryPerformanceCounter. run it again, passing in the value RETURNED previously and it spits out the number of seconds that have elapsed... with quite a number of decimals, I might add... [attachment deleted by admin]Quote from: ghostdog74 on March 18, 2009, 04:22:20 AM that's not what i meant. What i meant is, you are taking the milliseconds from the tickcount.exe output correct? and what does this milliseconds mean? Is it the time since the system is up and running, or is it the time elapsed between 2 execution of a code. your system may be up since yesterday and assuming you have not shut down the computer, you are running this code only today. So is tickcount used for the correct purpose? Tickcount measures the time that the system has been up and running. It does not MATTER if the computer was started yesterday or even last week, since the INT32 value rolls over every 49.8 days. Quote from: ghostdog74 on March 18, 2009, 04:22:20 AM Ok ... so i see what you are doing. its the same as using %time% except that %time% doesn't give you millseconds. Mine does, well TENS of milliseconds, which is really what tickcount does. (it only has 10 msec accuracy) Code: [Select]C:\>echo %time% 10:37:03.34 Quote from: Dias de verano on March 18, 2009, 04:38:40 AM Mine does, well tens of milliseconds, which is really what tickcount does. (it only has 10 msec accuracy)not that accurate. though i never really got my hands dirty yet, i believe you can get "uptime" through the Win32_OperatingSystem->LastBootUptime. then going through Date formatting to get milliseconds. anyway.....Quote from: ghostdog74 on March 18, 2009, 04:48:14 AM not that accurate. though i never really got my hands dirty yet, i believe you can get "uptime" through the Win32_OperatingSystem->LastBootUptime. then going through Date formatting to get milliseconds. anyway..... you can, but it is simply wrapping around the GetTickCount() API. As shown here: http://msdn.microsoft.com/en-us/library/ms725473(VS.85).aspx chances are any "uptime" properties/routines are merely calling GetTickCount() and processing the result. (actually, chances are they are actually calling GetTickCount64()...so we are suddenly using third-party tools now ? whaddya mean? |
|