Added a macro for conveniently timing arbitrary WML actions.
This commit is contained in:
parent
71676359f8
commit
412d47eacf
1 changed files with 26 additions and 0 deletions
|
@ -432,4 +432,30 @@ name=prestart
|
|||
#define MENU_IMG_TXT2 IMG TXT1 TXT2
|
||||
"&"+{IMG}+"="+{TXT1}+"="+{TXT2}#enddef
|
||||
|
||||
#define TIME_ACTIONS CONTENTS
|
||||
# Measure (in milliseconds) the time arbitrary event WML takes to execute.
|
||||
# Afterwards, the time the enclosed WML took to execute is found in the variable
|
||||
# $timed_actions_ms.
|
||||
#
|
||||
# Example:
|
||||
#! [event]
|
||||
#! name=start
|
||||
#!
|
||||
#! {TIME_ACTIONS (
|
||||
#! {MODIFY_UNIT race=orc user_description ( _ "Azir")}
|
||||
#! )}
|
||||
#!
|
||||
#! {DEBUG_MSG "Renaming all orcs to Azir took $timed_actions_ms|ms."}
|
||||
#! [/event]
|
||||
{VARIABLE_OP TIME_ACTIONS_time_begin time stamp}
|
||||
|
||||
{CONTENTS}
|
||||
|
||||
{VARIABLE_OP TIME_ACTIONS_time_end time stamp}
|
||||
|
||||
{VARIABLE timed_actions_ms $TIME_ACTIONS_time_end}
|
||||
{VARIABLE_OP timed_actions_ms add "-$TIME_ACTIONS_time_begin"}
|
||||
|
||||
{CLEAR_VARIABLE TIME_ACTIONS_time_begin}
|
||||
{CLEAR_VARIABLE TIME_ACTIONS_time_end}
|
||||
#enddef
|
Loading…
Add table
Reference in a new issue