summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2016-10-14 05:37:34 +0200
committerRoland Scheidegger <[email protected]>2016-10-19 01:44:59 +0200
commitd1b4a3451e03e09966fa9700584e38baece8d3cd (patch)
tree9c086250d1cc2cda0384fd9b335de78ae906d6e0
parent6f2f0daeb49e132f44ca9bf930049470a39c970f (diff)
gallivm: print out time for jitting functions with GALLIVM_DEBUG=perf
Compilation to actual machine code can easily take as much time as the optimization passes on the IR if not more, so print this out too. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_init.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index 7114cde4384..d1b2369f34a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -659,13 +659,24 @@ gallivm_jit_function(struct gallivm_state *gallivm,
{
void *code;
func_pointer jit_func;
+ int64_t time_begin = 0;
assert(gallivm->compiled);
assert(gallivm->engine);
+ if (gallivm_debug & GALLIVM_DEBUG_PERF)
+ time_begin = os_time_get();
+
code = LLVMGetPointerToGlobal(gallivm->engine, func);
assert(code);
jit_func = pointer_to_func(code);
+ if (gallivm_debug & GALLIVM_DEBUG_PERF) {
+ int64_t time_end = os_time_get();
+ int time_msec = (int)(time_end - time_begin) / 1000;
+ debug_printf(" jitting func %s took %d msec\n",
+ LLVMGetValueName(func), time_msec);
+ }
+
return jit_func;
}