summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-01-27 13:49:43 -0700
committerBrian Paul <brianp@vmware.com>2010-01-27 13:49:43 -0700
commite95ad2a2b521514eaec04f9b266ee030ecc639a3 (patch)
tree96eb882f78597cae7af3aa991dfbda3b030a21dc
parent5460da543608805a3debbb401ccc19442e1cb476 (diff)
llvmpipe: count/report time spent in LLVM compilations
-rw-r--r--src/gallium/drivers/llvmpipe/lp_perf.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_perf.h4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c20
3 files changed, 24 insertions, 4 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_perf.c b/src/gallium/drivers/llvmpipe/lp_perf.c
index 2628d51069..042218b27f 100644
--- a/src/gallium/drivers/llvmpipe/lp_perf.c
+++ b/src/gallium/drivers/llvmpipe/lp_perf.c
@@ -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);
}
}
diff --git a/src/gallium/drivers/llvmpipe/lp_perf.h b/src/gallium/drivers/llvmpipe/lp_perf.h
index 9886088c38..d982bcc989 100644
--- a/src/gallium/drivers/llvmpipe/lp_perf.h
+++ b/src/gallium/drivers/llvmpipe/lp_perf.h
@@ -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
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 0053c1b88b..a7514ee011 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -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 */