Search Shortcut cmd + k | ctrl + k
quack_flamegraph

Query Brendan Gregg folded CPU/allocation profiles as DuckDB tables

Maintainer(s): kevintruong

Installing and Loading

INSTALL quack_flamegraph FROM community;
LOAD quack_flamegraph;

Example

INSTALL quack_flamegraph FROM community;
LOAD quack_flamegraph;

-- Hottest self time
SELECT leaf, exclusive
FROM flamegraph_exclusive('cpu.folded')
ORDER BY exclusive DESC
LIMIT 10;

-- Sample coverage (inclusive)
SELECT frame, inclusive
FROM flamegraph_inclusive('cpu.folded')
ORDER BY inclusive DESC
LIMIT 10;

-- Raw stacks
SELECT list_extract(frames, -1) AS leaf, samples
FROM read_folded('cpu.folded')
ORDER BY samples DESC
LIMIT 10;

About quack_flamegraph

quack_flamegraph reads folded stack files produced by stackcollapse-*, perf --folded, samply/xctrace collapse, and similar tools.

Functions

  • read_folded(path) — table function returning frames VARCHAR[], samples BIGINT, source VARCHAR
  • flamegraph_exclusive(path) — leaf self-time (GROUP BY last frame)
  • flamegraph_inclusive(path)unnest(frames) (recursive names inflate)
  • flamegraph_coverage(path) — unique-stack sample presence (list_distinct)
  • flamegraph_edges(path) — parent→child sample mass
  • flamegraph_hot_stacks(path) — stacks ordered for concentration checks

The parser drops zero-sample parent frames (common in Instruments/sample collapse), takes the last space-separated field as the count, and strips an optional Thread_…: prefix.

Built with DuckDB's Rust C Extension API template.

Added Functions

function_name function_type description comment examples
flamegraph_coverage table_macro NULL NULL  
flamegraph_edges table_macro NULL NULL  
flamegraph_exclusive table_macro NULL NULL  
flamegraph_hot_stacks table_macro NULL NULL  
flamegraph_inclusive table_macro NULL NULL  
read_folded table NULL NULL  

Overloaded Functions

This extension does not add any function overloads.

Added Types

This extension does not add any types.

Added Settings

This extension does not add any settings.