Poling, CPU, and Memory Load

As always happens, every few days or weeks, the dreaded “Adobe Updater” pops up. It seemed like a perfect issue to be addressed by KM solution.

So I implemented a macro that, if the Updater starts, then the following happens:

  1. KM detects the starting of the Updater and kills it.
  2. If KM detects the updater is running, KM will kill the process.

I am just looking for a bit of insight to impacts that 1 and 2 have on CPU load and memory allocation. I saw reference to poling processes and potential load in another post. My guess is #1 is interrupt based with no poling required and immediate action. #2 requires periodic poling.

Also, it seems that if #1 is efficient enough, there is no need for #2.

Anyway, simple enough script, but I am most interested in gaining insight into how different actions could potentially impact my computer performance.

How are you triggering the macros, and do they stay running?

As a general rule, regardless of how you trigger your macros, Keyboard Maestro Engine will use negligible CPU as long at:

  • You are not currently executing a macro.
  • The editor is not currently running and displaying actions that are being updated.

The exception (or really, part of the first condition above) would be any trigger that repeats (such as triggering while a key is down), or frequently while an application is running.

So a macro triggered when the updater launches will not use any appreciable energy in normal operation, and if it triggers a macro when it launches and that macro deals with the situation (and does not continue executing), then that will not use appreciable CPU/energy.

The cases where significant CPU/energy are used are generally only:

  • When a macro is being triggered frequently (including by the editor for updating actions).
  • When a macro is running for long periods of time.

I hope that is clear.

The specific cases I am talking about relate to the triggering of an Action:

  1. when application XYZ activates, and

  2. If application XYZ "is active"

In both cases the macro would be triggered, go out, and check these two conditions.

As I look at this, I am probably more concerned about about the "Stay Connected" Applescript I am invoking, as shown below:

The script is used to restart a VPN connection if it has been disconnected. I know this is a KM forum, but any comments with regard to the specific Applescript shown above as it as it relates to processor and memory loading, I would happy to hear.

Hey Ed,

The idle handler is useless unless you’re running the AppleScript as an applet.

You’re better off letting Keyboard Maestro run the timer for you.

-Chris

Thanks Chris,
Not sure I know how to do that in KM.

However, I think I am running that AppleScript as an applet, which serves the added advantage of (1) having it on the dock, and (2) I get the little light under the active applet, so I know that particular one is running.

With that said, I would not mind pursuing a method that allows all the code to simply exist in KM.

Can you provide some more detail on what you were thinking about KM running the timer? Would that be to simply keep cycling and every minute or so run a check to see if a process was active?