Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose tracer.printEpoch with string consumer in watchdog and commandScheduler. #6583

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading