Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Time-a-function/AutoHotkey/time-a-function-1.ahk
Normal file
15
Task/Time-a-function/AutoHotkey/time-a-function-1.ahk
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
MsgBox % time("fx")
|
||||
Return
|
||||
|
||||
fx()
|
||||
{
|
||||
Sleep, 1000
|
||||
}
|
||||
|
||||
time(function, parameter=0)
|
||||
{
|
||||
SetBatchLines -1 ; don't sleep for other green threads
|
||||
StartTime := A_TickCount
|
||||
%function%(parameter)
|
||||
Return ElapsedTime := A_TickCount - StartTime . " milliseconds"
|
||||
}
|
||||
16
Task/Time-a-function/AutoHotkey/time-a-function-2.ahk
Normal file
16
Task/Time-a-function/AutoHotkey/time-a-function-2.ahk
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
MsgBox, % TimeFunction("fx")
|
||||
|
||||
TimeFunction(Function, Parameters*) {
|
||||
SetBatchLines, -1 ; SetBatchLines sets the speed of which every new line of coe is run.
|
||||
DllCall("QueryPerformanceCounter", "Int64*", CounterBefore) ; Start the counter.
|
||||
DllCall("QueryPerformanceFrequency", "Int64*", Freq) ; Get the frequency of the counter.
|
||||
%Function%(Parameters*) ; Call the function with it's parameters.
|
||||
DllCall("QueryPerformanceCounter", "Int64*", CounterAfter) ; End the counter.
|
||||
|
||||
; Calculate the speed of which it counted.
|
||||
Return, (((CounterAfter - CounterBefore) / Freq) * 1000) . " milliseconds."
|
||||
}
|
||||
|
||||
fx() {
|
||||
Sleep, 1000
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue