TickCount: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Adding new author and category links.) |
Instructor (talk | contribs) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{PageAuthor|Instructor}} | {{PageAuthor|Instructor}} | ||
== The Function == | == The Function Description== | ||
<highlight-nsis> | |||
<highlight-nsis> | |||
____________________________________________________________________________ | ____________________________________________________________________________ | ||
Line 25: | Line 26: | ||
Note: | Note: | ||
${TickCountStart} | ${TickCountStart} uses stack to save inicial time | ||
</highlight-nsis> | |||
<b>Example1:</b> | |||
<highlight-nsis> | |||
Section | Section | ||
${TickCountStart} | ${TickCountStart} | ||
Line 36: | Line 38: | ||
${TickCountEnd} $0 | ${TickCountEnd} $0 | ||
MessageBox MB_OK "Message showed: $0 ms" | MessageBox MB_OK "Message showed: $0 ms" | ||
SectionEnd | SectionEnd | ||
</highlight-nsis> | |||
<b>Example2:</b> | |||
<highlight-nsis> | |||
Section | |||
${TickCountStart} | |||
MessageBox MB_OK "TickCount started" | |||
${TickCountEnd} $0 | |||
IntOp $1 $0 / 1000 | |||
IntOp $0 $0 % 1000 | |||
IntOp $2 $1 / 60 | |||
IntOp $1 $1 % 60 | |||
IntOp $3 $2 / 60 | |||
IntOp $2 $2 % 60 | |||
MessageBox MB_OK "Message showed: $3 hours $2 min $1 sec $0 ms" | |||
SectionEnd | |||
</highlight-nsis> | |||
== The Function Code== | |||
<highlight-nsis> | |||
Function TickCountStart | Function TickCountStart | ||
!define TickCountStart `!insertmacro TickCountStartCall` | !define TickCountStart `!insertmacro TickCountStartCall` |
Latest revision as of 18:02, 19 July 2005
Author: Instructor (talk, contrib) |
The Function Description
____________________________________________________________________________ TickCount ____________________________________________________________________________ Thanks kike_velez (Based on his code) Get completion time of the some process. Syntax: ${TickCountStart} # ... code ... ${TickCountEnd} $var # $var=Elapsed time since start in milliseconds Note: ${TickCountStart} uses stack to save inicial time
Example1:
Section ${TickCountStart} MessageBox MB_OK "TickCount started" ${TickCountEnd} $0 MessageBox MB_OK "Message showed: $0 ms" SectionEnd
Example2:
Section ${TickCountStart} MessageBox MB_OK "TickCount started" ${TickCountEnd} $0 IntOp $1 $0 / 1000 IntOp $0 $0 % 1000 IntOp $2 $1 / 60 IntOp $1 $1 % 60 IntOp $3 $2 / 60 IntOp $2 $2 % 60 MessageBox MB_OK "Message showed: $3 hours $2 min $1 sec $0 ms" SectionEnd
The Function Code
Function TickCountStart !define TickCountStart `!insertmacro TickCountStartCall` !macro TickCountStartCall Call TickCountStart !macroend Push $0 System::Call 'kernel32::GetTickCount()i .r0' Exch $0 FunctionEnd Function TickCountEnd !define TickCountEnd `!insertmacro TickCountEndCall` !macro TickCountEndCall _RESULT Call TickCountEnd Pop ${_RESULT} !macroend Exch $0 Push $1 System::Call 'kernel32::GetTickCount()i .r1' System::Int64Op $1 - $0 Pop $0 Pop $1 Exch $0 FunctionEnd