I had this the other day (on v11.0.3) and the engine was absolutely devouring resources until I quit it twice. I thought it was just an anomaly, but it's happening again now (on v11.0.4). Why/how would the engine be capturing the screen without a macro triggering with an action to do so? The log doesn't show anything that seems relevant.
It seems very probable to me that when the KM Editor tries to access the screen, it may call the Engine to do the work. And the KM Editor doesn't need any macro to be active for it to try to access the screen, because when a single action and its conditions is visible in the KM Editor, the Editor tries to evaluate the conditions.
I'm not saying that this is what is causing your issues, I'm just saying that this mechanism could be causing that type of issue.
My theory could be tested. You could close the Editor and those warnings would go away if my theory is causing your problem.
That could be an independent issue. My KM Engine also devours resources frequently. I tend to reboot my engine several times per day when I see the Engine approaching 1GB of RAM. I specifically bought a 24 GB Mac thinking that it may reduce my need to reboot the KM Engine, and I think it has reduced the need, but it's still daily. Hey, I'm so very happy with KM that I'm living with this small defect.
Generally, the only time you get high CPU usage out of Keyboard Maestro Engine is when it is searching the screen for an image (which is a highly computationally intensive task).
It will do this if you are executing a macro that requires this functionality (especially bad can be Pause Until since this will continuously check for the image). Check the Keyboard Maestro status Cancel submenu to see what macros are currently running, as well as the recently executed macros (select the All Macros group and sort the macros by macro execution).
It will also do this if there is an action editor displayed in the Keyboard Maestro editor which is live evaluating an expression involving searching the screen. Eg, an If Then Else action with a Screen Condition. Since the displayed "(currently true)" or "(currently false)" condition is updated every second, even if the macro is not executing, if the condition is displayed in the Keyboard Maestro editor, it is still testing the screen.
Cancel the appropriate macros, add timeouts if necessary so they dont recur, and don't leave the Keyboard Maestro editor displaying such an action (quit it, or undisclose the actions, or deselect the macro).
Yes, this appears to be the cause of the issue I'm encountering. Probably I never noticed before because I've always closed the editor once I was done with it. Unfortunately now I have a macro that requires the editor to be open full time, so I'll have to write a macro to deselect macros upon hiding it.
At the risk of sounding hyperbolic, I sincerely don't know how I would live without Keyboard Maestro.
Can you just disable evaluation? I always leave it off, as I find it slows things down, and really doesn't offer much benefit, as I primarily use local variables (which won't have a value unless the macro is running).
Just click on the "(currently [true|false])" label...
...and you'll be asked about disabling evaluating condition results:
-rob.
Oh maybe, although I tend to rely on the evaluations. And weirdly I find it disabled with not an insignificant frequency even though I never disable it manually. Maybe I can write a macro to automate disabling and reenabling it.
There are conditions where it disables itself, as I recall…though I can't remember what those conditions are just now :).
-rob.
Probably easier to set a shortcut in System Settings->Keyboard->Shortcuts->App Shortcuts. For example:
Yeah, once I started playing with it a bit, I quickly realised automating isn't really feasible even just for unmarking it when KM deactivates because KM needs to be active in order to determine marked state of the menu item. So since I very often ⌘H out of habit, I whipped this up for now (in a KM-only group) and will add a keyboard shortcut as well to re-enable it quickly on demand.
If KM is hidden then the Conditions aren't being evaluated in the Editor and you won't be taking a CPU hit.
You can see this for yourself by running Activity Monitor set to the CPU tab and filtering on "Keyboard Maestro Engine". Add an Action with an image detection Condition like "While any screen contains the Apple Menu icon":
...and turn on Evaluation. You'll see CPU usage spike. Hide the Editor and it'll drop again. Minimising a window will also stop real-time Evaluation for that window.
So if you're seeing high CPU use but the Editor is hidden, it's not Editor Evaluation that's the problem.
Oh so they aren't But this means I can just automate hiding the editor when it deactivates, which is much more straightforward. Probably there are conditions when I won't want it to do that, but I can easily add exceptions as they crop up.
It is disabled if you import macros to ensure they are not executing scripts or such in conditions before you can decide whether they are safe or not.
That was it!
thanks;
-rob.
That's cool I didn't know about that. I always just used the editor to see the most recently executed macros.
Thanks, I have been wondering that and was just about to see what I could find.
It's fun reading back through these threads. Things I take time to add, and then find them already added to the conversation. Read everything, then reply haha.