Generate a flamegraph SVG using inferno-flamegraph.
(folded_stacks, output_path, title)
| 444 | |
| 445 | |
| 446 | def generate_flamegraph(folded_stacks, output_path, title): |
| 447 | """Generate a flamegraph SVG using inferno-flamegraph.""" |
| 448 | if not folded_stacks.strip(): |
| 449 | return False |
| 450 | |
| 451 | svg = run( |
| 452 | [ |
| 453 | "inferno-flamegraph", |
| 454 | "--title", title, |
| 455 | "--countname", "bytes", |
| 456 | "--nametype", "Item:", |
| 457 | ], |
| 458 | input=folded_stacks, |
| 459 | ) |
| 460 | output_path.write_text(svg) |
| 461 | return True |
| 462 | |
| 463 | |
| 464 | # --------------------------------------------------------------------------- |
no test coverage detected