1cdc920a0Smrg/**************************************************************************
2cdc920a0Smrg *
3cdc920a0Smrg * Copyright 2009 VMware, Inc.
4cdc920a0Smrg * All Rights Reserved.
5cdc920a0Smrg *
6cdc920a0Smrg * Permission is hereby granted, free of charge, to any person obtaining a
7cdc920a0Smrg * copy of this software and associated documentation files (the
8cdc920a0Smrg * "Software"), to deal in the Software without restriction, including
9cdc920a0Smrg * without limitation the rights to use, copy, modify, merge, publish,
10cdc920a0Smrg * distribute, sub license, and/or sell copies of the Software, and to
11cdc920a0Smrg * permit persons to whom the Software is furnished to do so, subject to
12cdc920a0Smrg * the following conditions:
13cdc920a0Smrg *
14cdc920a0Smrg * The above copyright notice and this permission notice (including the
15cdc920a0Smrg * next paragraph) shall be included in all copies or substantial portions
16cdc920a0Smrg * of the Software.
17cdc920a0Smrg *
18cdc920a0Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19cdc920a0Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20cdc920a0Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21cdc920a0Smrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22cdc920a0Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23cdc920a0Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24cdc920a0Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25cdc920a0Smrg *
26cdc920a0Smrg **************************************************************************/
27cdc920a0Smrg
28cdc920a0Smrg/**
29cdc920a0Smrg * Performance / statistic counters, etc.
30cdc920a0Smrg */
31cdc920a0Smrg
32cdc920a0Smrg
33cdc920a0Smrg#ifndef LP_PERF_H
34cdc920a0Smrg#define LP_PERF_H
35cdc920a0Smrg
363464ebd5Sriastradh#include "pipe/p_compiler.h"
37cdc920a0Smrg
38cdc920a0Smrg/**
39cdc920a0Smrg * Various counters
40cdc920a0Smrg */
41cdc920a0Smrgstruct lp_counters
42cdc920a0Smrg{
43cdc920a0Smrg   unsigned nr_tris;
44cdc920a0Smrg   unsigned nr_culled_tris;
457ec681f3Smrg   unsigned nr_rects;
467ec681f3Smrg   unsigned nr_culled_rects;
47cdc920a0Smrg   unsigned nr_empty_64;
48cdc920a0Smrg   unsigned nr_fully_covered_64;
49cdc920a0Smrg   unsigned nr_partially_covered_64;
507ec681f3Smrg   unsigned nr_blit_64;
517ec681f3Smrg   unsigned nr_pure_blit_64;
523464ebd5Sriastradh   unsigned nr_pure_shade_opaque_64;
533464ebd5Sriastradh   unsigned nr_pure_shade_64;
543464ebd5Sriastradh   unsigned nr_shade_64;
553464ebd5Sriastradh   unsigned nr_shade_opaque_64;
56cdc920a0Smrg   unsigned nr_empty_16;
57cdc920a0Smrg   unsigned nr_fully_covered_16;
58cdc920a0Smrg   unsigned nr_partially_covered_16;
59cdc920a0Smrg   unsigned nr_empty_4;
603464ebd5Sriastradh   unsigned nr_fully_covered_4;
613464ebd5Sriastradh   unsigned nr_partially_covered_4;
627ec681f3Smrg   unsigned nr_rect_fully_covered_4;
637ec681f3Smrg   unsigned nr_rect_partially_covered_4;
64cdc920a0Smrg   unsigned nr_non_empty_4;
65cdc920a0Smrg   unsigned nr_llvm_compiles;
66cdc920a0Smrg   int64_t llvm_compile_time;  /**< total, in microseconds */
67cdc920a0Smrg
68cdc920a0Smrg   unsigned nr_color_tile_clear;
69cdc920a0Smrg   unsigned nr_color_tile_load;
70cdc920a0Smrg   unsigned nr_color_tile_store;
71cdc920a0Smrg};
72cdc920a0Smrg
73cdc920a0Smrg
74cdc920a0Smrgextern struct lp_counters lp_count;
75cdc920a0Smrg
76cdc920a0Smrg
77cdc920a0Smrg/** Increment the named counter (only for debug builds) */
78cdc920a0Smrg#ifdef DEBUG
79cdc920a0Smrg#define LP_COUNT(counter) lp_count.counter++
80cdc920a0Smrg#define LP_COUNT_ADD(counter, incr)  lp_count.counter += (incr)
813464ebd5Sriastradh#define LP_COUNT_GET(counter) (lp_count.counter)
82cdc920a0Smrg#else
837ec681f3Smrg#define LP_COUNT(counter) do {} while (0)
843464ebd5Sriastradh#define LP_COUNT_ADD(counter, incr) (void)(incr)
853464ebd5Sriastradh#define LP_COUNT_GET(counter) 0
86cdc920a0Smrg#endif
87cdc920a0Smrg
88cdc920a0Smrg
89cdc920a0Smrgextern void
90cdc920a0Smrglp_reset_counters(void);
91cdc920a0Smrg
92cdc920a0Smrg
93cdc920a0Smrgextern void
94cdc920a0Smrglp_print_counters(void);
95cdc920a0Smrg
96cdc920a0Smrg
97cdc920a0Smrg#endif /* LP_PERF_H */
98