digitalmars.D - Linux perf demangle D symbols
- Arun Chandrasekaran (3/3) Feb 25 2020 Does anyone use Linux perf here, with D symbols demangled?
- Sebastiaan Koppe (3/6) Feb 26 2020 I vaguely remember using ddemangle
- drug (9/12) Feb 26 2020 If you use `perf report` then that currently is impossible I guess. But
- Mathias Lang (17/20) Feb 26 2020 For the non interactive version, you can just use `perf report |
- Alex Burton (49/52) Feb 26 2020 This is my sh script for performance monitoring on debian buster
- Arun Chandrasekaran (5/11) Feb 29 2020 These work-arounds work to some extent, but gets in the way too
Does anyone use Linux perf here, with D symbols demangled? I'm on Ubuntu 19.10, but I can't get perf to demangle the D symbols.
Feb 25 2020
On Wednesday, 26 February 2020 at 07:20:03 UTC, Arun Chandrasekaran wrote:Does anyone use Linux perf here, with D symbols demangled? I'm on Ubuntu 19.10, but I can't get perf to demangle the D symbols.I vaguely remember using ddemangle
Feb 26 2020
On 2/26/20 10:20 AM, Arun Chandrasekaran wrote:Does anyone use Linux perf here, with D symbols demangled? I'm on Ubuntu 19.10, but I can't get perf to demangle the D symbols.If you use `perf report` then that currently is impossible I guess. But if you use flamegraph for example then ddemangle can help here: ``` git clone https://github.com/brendangregg/FlameGraph.git perf script | FlameGraph/stackcollapse-perf.pl | FlameGraph/flamegraph.pl | ddemangle > perf.svg ``` but some symbols remain mangled
Feb 26 2020
On Wednesday, 26 February 2020 at 07:20:03 UTC, Arun Chandrasekaran wrote:Does anyone use Linux perf here, with D symbols demangled? I'm on Ubuntu 19.10, but I can't get perf to demangle the D symbols.For the non interactive version, you can just use `perf report | ddemangle` As for the interactive version, I don't know. Other coreutils tools have a `--demangle=dlang` option (e.g. `nm`), but perf only have `--demangle` to prevent demangling of symbols: ``` --demangle Disable symbol demangling --demangle-kernel Enable kernel symbol demangling ``` There's also an `objdump` option which you can set to a shell script that does `objdump --demangle=dlang $*` so you get symbols demangled in the disassembled code, but for the main interface, there doesn't seem to be a way to do it interactively. Perhaps raise the issue upstream?
Feb 26 2020
On Wednesday, 26 February 2020 at 07:20:03 UTC, Arun Chandrasekaran wrote:Does anyone use Linux perf here, with D symbols demangled? I'm on Ubuntu 19.10, but I can't get perf to demangle the D symbols.This is my sh script for performance monitoring on debian buster using Brendan Greggs flamegraph: sudo perf record -F 99 -a --call-graph dwarf -- sleep 10 #sudo perf record -F 99 --call-graph dwarf -p 31984 sudo perf script > tree.perf ~/dev/FlameGraph/stackcollapse-perf.pl tree.perf > tree.folded ~/dev/FlameGraph/flamegraph.pl tree.folded > tree_.svg cat tree_.svg | ./dfilt > tree.svg firefox tree.svg This is the source code in dfilt: import std.ascii : isAlphaNum; import std.algorithm; import std.range; import std.conv : to; import std.demangle : demangle; import std.functional : pipe; import std.stdio; string translateSymbol(string s) { if (s[0..2] == "_D") { auto result = demangle(s); writefln("%s => %s",s,result); } return s; } string translateGroup(U)(U group) { if ((group[0])) return demangle(group[1].to!string); else return group[1].to!string; } auto translateLine(string l) { return l.chunkBy!(a => isAlphaNum(a) || a == '_').map!translateGroup.joiner; } void main() { auto result = stdin.byLineCopy .map!translateLine .joiner("\n").array; result.copy(stdout.lockingTextWriter); } Hope this helps
Feb 26 2020
On Wednesday, 26 February 2020 at 13:21:42 UTC, Alex Burton wrote:On Wednesday, 26 February 2020 at 07:20:03 UTC, Arun Chandrasekaran wrote:These work-arounds work to some extent, but gets in the way too often as (I'm just lazy). I will see if I can check with upstream to include ddemangle. Thanks everyone.[...]This is my sh script for performance monitoring on debian buster using Brendan Greggs flamegraph: [...]
Feb 29 2020