Joe's Ugly Hacks - Sysmon one-off

Show off your RPG maps, campaigns, and tokens. Share your gaming experiences and stories under General Discussion and save this forum for things you've created that may help others run their own games. Use the subforums when appropriate.

Moderators: dorpond, trevor, Azhrei, Gamerdude

Post Reply
User avatar
JoeDuncan
Giant
Posts: 118
Joined: Sun Nov 22, 2020 9:02 pm

Joe's Ugly Hacks - Sysmon one-off

Post by JoeDuncan »

Here's a quick one off:

I'm working on optimizing the performance of JUH, and I realized the metric I was using in my event manager was basically THE main indicator of system load on the Maptool MTScript thread:

==>the time between when a Javascript AJAX request is made to the MTScript environment, and the MTScript macro begins execution.

Explanation
-----------
Since the MTScript environment is single threaded - all calls to it are put into a synchronous queue. Thus the difference between when the macro is added to the queue (as represented by the JS system time), and when that macro begins execution, serves as a very good indicator of the current processing load on the MTScript environment (the lag increases with the amount of macro processing in the queue).

Anyways, since it is more of a general debugging tool (and not really part of the core JUH libs) I've split it out from my events lib and I'm releasing to the public domain "as is" - do with it whatever you like!

Quick Start
-----------
-install the add-on or lib:token from the zip
-for the lib:token, click the "Open_SysMon" macro button on the lib
-for the addon, call [macro("startSysmon@lib:JUH.sysmon"):""]

What it does
------------
The system monitor opens an overlay window, and starts an interval timer that runs very 1/3s. When the interval pings, it records the system time in JS (JS and MT share the same system clock), and makes an AJAX call to an MTScript macro. When it runs, the macro sends the current system time back to the overlay. Differences are accumulated over a 20 tick window, and a running average is calculated every 10 ticks and displayed in the bottom left corner of the window.

When the lag gets >100ms it turns yellow, when it goes above 200ms it turns red.

Anyways, I've found it to be very useful in tuning my macros, maybe someone else will as well!
Attachments
JoesUglyHacks_Sysmon.zip
(44.61 KiB) Downloaded 36 times
"Joe's Ugly Hacks - Get 'em while their hot! Guaranteed ugliest hacks around or your money back!"

Post Reply

Return to “User Creations”