Retrieves the current value of the high-resolution performance counter, if one exists. The value of counter is converted to time (divided by hrFrequency).
vhrTimeCounter = Kernel.hrTimeCounter ([double as double = 1000.0])
| Where | Type | Optional | Default | Description |
|---|---|---|---|---|
| double | double | yes | 1000.0 | Multiplication factor. 1 means second, 1000 milisecond, ... |
double
Performance counter is returned as a number of milisecond.
This property uses QueryPerformanceFrequency and QueryPerformanceCounter API functions.
Kernel - Get exact duration of a VBS function using msPerformanceCounter |
Dim Kernel, OldhrTimeCounter
Set Kernel = CreateObject("ScriptUtils.Kernel")
'Get counter
OldhrTimeCounter = Kernel.hrTimeCounter
'Some operation taking many time
Dim Data, Parameter
Parameter = "Some parameter"
Data = CreateData(Parameter)
'Count number of microsecond
Dim msTime
msTime = Kernel.hrTimeCounter - OldhrTimeCounter
'Output results
Wscript.Echo "CreateData takes " & msTime & " milisecond" |
Kernel.hrFrequency, Kernel.hrCounter
CloseHandle, CopyFile, CreateProcess, DeleteFile, GetFileSize, MoveFile, Sleep, SwitchToThread, WaitForSingleObject
CommandLine, ComputerName, CurrentDirectory, CurrentProcess, CurrentThread, EnvironmentStrings, EnvironmentVariables, hrCounter, hrFrequency, hrTimeCounter, TempPath, TickCount
COM API for calling some of Kernel32 functions.
© 1996 - 2009 Antonin Foller, Motobit Software | About, Contacts | e-mail: info@pstruh.cz