1bf215546Sopenharmony_ci/************************************************************************** 2bf215546Sopenharmony_ci * 3bf215546Sopenharmony_ci * Copyright 2009 VMware, Inc. 4bf215546Sopenharmony_ci * All Rights Reserved. 5bf215546Sopenharmony_ci * 6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the 8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including 9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish, 10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to 11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to 12bf215546Sopenharmony_ci * the following conditions: 13bf215546Sopenharmony_ci * 14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the 15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions 16bf215546Sopenharmony_ci * of the Software. 17bf215546Sopenharmony_ci * 18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21bf215546Sopenharmony_ci * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25bf215546Sopenharmony_ci * 26bf215546Sopenharmony_ci **************************************************************************/ 27bf215546Sopenharmony_ci 28bf215546Sopenharmony_ci#include "util/u_debug.h" 29bf215546Sopenharmony_ci#include "lp_debug.h" 30bf215546Sopenharmony_ci#include "lp_perf.h" 31bf215546Sopenharmony_ci 32bf215546Sopenharmony_ci 33bf215546Sopenharmony_ci 34bf215546Sopenharmony_cistruct lp_counters lp_count; 35bf215546Sopenharmony_ci 36bf215546Sopenharmony_ci 37bf215546Sopenharmony_civoid 38bf215546Sopenharmony_cilp_reset_counters(void) 39bf215546Sopenharmony_ci{ 40bf215546Sopenharmony_ci memset(&lp_count, 0, sizeof(lp_count)); 41bf215546Sopenharmony_ci} 42bf215546Sopenharmony_ci 43bf215546Sopenharmony_ci 44bf215546Sopenharmony_civoid 45bf215546Sopenharmony_cilp_print_counters(void) 46bf215546Sopenharmony_ci{ 47bf215546Sopenharmony_ci if (LP_DEBUG & DEBUG_COUNTERS) { 48bf215546Sopenharmony_ci unsigned total_64, total_16, total_4; 49bf215546Sopenharmony_ci float p1, p2, p3, p4, p5, p6; 50bf215546Sopenharmony_ci 51bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_triangles: %9u\n", lp_count.nr_tris); 52bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_culled_triangles: %9u\n", lp_count.nr_culled_tris); 53bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_rectangles: %9u\n", lp_count.nr_rects); 54bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_culled_rectangles: %9u\n", lp_count.nr_culled_rects); 55bf215546Sopenharmony_ci 56bf215546Sopenharmony_ci total_64 = (lp_count.nr_empty_64 + 57bf215546Sopenharmony_ci lp_count.nr_fully_covered_64 + 58bf215546Sopenharmony_ci lp_count.nr_partially_covered_64); 59bf215546Sopenharmony_ci 60bf215546Sopenharmony_ci p1 = 100.0 * (float) lp_count.nr_empty_64 / (float) total_64; 61bf215546Sopenharmony_ci p2 = 100.0 * (float) lp_count.nr_fully_covered_64 / (float) total_64; 62bf215546Sopenharmony_ci p3 = 100.0 * (float) lp_count.nr_partially_covered_64 / (float) total_64; 63bf215546Sopenharmony_ci p4 = 100.0 * (float) lp_count.nr_blit_64 / (float) total_64; 64bf215546Sopenharmony_ci p5 = 100.0 * (float) lp_count.nr_shade_opaque_64 / (float) total_64; 65bf215546Sopenharmony_ci p6 = 100.0 * (float) lp_count.nr_shade_64 / (float) total_64; 66bf215546Sopenharmony_ci 67bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_64x64: %9u\n", total_64); 68bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_fully_covered_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_fully_covered_64, p2, total_64); 69bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_blit_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_blit_64, p4, total_64); 70bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_pure_blit_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_pure_blit_64, 0.0, lp_count.nr_blit_64); 71bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_shade_opaque_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_shade_opaque_64, p5, total_64); 72bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_pure_shade_opaque: %9u (%3.0f%% of %u)\n", lp_count.nr_pure_shade_opaque_64, 0.0, lp_count.nr_shade_opaque_64); 73bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_shade_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_shade_64, p6, total_64); 74bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_pure_shade: %9u (%3.0f%% of %u)\n", lp_count.nr_pure_shade_64, 0.0, lp_count.nr_shade_64); 75bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_partially_covered_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_partially_covered_64, p3, total_64); 76bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_empty_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_empty_64, p1, total_64); 77bf215546Sopenharmony_ci 78bf215546Sopenharmony_ci total_16 = (lp_count.nr_empty_16 + 79bf215546Sopenharmony_ci lp_count.nr_fully_covered_16 + 80bf215546Sopenharmony_ci lp_count.nr_partially_covered_16); 81bf215546Sopenharmony_ci 82bf215546Sopenharmony_ci p1 = 100.0 * (float) lp_count.nr_empty_16 / (float) total_16; 83bf215546Sopenharmony_ci p2 = 100.0 * (float) lp_count.nr_fully_covered_16 / (float) total_16; 84bf215546Sopenharmony_ci p3 = 100.0 * (float) lp_count.nr_partially_covered_16 / (float) total_16; 85bf215546Sopenharmony_ci 86bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_16x16: %9u\n", total_16); 87bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_fully_covered_16x16: %9u (%3.0f%% of %u)\n", lp_count.nr_fully_covered_16, p2, total_16); 88bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_partially_covered_16x16: %9u (%3.0f%% of %u)\n", lp_count.nr_partially_covered_16, p3, total_16); 89bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_empty_16x16: %9u (%3.0f%% of %u)\n", lp_count.nr_empty_16, p1, total_16); 90bf215546Sopenharmony_ci 91bf215546Sopenharmony_ci total_4 = (lp_count.nr_empty_4 + 92bf215546Sopenharmony_ci lp_count.nr_fully_covered_4 + 93bf215546Sopenharmony_ci lp_count.nr_partially_covered_4); 94bf215546Sopenharmony_ci 95bf215546Sopenharmony_ci p1 = 100.0 * (float) lp_count.nr_empty_4 / (float) total_4; 96bf215546Sopenharmony_ci p2 = 100.0 * (float) lp_count.nr_fully_covered_4 / (float) total_4; 97bf215546Sopenharmony_ci p3 = 100.0 * (float) lp_count.nr_partially_covered_4 / (float) total_4; 98bf215546Sopenharmony_ci p4 = 100.0 * (float) lp_count.nr_non_empty_4 / (float) total_4; 99bf215546Sopenharmony_ci 100bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_tri_4x4: %9u\n", total_4); 101bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_fully_covered_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_fully_covered_4, p2, total_4); 102bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_partially_covered_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_partially_covered_4, p3, total_4); 103bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_empty_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_empty_4, p1, total_4); 104bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_non_empty_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_non_empty_4, p4, total_4); 105bf215546Sopenharmony_ci 106bf215546Sopenharmony_ci total_4 = (lp_count.nr_rect_partially_covered_4 + 107bf215546Sopenharmony_ci lp_count.nr_rect_fully_covered_4); 108bf215546Sopenharmony_ci 109bf215546Sopenharmony_ci p1 = 100.0 * (float) lp_count.nr_rect_partially_covered_4 / (float) total_4; 110bf215546Sopenharmony_ci p2 = 100.0 * (float) lp_count.nr_rect_fully_covered_4 / (float) total_4; 111bf215546Sopenharmony_ci 112bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_rect_4x4: %9u\n", total_4); 113bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_rect_full_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_rect_fully_covered_4, p1, total_4); 114bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_rect_part_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_rect_partially_covered_4, p2, total_4); 115bf215546Sopenharmony_ci 116bf215546Sopenharmony_ci 117bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_color_tile_clear: %9u\n", lp_count.nr_color_tile_clear); 118bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_color_tile_load: %9u\n", lp_count.nr_color_tile_load); 119bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_color_tile_store: %9u\n", lp_count.nr_color_tile_store); 120bf215546Sopenharmony_ci 121bf215546Sopenharmony_ci debug_printf("llvmpipe: nr_llvm_compiles: %u\n", lp_count.nr_llvm_compiles); 122bf215546Sopenharmony_ci debug_printf("llvmpipe: total LLVM compile time: %.2f sec\n", lp_count.llvm_compile_time / 1000000.0); 123bf215546Sopenharmony_ci debug_printf("llvmpipe: average LLVM compile time: %.2f sec\n", lp_count.llvm_compile_time / 1000000.0 / lp_count.nr_llvm_compiles); 124bf215546Sopenharmony_ci 125bf215546Sopenharmony_ci } 126bf215546Sopenharmony_ci} 127