template <class T> void eat_cpu()
{
for (int i = 0; i < (1 << 30); ++i) { }
}
int main(void)
{
eat_cpu<double>();
eat_cpu<int>();
}
$ opreport -l a.out
samples % symbol name
10798 50.0603 void eat_cpu<double>()
10772 49.9397 void eat_cpu<int>()
$ opannotate --source a.out
....
:template <class T> void eat_cpu()
:{ /* void eat_cpu<double>() total:
10798 50.0603 */
******************
**************
21570 100.000 : for (int i = 0; i < (1 << 30);
++i) { }
we have a nice comment in our code
/**
* Differently-named symbol at same file location are
allowed e.g.
* template instantiation.
*/
typedef std::multiset<symbol_entry const *,
less_by_file_loc>
symbols_by_loc_t;
but we are using an interface which can return at most
one symbol...
symbol_entry const * find(debug_name_id filename,
size_t linenr) const;
I'll fix it soon, hesitate between the following output
:{ /* void eat_cpu<double>() total: 10798 50.0603 */
/* void eat_cpu<int() total: 10772 49.9397 */
or
:{ /* multiple symbols total: 21570 100.00 */
regards,
Philippe Elie
Logged In: YES
user_id=318973
Fixed, when multiple symbol live at the same source:linenr
output is now:
:template <class T>
:void eat_cpu()
:{ /* void eat_cpu<double>() 10798 50.0603,
void eat_cpu<int>() 10772 49.9397, total: 21570 100.000 */
regards,
Philippe Elie