X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=metrics.h;h=230d668422cc702ee61b8c0da6fe0096e19bf4ce;hb=778d86ef913e3c4fa3618232c6f34f0655e92dd2;hp=4beda7f5e41b1eddfb959b29b9a0a2583bf0b73b;hpb=6dcb864fcfa77c4bf4eb7e1c04f00e53f9fee446;p=fips diff --git a/metrics.h b/metrics.h index 4beda7f..230d668 100644 --- a/metrics.h +++ b/metrics.h @@ -22,6 +22,8 @@ #ifndef METRICS_H #define METRICS_H +#include "metrics-info.h" + typedef enum { METRICS_OP_ACCUM, @@ -50,22 +52,28 @@ typedef enum METRICS_OP_SHADER } metrics_op_t; -/* Initialize metrics info +typedef struct metrics metrics_t; + +/* Create a new metrics_t object for tracking metrics, given the + * pre-initialized metrics_info_t* describing available counters. */ +metrics_t * +metrics_create (metrics_info_t *info); + +/* Free all internal resources of a metrics_t * - * This queries the names and ranges for all available performance counters. + * All outstanding metrics counters are discarded. * - * This should be called once before any other metrics functions. + * The metrics_t object remains valid and may be used again. */ void -metrics_info_init (void); +metrics_fini (metrics_t *metrics); -/* Finalize metrics info state. +/* Destroy a metrics_t object. * - * The function should be called just before setting a new, current, - * OpenGL context. - */ + * After this call, the metrics_t* value is and must not be used + * further. */ void -metrics_info_fini (void); +metrics_destroy (metrics_t *metrics); /* Start accumulating GPU time. * @@ -109,4 +117,18 @@ metrics_get_current_op (void); void metrics_end_frame (void); +/* Process outstanding metrics requests, accumulating results. + * + * This function is called automatically by metrics_end_frame. + * + * During a frame, it may be important to call this function to avoid + * too many oustanding timer/performance-monitor queries. At the same + * time, it's important not to call this function too frequently, + * since collection of metrics information will result in flushes of + * the OpenGL pipeline which can interfere with the behavior being + * measured. + */ +void +metrics_collect_available (void); + #endif