# Gateway Scripts Duration History

**URL:** <https://forum.inductiveautomation.com/t/gateway-scripts-duration-history/72892>\
**Category:** Ignition\
**Created:** [April 25, 2023, 10:45pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-duration-history/72892 "2023-04-25T22:45:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyler\_Shoemake](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tyler_shoemake/32/55661_2.png) [@Tyler\_Shoemake](https://forum.inductiveautomation.com/u/Tyler_Shoemake)\
**Post date:** [April 25, 2023, 10:45pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-duration-history/72892/1 "2023-04-25T22:45:46Z")

</div>

Is there a history of gateway script execution duration? In the gateway, you can see the duration of the last time the script was executed, but this is only for the last execution. Is this information stored over a time period or is this something that I need to setup in order to develop a history of the execution of gateway scripts?

---

<div class="post-metadata">

**Author:** ![Joe\_Seph](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joe_seph/32/40277_2.png) [@Joe\_Seph](https://forum.inductiveautomation.com/u/Joe_Seph)\
**Post date:** [May 8, 2023, 9:51pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-duration-history/72892/2 "2023-05-08T21:51:11Z")

</div>

Hi Tyler,

There is not a built in history for script executions in the gateway.  
What kind of gateway scripts are you using?

---

<div class="post-metadata">

**Author:** ![Tyler\_Shoemake](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tyler_shoemake/32/55661_2.png) [@Tyler\_Shoemake](https://forum.inductiveautomation.com/u/Tyler_Shoemake)\
**Post date:** [May 8, 2023, 10:38pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-duration-history/72892/3 "2023-05-08T22:38:45Z")

</div>

I am using Timer, Tag Change, and Message Handler scripts. Was just curious if there was a known way to add these executions to a dataset to use for optimization purposes.

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [May 8, 2023, 10:43pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-duration-history/72892/4 "2023-05-08T22:43:49Z")

</div>

> [@Execution Time Script](https://forum.inductiveautomation.com/t/execution-time-script/36605/3):
>
> Use java’s [System.nanoTime()](https://docs.oracle.com/javase/8/docs/api/java/lang/System.html#nanoTime--). from java.lang import System start = System.nanoTime() .... end = System.nanoTime() print "Took %d nanoseconds" % (end-start)

Roll your own, send it to a logger or DB

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 8, 2023, 10:47pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-duration-history/72892/5 "2023-05-08T22:47:24Z")

</div>

You could periodically interrogate `com.inductiveautomation.ignition.common.script.ScriptManager.executingScripts()` manually. You'd have to define a poll rate, but you could get a certain amount of granularity that way.
