In the CIRCT project we recently stumbled across the need to add custom entries to the output produced by
--pass-timing. More specifically, we would like to show the time required to parse the input buffer as part of the list (and incorporated into the percentage breakdown). At the moment you would call
PassManage::enableTiming(std::unique_ptr<PassTimingConfig>) in one way or another to enable timing, but the
PassTiming instrumentor being created is private. I was wondering if there’s some interest in making
Timer public, and/or providing some means of accessing the timing instrumentor to the
One option could be an
Optional<PassTiming&> PassManager::getPassTiming() method to obtain a previously enabled pass timing instrumentor. An additional
PassTiming::addTimer(Timer) could then be used to add a timer that was used to time something outside of the PM.
Another option I could see would be an additional
PassManager::enableTiming(PassTiming*) function that registers an externally-provided timing instrumentor with the PM. The user could then setup a
PassTiming instrumentor at the very beginning of the program’s execution, use it to time various other things, then pass it to (possibly multiple?) PM that add their execution times into the mix. Since the PM currently owns its instrumentors, we would probably need to add some proxy instrumentor that wraps a shared pointer.
Would love to hear your thoughts on this!