llvmpipe: count/report time spent in LLVM compilations

This commit is contained in:
Brian Paul 2010-01-27 13:49:43 -07:00
parent 5460da5436
commit e95ad2a2b5
3 changed files with 24 additions and 4 deletions

View File

@ -82,5 +82,9 @@ lp_print_counters(void)
debug_printf("llvmpipe: nr_empty_4x4: %9u (%2.0f%% of %u)\n", lp_count.nr_empty_4, p1, total_4);
debug_printf("llvmpipe: nr_non_empty_4x4: %9u (%2.0f%% of %u)\n", lp_count.nr_non_empty_4, p2, total_4);
debug_printf("llvmpipe: nr_llvm_compiles: %u\n", lp_count.nr_llvm_compiles);
debug_printf("llvmpipe: total LLVM compile time: %.2f sec\n", lp_count.llvm_compile_time / 1000000.0);
debug_printf("llvmpipe: average LLVM compile time: %.2f sec\n", lp_count.llvm_compile_time / 1000000.0 / lp_count.nr_llvm_compiles);
}
}

View File

@ -49,6 +49,8 @@ struct lp_counters
unsigned nr_partially_covered_16;
unsigned nr_empty_4;
unsigned nr_non_empty_4;
unsigned nr_llvm_compiles;
int64_t llvm_compile_time; /**< total, in microseconds */
};
@ -58,8 +60,10 @@ extern struct lp_counters lp_count;
/** Increment the named counter (only for debug builds) */
#ifdef DEBUG
#define LP_COUNT(counter) lp_count.counter++
#define LP_COUNT_ADD(counter, incr) lp_count.counter += (incr)
#else
#define LP_COUNT(counter)
#define LP_COUNT_ADD(counter, incr) (void) incr
#endif

View File

@ -65,6 +65,7 @@
#include "util/u_memory.h"
#include "util/u_format.h"
#include "util/u_debug_dump.h"
#include "util/u_time.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_shader_tokens.h"
#include "draw/draw_context.h"
@ -84,13 +85,14 @@
#include "lp_bld_swizzle.h"
#include "lp_bld_flow.h"
#include "lp_bld_debug.h"
#include "lp_screen.h"
#include "lp_context.h"
#include "lp_buffer.h"
#include "lp_context.h"
#include "lp_debug.h"
#include "lp_perf.h"
#include "lp_screen.h"
#include "lp_setup.h"
#include "lp_state.h"
#include "lp_tex_sample.h"
#include "lp_debug.h"
static const unsigned char quad_offset_x[4] = {0, 1, 0, 1};
@ -1108,9 +1110,19 @@ llvmpipe_update_fs(struct llvmpipe_context *lp)
variant = variant->next;
}
if(!variant)
if (!variant) {
struct util_time t0, t1;
int64_t dt;
util_time_get(&t0);
variant = generate_variant(lp, shader, &key);
util_time_get(&t1);
dt = util_time_diff(&t0, &t1);
LP_COUNT_ADD(llvm_compile_time, dt);
LP_COUNT_ADD(nr_llvm_compiles, 2); /* emit vs. omit in/out test */
}
shader->current = variant;
/* TODO: put this in the variant */