generating pass timing info in a JIT context

Our project runs LLVM in a JIT context, and we want to explore where the time is being spent in the various LLVM components. At the moment, we’re running with a production version of 3.0, and expecting to upgrade to 3.1 soon. We noticed that clang and llc can display component timing using the –ftime-passes and –time-passes options respectively. A little poking around in the code revealed that the timers are started by setting the variable “TimePassesIsEnabled” to true – that’s how the command line processing code does it.

However, setting this variable in the JIT context fails to elicit the timer information coming out on stderr. :frowning:

Earlier, I implemented an optional statistics display using calls to “EnableStatistics()” and “PrintStatistics()” at appropriate places in the JIT environment. This uses the same output file control mechanism as the timing info, and works fine. The difference is that the “PrintStatistics()” function is global – it knows about all the statistics being kept. The output to stderr works fine.

The equivalent printing control for the timing info is, however, bound to the TimerGroup class implemented in Support/Timer.h, .cpp. The relevant TimerGroup structures are static to the modules that define them, so there is no possibility of forcing the printing, like I can do with Statistics. :frowning:

I haven’t yet resorted to debugging LLVM in the JIT context to figure out what’s going wrong, and I haven’t had good luck with this approach in the past, so if anyone has a clue what I’m doing wrong, I’d appreciate hearing from you. Thanks in advance,
-Kevin Harris
Unisys