Class Watchdog

    • Constructor Detail

      • Watchdog

        public Watchdog​(double timeoutSeconds,
                        Runnable callback)
        Watchdog constructor.
        Parameters:
        timeoutSeconds - The watchdog's timeout in seconds with microsecond resolution.
        callback - This function is called when the timeout expires.
    • Method Detail

      • getTime

        public double getTime()
        Returns the time in seconds since the watchdog was last fed.
        Returns:
        The time in seconds since the watchdog was last fed.
      • setTimeout

        public void setTimeout​(double timeoutSeconds)
        Sets the watchdog's timeout.
        Parameters:
        timeoutSeconds - The watchdog's timeout in seconds with microsecond resolution.
      • getTimeout

        public double getTimeout()
        Returns the watchdog's timeout in seconds.
        Returns:
        The watchdog's timeout in seconds.
      • isExpired

        public boolean isExpired()
        Returns true if the watchdog timer has expired.
        Returns:
        True if the watchdog timer has expired.
      • addEpoch

        public void addEpoch​(String epochName)
        Adds time since last epoch to the list printed by printEpochs().
        Parameters:
        epochName - The name to associate with the epoch.
        See Also:
        Tracer.addEpoch(String)
      • reset

        public void reset()
        Resets the watchdog timer.

        This also enables the timer if it was previously disabled.

      • enable

        public void enable()
        Enables the watchdog timer.
      • disable

        public void disable()
        Disables the watchdog timer.
      • suppressTimeoutMessage

        public void suppressTimeoutMessage​(boolean suppress)
        Enable or disable suppression of the generic timeout message.

        This may be desirable if the user-provided callback already prints a more specific message.

        Parameters:
        suppress - Whether to suppress generic timeout message.