JANA2
C++ framework for multi-threaded data processing
|
JPerfMetrics represents the highest-level metrics we can collect from a running JProcessingTopology. More...
#include <JPerfMetrics.h>
Public Types | |
enum class | Mode { Reset , Ticking , Stopped } |
Public Member Functions | |
Mode | get_mode () |
void | reset () |
Reset is meant to be called between separate run()s or scale()s. More... | |
void | start (size_t current_thread_count) |
This implementation of start() assumes that no processing has occurred while the stopwatch wasn't running. More... | |
void | start (size_t current_event_count, size_t current_thread_count) |
This is the preferred implementation of start(), which doesn't make dangerous assumptions about nothing happening in the meantime. | |
void | split (size_t current_event_count) |
Split accumulates another (monotonic) event count measurement. More... | |
void | stop (size_t current_event_count) |
Stop, and record the final measurement at that time. More... | |
void | stop () |
Stop without recording a final measurement. More... | |
void | summarize (JPerfSummary &summary) |
JPerfMetrics represents the highest-level metrics we can collect from a running JProcessingTopology.
Conceptually, it resembles a stopwatch, which is meant to be reset when the thread count changes, started when processing starts, split every time a performance measurement should be made, and stopped when processing finished. At each interaction the caller provides the current event count. Timers are all managed internally.
void JPerfMetrics::reset | ( | ) |
Reset is meant to be called between separate run()s or scale()s.
It sets everything in the metric back to zero or now(), except the start_event_count, which increases monotonically throughout the life of the program.
void JPerfMetrics::split | ( | size_t | current_event_count | ) |
Split accumulates another (monotonic) event count measurement.
If the stopwatch has already been stopped, split will update the event count without updating the time. This is convenient because we sometimes don't have access to the current event count but still wish to stop the timer, but it is dangerous because it makes the caller responsible for ensuring that further events don't get processed after the stopwatch stops.
void JPerfMetrics::start | ( | size_t | current_thread_count | ) |
This implementation of start() assumes that no processing has occurred while the stopwatch wasn't running.
Thus it can reuse the event count from the previous run. This is convenient because that value can be annoying to calculate.
void JPerfMetrics::stop | ( | ) |
Stop without recording a final measurement.
This can be provided in a later call to split(). void stop(current_event_count)
is preferred.
void JPerfMetrics::stop | ( | size_t | current_event_count | ) |
Stop, and record the final measurement at that time.
This should be used instead of void stop()
whenever possible.