Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 784 Bytes

cprofiler_flamegraph.md

File metadata and controls

17 lines (11 loc) · 784 Bytes

Requirements

CProfilerFlameGraph depends on snakeviz to render flamegraph as html file. Main snakeviz repo requires renders flamegraph by launching webserver and rendering html through that. On some enviornments you want to just get a statically renderable html that can be shared. Snakeviz's author provides utility for this at https://gist.github.com./jiffyclub/6b5e0f0f05ab487ff607. This util just combined the patch from gist and added a util that does not need to launch server.

Installation

pip install snakeviz

Usage

    from util.python_profiler import CProfilerFlameGraph
    with CProfilerFlameGraph("my_profiler.html"):
        prog = export_to_exec_prog(model, example_inputs)

You should see my_profiler.html generted in the working directory.