Boost logo

Boost :

Subject: Re: [boost] Profiling template instantiations (Steven Watanabe)
From: Joel de Guzman (joel_at_[hidden])
Date: 2008-11-11 21:23:33

Hartmut Kaiser wrote:
> Zoltan,
>> We have created a framework for debugging/profiling template
>> metaprograms in 2006. It might give you a few tips.
>> It works based on the same idea you have.
>> We instrument all template codes, both at the begining
>> and at the end of each template we insert a special piece
>> of code emitting warning messages of a well-defined form.
>> Before instrumentation we create an XML file to remember
>> the template positions in the source file. When we parse
>> the warning, using this information we can reconstruct
>> the instantiation stack knowing the original line numbers,
>> identifiers, etc.. At the end we produce another XML for
>> possible front-ends.
>> The framework uses boost::spirit and boost::wave. We have also
>> implemented and tested a visual studio plug-in.
>> An overview of the whole idea:
>> There is also a GPCE article about the framework, you can find it here:
>> 773116&CFTOKEN=12094611
>> or here:
>> You can download both the VS binaries and the source from:
>> Please feel free to use the code or any of the ideas.
>> For technical question you can find Jozsef: jmihalicza_at_[hidden]
>> or me.
> I've tried to use this last year and found it to work reasonably well for
> small/medium number of templates. The problem I encountered was that for
> real world projects (i.e. trying to analyze some of the Spirit code) the
> generated XML files where too huge to handle (at least for your VS plugin).
> I didn't look further into extracting only certain parts out of the XML,
> though.
> Templight is definitely a promising first step towards better meta-template
> debugging tools! I'ld love to see this to be brought forward in the future.

Same here! I'd love to have it work on template heavy code like
Spirit itself.


Joel de Guzman

Boost list run by bdawes at, gregod at, cpdaniel at, john at