Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
February 26, 2020 Linux perf demangle D symbols | ||||
---|---|---|---|---|
| ||||
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. |
February 26, 2020 Re: Linux perf demangle D symbols | ||||
---|---|---|---|---|
| ||||
Posted in reply to Arun Chandrasekaran | 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
|
February 26, 2020 Re: Linux perf demangle D symbols | ||||
---|---|---|---|---|
| ||||
Posted in reply to Arun Chandrasekaran | 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 |
February 26, 2020 Re: Linux perf demangle D symbols | ||||
---|---|---|---|---|
| ||||
Posted in reply to Arun Chandrasekaran | 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?
|
February 26, 2020 Re: Linux perf demangle D symbols | ||||
---|---|---|---|---|
| ||||
Posted in reply to Arun Chandrasekaran | 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 |
February 29, 2020 Re: Linux perf demangle D symbols | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alex Burton | 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:
>> [...]
>
> This is my sh script for performance monitoring on debian buster using Brendan Greggs flamegraph:
>
> [...]
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.
|
Copyright © 1999-2021 by the D Language Foundation