Skip to content

Commit

Permalink
expose printWatchdogEpochs with string consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
kytpbs committed May 4, 2024
1 parent 27babe5 commit 1bb8f4b
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,10 @@ public void enable() {
m_disabled = false;
}

public void printWatchdogEpochs(Consumer<String> output) {
m_watchdog.printEpochs(output);
}

/**
* Adds an action to perform on the initialization of any command by the scheduler.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,10 @@ void CommandScheduler::Enable() {
m_impl->disabled = false;
}

void CommandScheduler::PrintWatchdogEpochs(wpi::raw_ostream& os) {
m_watchdog.PrintEpochs(os);
}

void CommandScheduler::OnCommandInitialize(Action action) {
m_impl->initActions.emplace_back(std::move(action));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,13 @@ class CommandScheduler final : public wpi::Sendable,
*/
void Enable();

/**
* Prints list of epochs added so far and their times to a stream.
*
* @param os output stream
*/
void PrintWatchdogEpochs(wpi::raw_ostream& os);

/**
* Adds an action to perform on the initialization of any command by the
* scheduler.
Expand Down
4 changes: 4 additions & 0 deletions wpilibc/src/main/native/cpp/Watchdog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ void Watchdog::PrintEpochs() {
m_tracer.PrintEpochs();
}

void Watchdog::PrintEpochs(wpi::raw_ostream& os) {
m_tracer.PrintEpochs(os);
}

void Watchdog::Reset() {
Enable();
}
Expand Down
7 changes: 7 additions & 0 deletions wpilibc/src/main/native/include/frc/Watchdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ class Watchdog {
*/
void PrintEpochs();

/**
* Prints list of epochs added so far and their times to a stream.
*
* @param os output stream
*/
void PrintEpochs(wpi::raw_ostream& os);

/**
* Resets the watchdog timer.
*
Expand Down
5 changes: 5 additions & 0 deletions wpilibj/src/main/java/edu/wpi/first/wpilibj/Watchdog.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.Closeable;
import java.util.PriorityQueue;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Consumer;

/**
* A class that's a wrapper around a watchdog timer.
Expand Down Expand Up @@ -159,6 +160,10 @@ public void printEpochs() {
m_tracer.printEpochs();
}

public void printEpochs(Consumer<String> output) {
m_tracer.printEpochs(output);
}

/**
* Resets the watchdog timer.
*
Expand Down

0 comments on commit 1bb8f4b

Please sign in to comment.