X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=metrics.h;fp=metrics.h;h=261a5a5c13fe3a5771544479d3a02b3ed58f04e2;hb=c0c549440d852153d1777eca3fa962c1b70483b3;hp=0000000000000000000000000000000000000000;hpb=4ef9d74d4ff12afcc7e31bf13fe2a4993f06b987;p=fips diff --git a/metrics.h b/metrics.h new file mode 100644 index 0000000..261a5a5 --- /dev/null +++ b/metrics.h @@ -0,0 +1,53 @@ +/* Copyright © 2013, Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef METRICS_H +#define METRICS_H + +/* Add a new counter to the metrics tracking state. + * + * The value accumulated in this counter be accounted against the + * current program (as set with metrics_set_current_program). + * + * Returns: A counter ID suitable for use with glBeginQuery/glEndQuery + */ +unsigned +metrics_add_counter (void); + +/* Set the ID of the currently executing shader program. + * + * The metrics-tracking code will account for per-shader-program + * timings by accumulating counter values measured while each porogram + * is active (see metrics_add_counter). + */ +void +metrics_set_current_program (unsigned program); + +/* Should be called at the end of every function wrapper for a + * function that ends a frame, (glXSwapBuffers and similar). + * + * This function performs whatever bookkeeping is necessary to + * generate a timing report, then emits that report. + */ +void +metrics_end_frame (void); + +#endif