Skip to content

🎨将xhprof产生的数据转为可以生成flame graph火焰图的格式并生成火焰图

License

Notifications You must be signed in to change notification settings

sy-records/xhprof2flamegraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

xhprof2flamegraph

🎨将xhprof产生的数据转为可以生成flame graph火焰图的格式并生成火焰图

安装

composer require sy-records/xhprof2flamegraph

使用

vendor/bin目录下有两个可执行文件,执行命令

./vendor/bin/xhprof2flamegraph -f ./test.xhprof | ./vendor/bin/flamegraph.pl > out.svg

替换对应的路径信息

-f 为指定的xhprof日志文件,json格式 (如果日志文件为serialize序列化后的数据,请修改src/Command/Command.php文件中的第40行),自动处理jsonserialize格式的数据

帮助

  • xhprof2flamegraph -h
         _                               __   ____     __ 
 __  __ | |__    _ __    _ __    ___    / _| |___ \   / _|
 \ \/ / | '_ \  | '_ \  | '__|  / _ \  | |_    __) | | |_ 
  >  <  | | | | | |_) | | |    | (_) | |  _|  / __/  |  _|
 /_/\_\ |_| |_| | .__/  |_|     \___/  |_|   |_____| |_|  
                |_|                                       
                
Usage:
    xhprof2flamegraph [-h, --help] [-f, --profile] [--metrics] 
Options:
    -h, --help      show help
    -f, --profile   file path of xhprof profile data
    --metrics       select target metrics (ect/ewt/ecpu/emu/epmu) 
  • flamegraph.pl -help
USAGE: ./flamegraph.pl [options] infile > outfile.svg

        --title TEXT     # change title text
        --subtitle TEXT  # second level title (optional)
        --width NUM      # width of image (default 1200)
        --height NUM     # height of each frame (default 16)
        --minwidth NUM   # omit smaller functions (default 0.1 pixels)
        --fonttype FONT  # font type (default "Verdana")
        --fontsize NUM   # font size (default 12)
        --countname TEXT # count type label (default "samples")
        --nametype TEXT  # name type label (default "Function:")
        --colors PALETTE # set color palette. choices are: hot (default), mem,
                         # io, wakeup, chain, java, js, perl, red, green, blue,
                         # aqua, yellow, purple, orange
        --hash           # colors are keyed by function name hash
        --cp             # use consistent palette (palette.map)
        --reverse        # generate stack-reversed flame graph
        --inverted       # icicle graph
        --negate         # switch differential hues (blue<->red)
        --notes TEXT     # add notes comment in SVG (for debugging)
        --help           # this message

        eg,
        ./flamegraph.pl --title="Flame Graph: malloc()" trace.txt > graph.svg

About

🎨将xhprof产生的数据转为可以生成flame graph火焰图的格式并生成火焰图

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages