1cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul/************************************************************************** 2cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * 3cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * Copyright 2009 VMware, Inc. 4cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * All Rights Reserved. 5cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * 6cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * Permission is hereby granted, free of charge, to any person obtaining a 7cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * copy of this software and associated documentation files (the 8cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * "Software"), to deal in the Software without restriction, including 9cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * without limitation the rights to use, copy, modify, merge, publish, 10cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * distribute, sub license, and/or sell copies of the Software, and to 11cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * permit persons to whom the Software is furnished to do so, subject to 12cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * the following conditions: 13cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * 14cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * The above copyright notice and this permission notice (including the 15cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * next paragraph) shall be included in all copies or substantial portions 16cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * of the Software. 17cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * 18cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * 26cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul **************************************************************************/ 27cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul 28cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul/** 29cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * Performance / statistic counters, etc. 30cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul */ 31cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul 32cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul 33cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul#ifndef LP_PERF_H 34cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul#define LP_PERF_H 35cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul 36f67dad7b8248a35fa1344db7619be2970fa1e6e6Vinson Lee#include "pipe/p_compiler.h" 37cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul 38cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul/** 39cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul * Various counters 40cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul */ 41cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paulstruct lp_counters 42cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul{ 43cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul unsigned nr_tris; 44cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul unsigned nr_culled_tris; 45cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul unsigned nr_empty_64; 46cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul unsigned nr_fully_covered_64; 47cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul unsigned nr_partially_covered_64; 4898f3ff8f4a761d579ee9b42ee3090635519213a5Keith Whitwell unsigned nr_pure_shade_opaque_64; 4998f3ff8f4a761d579ee9b42ee3090635519213a5Keith Whitwell unsigned nr_pure_shade_64; 5098f3ff8f4a761d579ee9b42ee3090635519213a5Keith Whitwell unsigned nr_shade_64; 51d4b64167b56f780d0dea73193c345622888fbc16Keith Whitwell unsigned nr_shade_opaque_64; 52cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul unsigned nr_empty_16; 53cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul unsigned nr_fully_covered_16; 54cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul unsigned nr_partially_covered_16; 55cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul unsigned nr_empty_4; 5698f3ff8f4a761d579ee9b42ee3090635519213a5Keith Whitwell unsigned nr_fully_covered_4; 5798f3ff8f4a761d579ee9b42ee3090635519213a5Keith Whitwell unsigned nr_partially_covered_4; 58cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul unsigned nr_non_empty_4; 59e95ad2a2b521514eaec04f9b266ee030ecc639a3Brian Paul unsigned nr_llvm_compiles; 60e95ad2a2b521514eaec04f9b266ee030ecc639a3Brian Paul int64_t llvm_compile_time; /**< total, in microseconds */ 614aeacdf8530d69d543cb2b997c1e65edb71ae01aBrian Paul 624aeacdf8530d69d543cb2b997c1e65edb71ae01aBrian Paul unsigned nr_color_tile_clear; 634aeacdf8530d69d543cb2b997c1e65edb71ae01aBrian Paul unsigned nr_color_tile_load; 644aeacdf8530d69d543cb2b997c1e65edb71ae01aBrian Paul unsigned nr_color_tile_store; 65cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul}; 66cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul 67cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul 68cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paulextern struct lp_counters lp_count; 69cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul 70cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul 71cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul/** Increment the named counter (only for debug builds) */ 72cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul#ifdef DEBUG 73cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul#define LP_COUNT(counter) lp_count.counter++ 74e95ad2a2b521514eaec04f9b266ee030ecc639a3Brian Paul#define LP_COUNT_ADD(counter, incr) lp_count.counter += (incr) 7598f3ff8f4a761d579ee9b42ee3090635519213a5Keith Whitwell#define LP_COUNT_GET(counter) (lp_count.counter) 76cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul#else 77cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul#define LP_COUNT(counter) 78cc2ed02c0a39443b4f46771a0d4e58f0be900859Keith Whitwell#define LP_COUNT_ADD(counter, incr) (void)(incr) 7998f3ff8f4a761d579ee9b42ee3090635519213a5Keith Whitwell#define LP_COUNT_GET(counter) 0 80cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul#endif 81cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul 82cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul 83cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paulextern void 84cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paullp_reset_counters(void); 85cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul 86cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul 87cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paulextern void 88cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paullp_print_counters(void); 89cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul 90cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul 91cd9d9e2436a0815f6ed3a61d2cdf8fad53278506Brian Paul#endif /* LP_PERF_H */ 92