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#include "util/u_debug.h" 29cdc920a0Smrg#include "lp_debug.h" 30cdc920a0Smrg#include "lp_perf.h" 31cdc920a0Smrg 32cdc920a0Smrg 33cdc920a0Smrg 34cdc920a0Smrgstruct lp_counters lp_count; 35cdc920a0Smrg 36cdc920a0Smrg 37cdc920a0Smrgvoid 38cdc920a0Smrglp_reset_counters(void) 39cdc920a0Smrg{ 40cdc920a0Smrg memset(&lp_count, 0, sizeof(lp_count)); 41cdc920a0Smrg} 42cdc920a0Smrg 43cdc920a0Smrg 44cdc920a0Smrgvoid 45cdc920a0Smrglp_print_counters(void) 46cdc920a0Smrg{ 47cdc920a0Smrg if (LP_DEBUG & DEBUG_COUNTERS) { 48cdc920a0Smrg unsigned total_64, total_16, total_4; 49af69d88dSmrg float p1, p2, p3, p4, p5, p6; 50cdc920a0Smrg 513464ebd5Sriastradh debug_printf("llvmpipe: nr_triangles: %9u\n", lp_count.nr_tris); 523464ebd5Sriastradh debug_printf("llvmpipe: nr_culled_triangles: %9u\n", lp_count.nr_culled_tris); 537ec681f3Smrg debug_printf("llvmpipe: nr_rectangles: %9u\n", lp_count.nr_rects); 547ec681f3Smrg debug_printf("llvmpipe: nr_culled_rectangles: %9u\n", lp_count.nr_culled_rects); 55cdc920a0Smrg 56cdc920a0Smrg total_64 = (lp_count.nr_empty_64 + 57cdc920a0Smrg lp_count.nr_fully_covered_64 + 58cdc920a0Smrg lp_count.nr_partially_covered_64); 59cdc920a0Smrg 60cdc920a0Smrg p1 = 100.0 * (float) lp_count.nr_empty_64 / (float) total_64; 61cdc920a0Smrg p2 = 100.0 * (float) lp_count.nr_fully_covered_64 / (float) total_64; 62cdc920a0Smrg p3 = 100.0 * (float) lp_count.nr_partially_covered_64 / (float) total_64; 637ec681f3Smrg p4 = 100.0 * (float) lp_count.nr_blit_64 / (float) total_64; 643464ebd5Sriastradh p5 = 100.0 * (float) lp_count.nr_shade_opaque_64 / (float) total_64; 653464ebd5Sriastradh p6 = 100.0 * (float) lp_count.nr_shade_64 / (float) total_64; 663464ebd5Sriastradh 673464ebd5Sriastradh debug_printf("llvmpipe: nr_64x64: %9u\n", total_64); 683464ebd5Sriastradh debug_printf("llvmpipe: nr_fully_covered_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_fully_covered_64, p2, total_64); 697ec681f3Smrg debug_printf("llvmpipe: nr_blit_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_blit_64, p4, total_64); 707ec681f3Smrg 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); 713464ebd5Sriastradh debug_printf("llvmpipe: nr_shade_opaque_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_shade_opaque_64, p5, total_64); 723464ebd5Sriastradh 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); 733464ebd5Sriastradh debug_printf("llvmpipe: nr_shade_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_shade_64, p6, total_64); 743464ebd5Sriastradh 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); 753464ebd5Sriastradh debug_printf("llvmpipe: nr_partially_covered_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_partially_covered_64, p3, total_64); 763464ebd5Sriastradh debug_printf("llvmpipe: nr_empty_64x64: %9u (%3.0f%% of %u)\n", lp_count.nr_empty_64, p1, total_64); 77cdc920a0Smrg 78cdc920a0Smrg total_16 = (lp_count.nr_empty_16 + 79cdc920a0Smrg lp_count.nr_fully_covered_16 + 80cdc920a0Smrg lp_count.nr_partially_covered_16); 81cdc920a0Smrg 82cdc920a0Smrg p1 = 100.0 * (float) lp_count.nr_empty_16 / (float) total_16; 83cdc920a0Smrg p2 = 100.0 * (float) lp_count.nr_fully_covered_16 / (float) total_16; 84cdc920a0Smrg p3 = 100.0 * (float) lp_count.nr_partially_covered_16 / (float) total_16; 85cdc920a0Smrg 863464ebd5Sriastradh debug_printf("llvmpipe: nr_16x16: %9u\n", total_16); 873464ebd5Sriastradh debug_printf("llvmpipe: nr_fully_covered_16x16: %9u (%3.0f%% of %u)\n", lp_count.nr_fully_covered_16, p2, total_16); 883464ebd5Sriastradh debug_printf("llvmpipe: nr_partially_covered_16x16: %9u (%3.0f%% of %u)\n", lp_count.nr_partially_covered_16, p3, total_16); 893464ebd5Sriastradh debug_printf("llvmpipe: nr_empty_16x16: %9u (%3.0f%% of %u)\n", lp_count.nr_empty_16, p1, total_16); 90cdc920a0Smrg 913464ebd5Sriastradh total_4 = (lp_count.nr_empty_4 + 923464ebd5Sriastradh lp_count.nr_fully_covered_4 + 933464ebd5Sriastradh lp_count.nr_partially_covered_4); 94cdc920a0Smrg 95cdc920a0Smrg p1 = 100.0 * (float) lp_count.nr_empty_4 / (float) total_4; 963464ebd5Sriastradh p2 = 100.0 * (float) lp_count.nr_fully_covered_4 / (float) total_4; 973464ebd5Sriastradh p3 = 100.0 * (float) lp_count.nr_partially_covered_4 / (float) total_4; 98af69d88dSmrg p4 = 100.0 * (float) lp_count.nr_non_empty_4 / (float) total_4; 993464ebd5Sriastradh 1003464ebd5Sriastradh debug_printf("llvmpipe: nr_tri_4x4: %9u\n", total_4); 1013464ebd5Sriastradh debug_printf("llvmpipe: nr_fully_covered_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_fully_covered_4, p2, total_4); 1023464ebd5Sriastradh debug_printf("llvmpipe: nr_partially_covered_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_partially_covered_4, p3, total_4); 1033464ebd5Sriastradh debug_printf("llvmpipe: nr_empty_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_empty_4, p1, total_4); 104af69d88dSmrg debug_printf("llvmpipe: nr_non_empty_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_non_empty_4, p4, total_4); 1053464ebd5Sriastradh 1067ec681f3Smrg total_4 = (lp_count.nr_rect_partially_covered_4 + 1077ec681f3Smrg lp_count.nr_rect_fully_covered_4); 1087ec681f3Smrg 1097ec681f3Smrg p1 = 100.0 * (float) lp_count.nr_rect_partially_covered_4 / (float) total_4; 1107ec681f3Smrg p2 = 100.0 * (float) lp_count.nr_rect_fully_covered_4 / (float) total_4; 1117ec681f3Smrg 1127ec681f3Smrg debug_printf("llvmpipe: nr_rect_4x4: %9u\n", total_4); 1137ec681f3Smrg debug_printf("llvmpipe: nr_rect_full_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_rect_fully_covered_4, p1, total_4); 1147ec681f3Smrg debug_printf("llvmpipe: nr_rect_part_4x4: %9u (%3.0f%% of %u)\n", lp_count.nr_rect_partially_covered_4, p2, total_4); 1157ec681f3Smrg 1167ec681f3Smrg 1173464ebd5Sriastradh debug_printf("llvmpipe: nr_color_tile_clear: %9u\n", lp_count.nr_color_tile_clear); 1183464ebd5Sriastradh debug_printf("llvmpipe: nr_color_tile_load: %9u\n", lp_count.nr_color_tile_load); 1193464ebd5Sriastradh debug_printf("llvmpipe: nr_color_tile_store: %9u\n", lp_count.nr_color_tile_store); 1203464ebd5Sriastradh 1213464ebd5Sriastradh debug_printf("llvmpipe: nr_llvm_compiles: %u\n", lp_count.nr_llvm_compiles); 1223464ebd5Sriastradh debug_printf("llvmpipe: total LLVM compile time: %.2f sec\n", lp_count.llvm_compile_time / 1000000.0); 1233464ebd5Sriastradh debug_printf("llvmpipe: average LLVM compile time: %.2f sec\n", lp_count.llvm_compile_time / 1000000.0 / lp_count.nr_llvm_compiles); 124cdc920a0Smrg 125cdc920a0Smrg } 126cdc920a0Smrg} 127