Hi,
I want to get the time execution of a macro with multiple actions. How can I do this?
Hi,
I want to get the time execution of a macro with multiple actions. How can I do this?
Yes, using the ICD Date/Time symbol for milliseconds in day.
At the top of your macro, insert this Action:
%ICUDateTime%A%
At the bottom of your macro, insert these two actions:
START Time: %TimeStart%
END Time: %TimeEnd%
DURATION: %Calculate%(TimeEnd - TimeStart)/1000% sec
I did the math to convert to seconds. Adjust as you desire.
@JMichaelTX’s solution is the right idea, but it is generally better to use the function NOW() or SECONDS() functions or rather than %ICUDateTime%A%. For one thing, the ICUDateTime solution would fail if the macro ran past midnight.
SECONDS() gives you the number of fractional seconds since the Mac started, so for timing a duration, it is probably the best bet.
Use Set Variable to Calculation rather than Set Variable to Text to work with functions.
Thanks for the correction Peter. That's much better.
Thank you both for your assistance, but I couldn’t get it to give me a calculation for some reason
Hey Ali,
Try this. If it doesn't work then restart the KM engine and editor. If that doesn't work reboot.
-Chris
Uploaded a macro with all the actions, using the SECONDS0
function:
Thank you everyone very helpful.
Guys this macro is amazing! however could we develop it so that the result not only provides the duration for the macro to run but the duration for each action in the macro?
Many thanks…
Probably an easy answer here but this is my first variable usage. Loved the solution for this!
How do i get the result to not show so many decimals?
To achieve that, we need to make use of the "Format Results" Option, from the Gear Menu:
and use it in a new KM Action:
Just repeat the calculation before/after each action, and add the results to a KM Variable.
Thats a great idea which I am doing. Sometimes I have individual macros with 30 actions across 4/5 different macros. I thought that the more advanced user could benefit from this feature if it was possible as optimising would be much quicker. Thank you for the advise.
Put the set of actions that @JMichaelTX is suggesting into a sub-macro and then it is just an Execute Macro action between each action, perhaps using the Parameter field as some sort of marker.
Something like:
Start:
Macro Mark Time looks something like:
Something like that anyway.