Git Product home page Git Product logo

Comments (12)

tavianator avatar tavianator commented on August 24, 2024

Also, demangled C++ types can have (anonymous namespace):: in them, which makes the $func =~ s/\(.*//; line suspect as well.

from flamegraph.

borellim avatar borellim commented on August 24, 2024

Fixing this issue would be very useful. It's quite hard to read templated functions at the moment.

Thank you @tavianator for the patch: it appears to turn angle brackets into round brackets, which is a nice temporary solution.

Even better, in my opinion, would be to add a switch to completely strip template parameters: this would shorten the names, and the loss of information would be negligible in many cases. 'gprof2dot' can do it with the '-s' option.

@brendangregg , any input on this?

from flamegraph.

brendangregg avatar brendangregg commented on August 24, 2024

This might have been fixed since the issue was filed, as I see flamegraph.pl currently has:

   572      # clean up SVG breaking characters:
   573      $stack =~ tr/<>/()/;

from flamegraph.

borellim avatar borellim commented on August 24, 2024

So, I was wrong: the angle brackets are turned into parentheses exactly by the line that you mentioned. Unfortunately (at least with perf) they don't actually show up unless you also remove line 216 in stackcollapse-perf.pl:

$func =~ tr/<>//d;

In my tests, removing this line shows them as parentheses, while also removing line 573 of flamegraph.pl correctly shows them as angle brackets. I didn't try with input from other profilers, though.

My suggestion to add a switch to strip the template parameters still stands; I'm using a sed script now, and I find the output much clearer.

Thanks a lot.

from flamegraph.

Yamakaky avatar Yamakaky commented on August 24, 2024

I have a similar issue with Rust, with has the same syntax that C++ for the generics. <...> gets turned into (). If I remove the $stack =~ tr/<>/()/; line mentioned above, the <> are kept as expected. From the comments it seems like it's to protect SVG, but I don't have any issues with this fix.

from flamegraph.

Yamakaky avatar Yamakaky commented on August 24, 2024

The <> characters are xml encoded, so I don't think it's a problem https://github.com/brendangregg/FlameGraph/blob/master/flamegraph.pl#L1022-L1023

from flamegraph.

brendangregg avatar brendangregg commented on August 24, 2024

I just pushed the patch earlier (thanks), and this is hopefully fixed.

I also added a new test file, test/perf-js-stacks-01.txt, and the corresponding test/results files, which are checked by the test.sh program. This new test file has many <> chars in.

If you have some rust or C++ profile output in particular that should behave, it would be good to add sample output (you may need to redact it) in a similar way under test/. It can be just a few stacks (like the one I just added).

Eg, to fix the "(anonymous namespace)::" issue it's going to be helpful to have a variety of output in test/ so we can check what regexp is going to work...

from flamegraph.

Yamakaky avatar Yamakaky commented on August 24, 2024

I have a rust example. What do you want exactly? perf.data + output svg?

from flamegraph.

brendangregg avatar brendangregg commented on August 24, 2024

Just the "perf script" output, and you can edit/truncate it down as much as you like. See under test/ -- some are the full output (including header), some are just a couple of stacks. You can also just create a new ticket with "rust example" and paste the "perf script" output in and I'll add it to tests. thanks!

from flamegraph.

Yamakaky avatar Yamakaky commented on August 24, 2024

in a PR?

from flamegraph.

brendangregg avatar brendangregg commented on August 24, 2024

either a PR or just pasted in a ticket is fine

from flamegraph.

Yamakaky avatar Yamakaky commented on August 24, 2024

Just did #109

from flamegraph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.