1 #ifndef _PRINT_LATENCY_H
2 #define _PRINT_LATENCY_H 1
4 // A small utility function to print the latency between two end points
5 // (typically when the frame was received from the video card, and some
6 // point when the frame is ready to be output in some form).
12 #include "ref_counted_frame.h"
15 // Since every output frame is based on multiple input frames, we need
16 // more than one start timestamp. For now, we keep just the smallest
17 // and largest timestamp, so that we can print out a range.
18 // For both of these, steady_clock::time_point::min() is used for “not set”.
19 struct ReceivedTimestamps {
20 std::chrono::steady_clock::time_point min_ts, max_ts;
22 struct LatencyHistogram {
23 void init(const std::string &measuring_point); // Initializes histograms and registers them in global_metrics.
25 Histogram histogram_lowest_latency_input, histogram_highest_latency_input;
26 Histogram histogram_lowest_latency_input_bframe, histogram_highest_latency_input_bframe;
29 ReceivedTimestamps find_received_timestamp(const std::vector<RefCountedFrame> &input_frames);
31 void print_latency(const std::string &header, const ReceivedTimestamps &received_ts, bool is_b_frame, int *frameno, LatencyHistogram *histogram);
33 #endif // !defined(_PRINT_LATENCY_H)