Boost logo

Boost :

From: Boris Gubenko (Boris.Gubenko_at_[hidden])
Date: 2008-05-09 09:29:32


Steven Watanabe wrote:
> Ok. It would be great if compilers supported this directly.

Just fyi: the cxx compiler has verbose template instantiation
mode. On Tru64, for example:

x.cpp
-----
#include <map>

int main() {
  map<int, int> m;
  return m.size();
}

cosf.zko.hp.com> cxx -V
Compaq C++ V7.1-006 for Compaq Tru64 UNIX V5.1B (Rev. 2650)
Compiler Driver V7.1-006 (cxx) cxx Driver
cosf.zko.hp.com> cxx -ptv -c x.cpp
cxx: Info: /usr/lib/cmplrs/cxx/V7.1-006/include/cxx/tree.cc, line 84:
          automatically instantiating void _RWrwstd::_RWrb_tree<int,
          std::pair<const int, int> , _RWrwstd::_RWselect1st<std::pair<const
          int, int> , int> , std::less<int> , std::allocator<std::pair<const
          int, int> > > ::_RWdeallocate_buffers()
  void _RWrb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::_RWdeallocate_buffers ()
------------------------------------------------------^
cxx: Info: /usr/lib/cmplrs/cxx/V7.1-006/include/cxx/tree.cc, line 549:
          automatically instantiating void _RWrwstd::_RWrb_tree<int,
          std::pair<const int, int> , _RWrwstd::_RWselect1st<std::pair<const
          int, int> , int> , std::less<int> , std::allocator<std::pair<const
          int, int> > > ::_RWerase(_RWrwstd::_RWrb_tree<int, std::pair<const
          int, int> , _RWrwstd::_RWselect1st<std::pair<const int, int> , int>
          , std::less<int> , std::allocator<std::pair<const int, int> > >
          ::_RWrb_tree_node *)
  void _RWrb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::_RWerase (_RWlink_type x)
------------------------------------------------------^
cxx: Info: /usr/lib/cmplrs/cxx/V7.1-006/include/cxx/tree.cc, line 301:
          automatically instantiating _RWrwstd::_RWrb_tree<int,
          std::pair<const int, int> , _RWrwstd::_RWselect1st<std::pair<const
          int, int> , int> , std::less<int> , std::allocator<std::pair<const
          int, int> > > ::iterator _RWrwstd::_RWrb_tree<int, std::pair<const
          int, int> , _RWrwstd::_RWselect1st<std::pair<const int, int> , int>
          , std::less<int> , std::allocator<std::pair<const int, int> > >
          ::erase(_RWrwstd::_RWrb_tree<int, std::pair<const int, int> ,
          _RWrwstd::_RWselect1st<std::pair<const int, int> , int> ,
          std::less<int> , std::allocator<std::pair<const int, int> > >
          ::iterator)
  _RWrb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::erase (iterator position)
-------------------------------------------------^
cxx: Info: /usr/lib/cmplrs/cxx/V7.1-006/include/cxx/tree.cc, line 565:
          automatically instantiating _RWrwstd::_RWrb_tree<int,
          std::pair<const int, int> , _RWrwstd::_RWselect1st<std::pair<const
          int, int> , int> , std::less<int> , std::allocator<std::pair<const
          int, int> > > ::iterator _RWrwstd::_RWrb_tree<int, std::pair<const
          int, int> , _RWrwstd::_RWselect1st<std::pair<const int, int> , int>
          , std::less<int> , std::allocator<std::pair<const int, int> > >
          ::erase(_RWrwstd::_RWrb_tree<int, std::pair<const int, int> ,
          _RWrwstd::_RWselect1st<std::pair<const int, int> , int> ,
          std::less<int> , std::allocator<std::pair<const int, int> > >
          ::iterator, _RWrwstd::_RWrb_tree<int, std::pair<const int, int> ,
          _RWrwstd::_RWselect1st<std::pair<const int, int> , int> ,
          std::less<int> , std::allocator<std::pair<const int, int> > >
          ::iterator)
  _RWrb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::erase (iterator first,
-------------------------------------------------^
cosf.zko.hp.com>

----- Original Message -----
From: <boost_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, May 08, 2008 8:29 PM
Subject: Re: [boost] Profiling template instantiations

> AMDG
>
> Simonson, Lucanus J wrote:
>> Ingenious, you are automatically inserting a compile time error into
>> every basic block of the template code to be profiled, compiling the
>> translation unit and counting how many error are generated for each
>> template to get a count of how many times the compiler tries (and fails)
>> to instantiate the template.
>>
>
> Actually it only generates warnings. Otherwise, the compiler is liable
> to stop before it finishes compiling everything.
>
>> There may be a more direct way to extract this information with VTune
>> related profiling features provided in icc. I'll follow up and let you
>> know.
>>
>
> Ok. It would be great if compilers supported this directly.
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk