Messages in this thread | ![/](/images/icornerl.gif) | | Date | Fri, 24 Mar 2017 16:01:19 -0300 | From | Arnaldo Carvalho de Melo <> | Subject | Re: [PATCH v5 0/5] perf report: Show inline stack |
| |
Em Sat, Mar 18, 2017 at 05:41:09PM +0100, Milian Wolff escreveu: > On Donnerstag, 16. März 2017 22:42:22 CET Jin Yao wrote: > > v5: Update according to Milian Wolff's comments. It groups by address > > (then display file/ line), or by function (then display function name). > > Thank you Jin, that is really good. I tested it and it works really well for > me. > > Arnaldo, could you please consider merging this? It's an extremely useful > feature and direly missing from perf so far.
Thanks, applied.
> That said, Jin, here are some observations that could be improved in the > future (I don't think any of these should hold back merging this feature now): > > For the following example code build with "-O2 -g" and recorded with "--call- > graph dwarf" I observe some output combinations that could potentially be > improved in the future: > > ~~~~~~~~~~~~~~~~~~~~ > #include <complex> > #include <cmath> > #include <random> > #include <iostream> > > using namespace std; > > int main() > { > uniform_real_distribution<double> uniform(-1E5, 1E5); > default_random_engine engine; > double s = 0; > for (int i = 0; i < 10000000; ++i) { > s += norm(complex<double>(uniform(engine), uniform(engine))); > } > cout << s << '\n'; > return 0; > } > ~~~~~~~~~~~~~~~~ > > #1 duplicated entries when grouping by function: > > ~~~~~~~~~~~~~~~~ > perf report --inline --stdio > ... > --35.34%--_start > __libc_start_main > main > main (inline) > std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned > long, 16807ul, 0ul, 2147483647ul> > (inline) > std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned > long, 16807ul, 0ul, 2147483647ul> > (inline) > std::__detail::_Adaptor<std::linear_congruential_engine<unsigned > long, 16807ul, 0ul, 2147483647ul>, double>::operator() (inline) > ~~~~~~~~~~~~~~~~ > > Here, we see main twice, once for the "real" frame, and once for an inlined > one? Then we see the same function twice as inlined frame, which is also odd. > > ~~~~~~~~~~~~~~~~ > perf report --inline --stdio --no-children > ... > 59.81% cpp-inlining libm-2.25.so [.] __hypot_finite > | > ---__hypot_finite > hypot > main > std::norm<double> (inline) > main (inline) > __libc_start_main > _start > ~~~~~~~~~~~~~~~~ > > Here we see a confusing output. The first "main" frame below "hypot" is > actually code form cpp's complex header which got inlined into main. That > associates the wrong function name to this frame, i.e. "main" instead of > std::norm". When the inline stack is shown below we actually see what happens, > i.e. we eventually end up in main again, but of course this output is not the > best as-is. > > But, again: I think these are minor issues, and the feature itself is already > extremely useful and I hope to see it finally merged. > > Thanks again Jin for your good work! > > Cheers > > -- > Milian Wolff | milian.wolff@kdab.com | Software Engineer > KDAB (Deutschland) GmbH&Co KG, a KDAB Group company > Tel: +49-30-521325470 > KDAB - The Qt Experts
| ![\](/images/icornerr.gif) |