]> git.sesse.net Git - nageru/blob - print_latency.h
Add a switch to print video latency.
[nageru] / print_latency.h
1 #ifndef _PRINT_LATENCY_H
2 #define _PRINT_LATENCY_H 1
3
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).
7
8 #include <chrono>
9 #include <string>
10
11 // Since every output frame is based on multiple input frames, we need
12 // more than one start timestamp. For now, we keep just the smallest
13 // and largest timestamp, so that we can print out a range.
14 // For both of these, steady_clock::time_point::min() is used for “not set”.
15 struct ReceivedTimestamps {
16         std::chrono::steady_clock::time_point min_ts, max_ts;
17 };
18
19 void print_latency(const std::string &header, const ReceivedTimestamps &received_ts, bool is_b_frame, int *frameno);
20
21 #endif  // !defined(_PRINT_LATENCY_H)