21#define FPS_WIDGET_NUM_FRAME_TIMES 50
43 int last_index = widget->
index;
46 widget->
index %= FPS_WIDGET_NUM_FRAME_TIMES;
49 if (widget->
index == 0) {
53 int NUM_FRAME_TIMINGS = FPS_WIDGET_NUM_FRAME_TIMES - 1;
55 for (
int i = 0; i < NUM_FRAME_TIMINGS; i++) {
58 float avg_frametime_ms = total_ms / ((float)NUM_FRAME_TIMINGS);
59 widget->
fps = 1000.f / avg_frametime_ms;
64 assert(widget->
index >= 0);
65 assert(widget->
index < FPS_WIDGET_NUM_FRAME_TIMES);
66 assert(last_index >= 0);
67 assert(last_index < FPS_WIDGET_NUM_FRAME_TIMES);
77 for (
int i = 0; i < FPS_WIDGET_NUM_FRAME_TIMES; i++) {
85 ft->
values.length = FPS_WIDGET_NUM_FRAME_TIMES;
94 widget->debug_var = ft;
102 free(widget->debug_var);
static int64_t os_monotonic_get_ns(void)
Return a monotonic clock in nanoseconds.
Definition: os_time.h:309
static double time_ns_to_ms_f(time_duration_ns ns)
Convert nanoseconds to double float milliseconds, useful for printing.
Definition: u_time.h:114
#define U_TYPED_CALLOC(TYPE)
Allocate and zero the space required for some type, and cast the return type appropriately.
Definition: u_misc.h:47
Wrapper around OS native time functions.
Used to plot a graph of timing information.
Definition: u_var.h:46
float range
How many units the graph expands by default.
Definition: u_var.h:57
bool center_reference_timing
If false, reference_timing will be the bottom of the graph.
Definition: u_var.h:54
bool dynamic_rescale
Rescale graph's value range when value exceeds range.
Definition: u_var.h:60
float reference_timing
A reference line drawn on the plot.
Definition: u_var.h:51
struct u_var_f32_arr values
Values to be plotted.
Definition: u_var.h:48
const char * unit
A string describing the unit used, not freed.
Definition: u_var.h:63
Basic logging functionality.
Common defines and enums for XRT.