www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - pprof DLang needs?

reply zoujiaqing <zoujiaqing gmail.com> writes:
PHP use xhprof analysis performance
Golang use pprof analysis performance
Rust use pprof-rs analysis performance
D language also needs a tool like this.

[0] https://github.com/google/pprof
[1] https://github.com/facebook/xhprof
[2] https://docs.rs/pprof/0.3.16/pprof
Apr 19
next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On Monday, 20 April 2020 at 01:59:31 UTC, zoujiaqing wrote:
 PHP use xhprof analysis performance
 Golang use pprof analysis performance
 Rust use pprof-rs analysis performance
 D language also needs a tool like this.

 [0] https://github.com/google/pprof
 [1] https://github.com/facebook/xhprof
 [2] https://docs.rs/pprof/0.3.16/pprof
Vladimir had a D memory profiler implemented a while ago: https://github.com/CyberShadow/Diamond I'm not sure if it still compiles though.
Apr 19
prev sibling next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2020-04-20 03:59, zoujiaqing wrote:
 PHP use xhprof analysis performance
 Golang use pprof analysis performance
 Rust use pprof-rs analysis performance
 D language also needs a tool like this.
 
 [0] https://github.com/google/pprof
 [1] https://github.com/facebook/xhprof
 [2] https://docs.rs/pprof/0.3.16/pprof
DMD has the `-profile` flag. D programs should work in profilers for C/C++ as well. -- /Jacob Carlborg
Apr 20
parent zoujiaqing <zoujiaqing gmail.com> writes:
On Monday, 20 April 2020 at 07:49:33 UTC, Jacob Carlborg wrote:
 On 2020-04-20 03:59, zoujiaqing wrote:
 PHP use xhprof analysis performance
 Golang use pprof analysis performance
 Rust use pprof-rs analysis performance
 D language also needs a tool like this.
 
 [0] https://github.com/google/pprof
 [1] https://github.com/facebook/xhprof
 [2] https://docs.rs/pprof/0.3.16/pprof
DMD has the `-profile` flag. D programs should work in profilers for C/C++ as well.
Thanks Jacob, I know `dub build --build=profile`, but many projects can't be used. zoujiaqing osx:~/projects/hunt-net/examples/echo
 dub build --build=profile                                       
                                      master [3dbfc4a]
Performing "profile" build using /Library/D/dmd/bin/dmd for x86_64. hunt 1.4.9: building configuration "library"... /Library/D/dmd/src/phobos/std/concurrency.d(2053,17): Warning: statement is not reachable /Library/D/dmd/bin/dmd failed with exit code 1.
Apr 20
prev sibling parent reply welkam <wwwelkam gmail.com> writes:
I use perf:
perf record -g <program_name>
then
perf report -g 'graph,0.5,caller'

And for memory usage I use heaptrack. The new tool you propose 
needs to bring something new to be worth using over the others 
and I dont think rewriting tools that already exist is worth it. 
Better improve existing ones. The only thing my mentioned tools 
are missing is D symbol demangling.
Apr 20
next sibling parent reply zoujiaqing <zoujiaqing gmail.com> writes:
On Monday, 20 April 2020 at 08:28:43 UTC, welkam wrote:
 I use perf:
 perf record -g <program_name>
 then
 perf report -g 'graph,0.5,caller'

 And for memory usage I use heaptrack. The new tool you propose 
 needs to bring something new to be worth using over the others 
 and I dont think rewriting tools that already exist is worth 
 it. Better improve existing ones. The only thing my mentioned 
 tools are missing is D symbol demangling.
Thanks, I will be try :)
Apr 20
parent welkam <wwwelkam gmail.com> writes:
On Monday, 20 April 2020 at 11:11:22 UTC, zoujiaqing wrote:
 On Monday, 20 April 2020 at 08:28:43 UTC, welkam wrote:
 I use perf:
 perf record -g <program_name>
 then
 perf report -g 'graph,0.5,caller'

 And for memory usage I use heaptrack. The new tool you propose 
 needs to bring something new to be worth using over the others 
 and I dont think rewriting tools that already exist is worth 
 it. Better improve existing ones. The only thing my mentioned 
 tools are missing is D symbol demangling.
Thanks, I will be try :)
Tools that work with C programs also work with D programs. Also it would be nice to know what kind of information are you looking for. If you want to know what functions consume what time then there are plenty of tools. If you want to profile mutexes then it might be hard to do that with available tools. Just saying that D needs profiling tool is not enough to get to executable plan
Apr 20
prev sibling parent reply Tim <tim.dlang t-online.de> writes:
On Monday, 20 April 2020 at 08:28:43 UTC, welkam wrote:
 And for memory usage I use heaptrack. The new tool you propose 
 needs to bring something new to be worth using over the others 
 and I dont think rewriting tools that already exist is worth 
 it. Better improve existing ones. The only thing my mentioned 
 tools are missing is D symbol demangling.
heaptrack looks interesting. Unfortunately it only found allocations with malloc for me. Is there an option or a fork, which also tracks allocations on the D heap?
Apr 20
parent reply welkam <wwwelkam gmail.com> writes:
On Monday, 20 April 2020 at 17:30:11 UTC, Tim wrote:
 allocations on the D heap?
Whats that? You mean GC heap? I tried that tool on DMD and it found its custom allocator so it did all the things I needed it for. But yeah for better support you would need to modify the source and since its written in C++ I dont think I will touch it.
Apr 20
next sibling parent reply Eduard Staniloiu <edi33416 gmail.com> writes:
On Monday, 20 April 2020 at 21:22:37 UTC, welkam wrote:
 On Monday, 20 April 2020 at 17:30:11 UTC, Tim wrote:
 allocations on the D heap?
Whats that? You mean GC heap? I tried that tool on DMD and it found its custom allocator so it did all the things I needed it for. But yeah for better support you would need to modify the source and since its written in C++ I dont think I will touch it.
I just want to add that valgrind works really well with D. You can use massif to profile the heap allocations [0]. [0] - https://www.valgrind.org/docs/manual/ms-manual.html
Apr 21
parent zoujiaqing <zoujiaqing gmail.com> writes:
On Tuesday, 21 April 2020 at 20:17:37 UTC, Eduard Staniloiu wrote:
 On Monday, 20 April 2020 at 21:22:37 UTC, welkam wrote:
 On Monday, 20 April 2020 at 17:30:11 UTC, Tim wrote:
 allocations on the D heap?
Whats that? You mean GC heap? I tried that tool on DMD and it found its custom allocator so it did all the things I needed it for. But yeah for better support you would need to modify the source and since its written in C++ I dont think I will touch it.
I just want to add that valgrind works really well with D. You can use massif to profile the heap allocations [0]. [0] - https://www.valgrind.org/docs/manual/ms-manual.html
Thanks!
Apr 23
prev sibling parent Tim <tim.dlang t-online.de> writes:
On Monday, 20 April 2020 at 21:22:37 UTC, welkam wrote:
 On Monday, 20 April 2020 at 17:30:11 UTC, Tim wrote:
 allocations on the D heap?
Whats that? You mean GC heap? I tried that tool on DMD and it found its custom allocator so it did all the things I needed it for. But yeah for better support you would need to modify the source and since its written in C++ I dont think I will touch it.
I have modified heaptrack to also track allocations on the D GC heap: https://github.com/tim-dlang/heaptrack/tree/heaptrack-d When using it, druntime has to be linked dynamically. It also only works, when the application is launched by heaptrack, and not, when heaptrack is attached later. The modified heaptrack will now only work with D applications.
May 03