StallWatchdog v0.3.0

A Hammerspoon Spoon that logs when Hammerspoon's main thread stalls.

Overview

Hotkeys, timers and watchers all run on the main thread, so any blocking call (a slow accessibility query, hs.execute, a synchronous search) delays everything queued behind it. StallWatchdog runs a short repeating timer and warns in the Console whenever a tick arrives late, so the latency you feel can be matched to whatever was running at that moment.

Download: https://github.com/hugoh/StallWatchdog.spoon/releases/latest

Variables

StallWatchdog.interval Variable #

Seconds between watchdog ticks (default: 0.05).

StallWatchdog.threshold Variable #

Seconds a tick may arrive late before it is logged as a stall (default: 0.1).

StallWatchdog.reportInterval Variable #

Seconds between summary lines in the Console: ticks, stalls, worst stall and Lua memory since the previous report. Set to false to disable (default: 60).

Methods

StallWatchdog:init() Method #

Called automatically by hs.loadSpoon(). Logs the loaded version.

StallWatchdog:isRunning() → boolean Method #

Returns whether the watchdog is currently running.

StallWatchdog:start() → StallWatchdog Method #

Starts the watchdog. Time spent stopped is never reported as a stall.

  • The StallWatchdog object, for method chaining
StallWatchdog:stop() → StallWatchdog Method #

Stops the watchdog.

  • The StallWatchdog object, for method chaining
StallWatchdog:toggle() → boolean Method #

Starts the watchdog if it is stopped, stops it otherwise, and logs the new state. Handy from the Hammerspoon Console: spoon.StallWatchdog:toggle().

  • true if the watchdog is now running
StallWatchdog:configure(opts) → StallWatchdog Method #

Sets interval, threshold and/or reportInterval from a table. A running watchdog is restarted so a new interval takes effect.

  • opts - a table with interval, threshold and/or reportInterval keys, in seconds
  • The StallWatchdog object, for method chaining