Blog

formatting moarvm's profiler result in CLI

moarvm outputs profiler result as HTML. It's too heavy to display for large programs. But it can output json too.

I wrote a command line tool to display inclusive/exclusive time.

here is a code: https://github.com/tokuhirom/p6-HTTP-Server-Tiny/blob/master/author/moar-profiler-cli.pl

sample output is here:

42329399        <anon>  gen/moar/m-BOOTSTRAP.nqp        2734
42326077        CALL-ME lib/NativeCall.pm       219
41899557        accept  /home/tokuhirom/.rakudobrew/moar-nom/install/share/perl6/site/lib/Raw/Socket/INET.pm6       136
41836327        p6_socket_accept        native library  -2
39888308        <anon>  /home/tokuhirom/dev/p6-HTTP-Server-Tiny/lib/HTTP/Server/Tiny.pm6        62
2080758 handler /home/tokuhirom/dev/p6-HTTP-Server-Tiny/lib/HTTP/Server/Tiny.pm6        147
2070563 <anon>  /home/tokuhirom/dev/p6-HTTP-Server-Tiny/lib/HTTP/Server/Tiny.pm6        154
1870526 parse-http-request      /home/tokuhirom/dev/p6-HTTP-Server-Tiny/lib/HTTP/Server/Tiny.pm6   238
852769  infix:<ne>      gen/moar/m-CORE.setting 7922
838721  infix:<eq>      gen/moar/m-CORE.setting 7918
733063  sink    gen/moar/m-CORE.setting 10186
729940  sink-all        gen/moar/m-CORE.setting 2806
589297  <anon>  /home/tokuhirom/dev/p6-HTTP-Server-Tiny/lib/HTTP/Server/Tiny.pm6        246
495481  match   gen/moar/m-CORE.setting 8369
473728  list    gen/moar/m-CORE.setting 7536
438270  <anon>  lib/NativeCall.pm       220
417899  ASSIGN-POS      gen/moar/m-CORE.setting 13204
414589  guess_library_name      lib/NativeCall.pm       157
408443  library /home/tokuhirom/.rakudobrew/moar-nom/install/share/perl6/site/lib/Raw/Socket/INET.pm6       9
366499  <anon>  /home/tokuhirom/.rakudobrew/moar-nom/install/share/perl6/site/lib/Raw/Socket/INET.pm6       12
365713  <anon>  /home/tokuhirom/.rakudobrew/moar-nom/install/share/perl6/site/lib/Raw/Socket/INET.pm6       13
328924  infix:<eq>      gen/moar/m-CORE.setting 1713
328914  <anon>  /home/tokuhirom/dev/p6-HTTP-Server-Tiny/lib/HTTP/Server/Tiny.pm6        269
312313  Stringy gen/moar/m-CORE.setting 1264
299129  r       gen/moar/m-CORE.setting 21928
294579  subst-mutate    gen/moar/m-CORE.setting 5729
274877  Str     gen/moar/m-CORE.setting 11385
265843  ASSIGN-POS-SLOWPATH     gen/moar/m-CORE.setting 13225
260310  join    gen/moar/m-CORE.setting 11938
250136  e       gen/moar/m-CORE.setting 21905