Perf
Decode Linux perf.data captures into SQL tables of samples, memory mappings, and event metadata for bulk profile analysis
- Connector software
- Free and open source
- Service credentials
- Not needed
- Query Farm hosting
- Available · $10/month organization minimum
Use with an agent
Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.
npx skills add Query-farm/vgi-skills --skill orchard
Copy this request into your coding agent to get started.
Use https://query.farm/products/orchard/connectors/perf/index.md to help me query Perf with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.
Find the files consuming the most CPU samples
Replace /data/perf.data with the path to a perf recording on the machine running the connector.
SELECT m.filename, count(*) AS hits
FROM perf.main.samples('/data/perf.data') s
JOIN perf.main.mmaps('/data/perf.data') m ON s.pid = m.pid AND s.ip >= m.addr AND s.ip < m.addr + m.len
GROUP BY m.filename
ORDER BY hits DESC, m.filename
Quick start
Choose where to run Perf, then follow the steps below.
The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.
1. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
2. Attach the connector
Attach the release directly
Downloads the latest release for your platform and caches it locally.
ATTACH 'perf' AS perf (
TYPE vgi,
LOCATION 'github-auto://Query-farm/vgi-perf'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'perf' AS perf (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-perf:0.5.0'
);
3. Run a query
SELECT m.filename, count(*) AS hits
FROM perf.main.samples('/data/perf.data') s
JOIN perf.main.mmaps('/data/perf.data') m ON s.pid = m.pid AND s.ip >= m.addr AND s.ip < m.addr + m.len
GROUP BY m.filename
ORDER BY hits DESC, m.filename
Run the connector on a server you manage. You operate the service and choose who can connect.
1. Deploy the connector on your server
Follow the connector’s deployment instructions. Use its supported HTTP transport, or launch it remotely over SSH. The connection guide explains both options.
2. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach the connector
For an HTTP deployment, replace the example URL with your endpoint. Add the authentication options your deployment requires. For SSH, use the SSH connection instructions.
ATTACH 'perf' AS perf
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
SELECT m.filename, count(*) AS hits
FROM perf.main.samples('/data/perf.data') s
JOIN perf.main.mmaps('/data/perf.data') m ON s.pid = m.pid AND s.ip >= m.addr AND s.ip < m.addr + m.len
GROUP BY m.filename
ORDER BY hits DESC, m.filename
Query Farm operates Perf for your team. Hosting has a $10 monthly minimum per organization; usage counts toward it. From $2.97 per instance-month ($10 monthly minimum).
1. Create your hosted connector
Open the console, choose your organization and deployment size, and add any service credentials there.
2. Install the vgi extension
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach your deployment
Copy the ATTACH statement from your deployment in the console and run it in DuckDB or Haybarn. Use perf as the catalog alias for the query below.
4. Run a query
SELECT m.filename, count(*) AS hits
FROM perf.main.samples('/data/perf.data') s
JOIN perf.main.mmaps('/data/perf.data') m ON s.pid = m.pid AND s.ip >= m.addr AND s.ip < m.addr + m.len
GROUP BY m.filename
ORDER BY hits DESC, m.filename
Technical details
- Verified connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
- Verified on
- December 1, 2026
Pin a version for production
When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.
Attach the release directly
Uses the verified release each time you attach the connector.
ATTACH 'perf' AS perf (
TYPE vgi,
LOCATION 'github-auto://Query-farm/[email protected]'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'perf' AS perf (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-perf:0.5.0'
);
Overview
Decode the Linux perf.data binary profiling format into SQL tables: samples (with raw call chains), memory mappings (with build-ids), comm records, event attributes, and capture metadata.
Load a fleet of Linux perf.data captures and analyze them relationally in DuckDB. perf script and perf report are interactive, single-file CLIs; this worker turns the binary perf.data format into ordinary SQL tables so SRE and observability teams can run CI performance-regression gates and bulk profile analysis — diffing captures, ranking hot instruction pointers, and joining samples to the modules they fell in — without leaving SQL.
Attach the worker, then point search_path at its schema:
ATTACH 'perf' (TYPE vgi, LOCATION '/path/to/perf-worker');
SET search_path = 'perf.main';You then call a decode function with a perf.data path (or the raw capture bytes) and analyze the rows in ordinary SQL. The marquee move is an address-range join of each sample's raw ip to the memory mapping it fell in, ranking the hottest modules — that query, and others, are shipped ready-to-run in this worker's example queries and per-function documentation. Browse the perf.main.functions reference table to see every function and the columns it returns before you have a capture in hand.
What you get. Each decode function takes one source argument — a path to a perf.data file, or the raw capture bytes already loaded into a column — and streams the decoded records out as ordinary typed rows. The profiling samples (with their raw call chains), the process address-space mappings, the recorded event attributes, the process/thread names, and the capture-wide host metadata are each a separate function. Ranges, IDs, and timestamps come through as real integer columns so they join and aggregate directly in SQL.
Raw IPs, by design. Instruction pointers and call-chain frames are emitted unsymbolicated. The mmaps records — with their build_ids — are what make a raw ip interpretable: range-join samples.ip >= m.addr AND samples.ip < m.addr + m.len (mappings are half-open) to find the backing DSO, then feed build_id + the IP to vgi-symbols for native symbolication, mirroring the pprof / minidump → symbols loop. Collapsed-stack text files throw the mmap + build-id information away; the binary perf.data path keeps it.
Scope. v1 decodes the binary perf.data record structure only. The folded/collapsed-stack text path is intentionally out of scope (DuckDB's read_csv already covers it), as is symbolication (→ vgi-symbols) and perf.data writing. perf.data varies by kernel and perf build; any HEADER_* feature section a capture omits comes back as NULL columns rather than failing the query.
Sources and references
- perf.data file format — the kernel's specification of the header, feature sections and records decoded here
- perf-record(1) — how captures are recorded (
-gfor call chains,--build-id) - perf wiki — the Linux
perftool and its tutorials - linux-perf-data — the Rust parser library this worker decodes with
Catalog
Everything perf exposes once attached — read straight from the worker's
released build.
main 1 view · 5 functions
perf.data decode functions: samples, mmaps, comms, events, meta.
Schema examples (8)
Read the capture-wide metadata (one row).
SELECT hostname, arch, nrcpus, perf_version, cmdline, total_events
FROM perf.main.meta('/data/perf.data');
List the events the capture sampled and how.
SELECT name, type, sample_period, sample_freq
FROM perf.main.events('/data/perf.data')
ORDER BY name;
The first ten samples with their raw call chains.
SELECT time, pid, ip, callchain
FROM perf.main.samples('/data/perf.data')
ORDER BY time
LIMIT 10;
Every mapped DSO and its build-id (the vgi-symbols input).
SELECT filename, build_id
FROM perf.main.mmaps('/data/perf.data')
WHERE build_id IS NOT NULL
ORDER BY filename;
4 more examples
Hottest mapped files: sample ips range-joined to mmaps.
SELECT m.filename, count(*) AS hits
FROM perf.main.samples('/data/perf.data') s
JOIN perf.main.mmaps('/data/perf.data') m ON s.pid = m.pid AND s.ip >= m.addr AND s.ip < m.addr + m.len
GROUP BY m.filename
ORDER BY hits DESC, m.filename;
Hot mapped files per process name: samples range-joined to mmaps, labelled with each pid's latest command name from comms (exec renames keep the newest), with hits and total sample period.
WITH names AS (SELECT pid, arg_max(comm, coalesce(time, 0)) AS comm FROM perf.main.comms('/data/perf.data') GROUP BY pid) SELECT n.comm, m.filename, count(*) AS hits, sum(s.period) AS total_period
FROM perf.main.samples('/data/perf.data') s
JOIN perf.main.mmaps('/data/perf.data') m ON s.pid = m.pid AND s.ip >= m.addr AND s.ip < m.addr + m.len
LEFT JOIN names n ON n.pid = s.pid
GROUP BY n.comm, m.filename
ORDER BY hits DESC, m.filename;
Self vs inclusive samples per mapped file: unnest every call-chain frame, range-join it to mmaps, and count samples whose leaf ip is in the file (self) vs samples with any frame in it (inclusive).
WITH s AS (SELECT row_number() OVER () AS sample_id, pid, ip, callchain FROM perf.main.samples('/data/perf.data') WHERE callchain IS NOT NULL), frames AS (SELECT sample_id, pid, ip, unnest(callchain) AS frame FROM s) SELECT m.filename, count(DISTINCT f.sample_id) FILTER (WHERE f.frame = f.ip) AS self_samples, count(DISTINCT f.sample_id) AS inclusive_samples
FROM frames f
JOIN perf.main.mmaps('/data/perf.data') m ON f.pid = m.pid AND f.frame >= m.addr AND f.frame < m.addr + m.len
GROUP BY m.filename
ORDER BY inclusive_samples DESC, m.filename;
Symbolication input for vgi-symbols: each sampled ip's DSO build-id and file offset (ip - addr + pgoff), with hit counts.
SELECT m.filename, m.build_id, s.ip - m.addr + m.pgoff AS file_offset,
count(*) AS hits
FROM perf.main.samples('/data/perf.data') s
JOIN perf.main.mmaps('/data/perf.data') m ON s.pid = m.pid AND s.ip >= m.addr AND s.ip < m.addr + m.len
WHERE m.build_id IS NOT NULL
GROUP BY m.filename, m.build_id, file_offset
ORDER BY hits DESC, m.filename, file_offset;
functions
Browsable reference of the perf worker's decode functions — one row per object, with the columns it returns. Browse it to discover the surface before decoding a capture.
List the decode table functions and the columns each one returns.
SELECT object_name, result_columns
FROM perf.main.functions
WHERE object_kind = 'table function'
ORDER BY object_name;
comms (src ANY)
Decode perf.data process/thread name (COMM) records into rows
The distinct process/thread names in a capture, one row per pid — the lookup that turns a numeric pid from `samples` into a human-readable command.
SELECT DISTINCT pid, comm
FROM perf.main.comms(from_hex('50455246494c45326800000000000000400000000000000068000000000000004000000000000000a800000000000000a00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000a00f000000000000a70100000000000000000000000000000000000000000000000000000000000000000000000000000300000002001800d2040000d20400006c6f6f70000000000a00000002405800d2040000d204000000004000000000000010000000000000000000000000000014000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000002f7573722f62696e2f6c6f6f700000000a00000002406000d2040000d204000000000000007f00000000200000000000000000000000000014000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000002f7573722f6c69622f6c6962632e736f2e3600000000000009000000020048000001400000000000d2040000d2040000e8030000000000000200000000000000a00f000000000000020000000000000000014000000000005000400000000000090000000200480000010000007f0000d2040000d2040000d0070000000000000200000000000000a00f000000000000020000000000000000010000007f0000000140000000000009000000020040000001400000000000d2040000d2040000b80b0000000000000300000000000000a00f00000000000001000000000000000001400000000000'))
ORDER BY pid;
Hot mapped files per process name: samples range-joined to mmaps, labelled with each pid's latest command name from comms (exec renames keep the newest), with hits and total sample period.
WITH names AS (SELECT pid, arg_max(comm, coalesce(time, 0)) AS comm FROM perf.main.comms(from_hex('50455246494c45326800000000000000400000000000000068000000000000004000000000000000a800000000000000a00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000a00f000000000000a70100000000000000000000000000000000000000000000000000000000000000000000000000000300000002001800d2040000d20400006c6f6f70000000000a00000002405800d2040000d204000000004000000000000010000000000000000000000000000014000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000002f7573722f62696e2f6c6f6f700000000a00000002406000d2040000d204000000000000007f00000000200000000000000000000000000014000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000002f7573722f6c69622f6c6962632e736f2e3600000000000009000000020048000001400000000000d2040000d2040000e8030000000000000200000000000000a00f000000000000020000000000000000014000000000005000400000000000090000000200480000010000007f0000d2040000d2040000d0070000000000000200000000000000a00f000000000000020000000000000000010000007f0000000140000000000009000000020040000001400000000000d2040000d2040000b80b0000000000000300000000000000a00f00000000000001000000000000000001400000000000')) GROUP BY pid) SELECT n.comm, m.filename, count(*) AS hits, sum(s.period) AS total_period
FROM perf.main.samples(from_hex('50455246494c45326800000000000000400000000000000068000000000000004000000000000000a800000000000000a00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000a00f000000000000a70100000000000000000000000000000000000000000000000000000000000000000000000000000300000002001800d2040000d20400006c6f6f70000000000a00000002405800d2040000d204000000004000000000000010000000000000000000000000000014000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000002f7573722f62696e2f6c6f6f700000000a00000002406000d2040000d204000000000000007f00000000200000000000000000000000000014000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000002f7573722f6c69622f6c6962632e736f2e3600000000000009000000020048000001400000000000d2040000d2040000e8030000000000000200000000000000a00f000000000000020000000000000000014000000000005000400000000000090000000200480000010000007f0000d2040000d2040000d0070000000000000200000000000000a00f000000000000020000000000000000010000007f0000000140000000000009000000020040000001400000000000d2040000d2040000b80b0000000000000300000000000000a00f00000000000001000000000000000001400000000000')) s
JOIN perf.main.mmaps(from_hex('50455246494c45326800000000000000400000000000000068000000000000004000000000000000a800000000000000a00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000a00f000000000000a70100000000000000000000000000000000000000000000000000000000000000000000000000000300000002001800d2040000d20400006c6f6f70000000000a00000002405800d2040000d204000000004000000000000010000000000000000000000000000014000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000002f7573722f62696e2f6c6f6f700000000a00000002406000d2040000d204000000000000007f00000000200000000000000000000000000014000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000002f7573722f6c69622f6c6962632e736f2e3600000000000009000000020048000001400000000000d2040000d2040000e8030000000000000200000000000000a00f000000000000020000000000000000014000000000005000400000000000090000000200480000010000007f0000d2040000d2040000d0070000000000000200000000000000a00f000000000000020000000000000000010000007f0000000140000000000009000000020040000001400000000000d2040000d2040000b80b0000000000000300000000000000a00f00000000000001000000000000000001400000000000')) m ON s.pid = m.pid AND s.ip >= m.addr AND s.ip < m.addr + m.len
LEFT JOIN names n ON n.pid = s.pid
GROUP BY n.comm, m.filename
ORDER BY hits DESC, m.filename;
events (src ANY)
Decode perf.data event attributes (name, type, sampling policy) into rows
The events a capture sampled, with each event's kind and its fixed sampling period (or target frequency).
SELECT name, type, sample_period, sample_freq
FROM perf.main.events(from_hex('50455246494c45326800000000000000400000000000000068000000000000004000000000000000a800000000000000a00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000a00f000000000000a70100000000000000000000000000000000000000000000000000000000000000000000000000000300000002001800d2040000d20400006c6f6f70000000000a00000002405800d2040000d204000000004000000000000010000000000000000000000000000014000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000002f7573722f62696e2f6c6f6f700000000a00000002406000d2040000d204000000000000007f00000000200000000000000000000000000014000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000002f7573722f6c69622f6c6962632e736f2e3600000000000009000000020048000001400000000000d2040000d2040000e8030000000000000200000000000000a00f000000000000020000000000000000014000000000005000400000000000090000000200480000010000007f0000d2040000d2040000d0070000000000000200000000000000a00f000000000000020000000000000000010000007f0000000140000000000009000000020040000001400000000000d2040000d2040000b80b0000000000000300000000000000a00f00000000000001000000000000000001400000000000'))
ORDER BY name;
meta (src ANY)
Decode perf.data capture-wide metadata (host, arch, cmdline, …) into one row
Read the capture-wide metadata of a perf.data file (exactly one row): host, arch, tool version, and the total event-record count.
SELECT hostname, arch, nrcpus, perf_version, cmdline, total_events
FROM perf.main.meta(from_hex('50455246494c45326800000000000000400000000000000068000000000000004000000000000000a800000000000000a00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000a00f000000000000a70100000000000000000000000000000000000000000000000000000000000000000000000000000300000002001800d2040000d20400006c6f6f70000000000a00000002405800d2040000d204000000004000000000000010000000000000000000000000000014000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000002f7573722f62696e2f6c6f6f700000000a00000002406000d2040000d204000000000000007f00000000200000000000000000000000000014000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000002f7573722f6c69622f6c6962632e736f2e3600000000000009000000020048000001400000000000d2040000d2040000e8030000000000000200000000000000a00f000000000000020000000000000000014000000000005000400000000000090000000200480000010000007f0000d2040000d2040000d0070000000000000200000000000000a00f000000000000020000000000000000010000007f0000000140000000000009000000020040000001400000000000d2040000d2040000b80b0000000000000300000000000000a00f00000000000001000000000000000001400000000000'));
mmaps (src ANY)
Decode perf.data memory mappings (with build-ids) into rows
Mapped DSOs with a known build-id (for vgi-symbols).
SELECT filename, build_id
FROM perf.main.mmaps(from_hex('50455246494c45326800000000000000400000000000000068000000000000004000000000000000a800000000000000a00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000a00f000000000000a70100000000000000000000000000000000000000000000000000000000000000000000000000000300000002001800d2040000d20400006c6f6f70000000000a00000002405800d2040000d204000000004000000000000010000000000000000000000000000014000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000002f7573722f62696e2f6c6f6f700000000a00000002406000d2040000d204000000000000007f00000000200000000000000000000000000014000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000002f7573722f6c69622f6c6962632e736f2e3600000000000009000000020048000001400000000000d2040000d2040000e8030000000000000200000000000000a00f000000000000020000000000000000014000000000005000400000000000090000000200480000010000007f0000d2040000d2040000d0070000000000000200000000000000a00f000000000000020000000000000000010000007f0000000140000000000009000000020040000001400000000000d2040000d2040000b80b0000000000000300000000000000a00f00000000000001000000000000000001400000000000'))
WHERE build_id IS NOT NULL
ORDER BY filename;
Hottest mapped files: sample ips range-joined to mmaps.
SELECT m.filename, count(*) AS hits
FROM perf.main.samples(from_hex('50455246494c45326800000000000000400000000000000068000000000000004000000000000000a800000000000000a00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000a00f000000000000a70100000000000000000000000000000000000000000000000000000000000000000000000000000300000002001800d2040000d20400006c6f6f70000000000a00000002405800d2040000d204000000004000000000000010000000000000000000000000000014000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000002f7573722f62696e2f6c6f6f700000000a00000002406000d2040000d204000000000000007f00000000200000000000000000000000000014000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000002f7573722f6c69622f6c6962632e736f2e3600000000000009000000020048000001400000000000d2040000d2040000e8030000000000000200000000000000a00f000000000000020000000000000000014000000000005000400000000000090000000200480000010000007f0000d2040000d2040000d0070000000000000200000000000000a00f000000000000020000000000000000010000007f0000000140000000000009000000020040000001400000000000d2040000d2040000b80b0000000000000300000000000000a00f00000000000001000000000000000001400000000000')) s
JOIN perf.main.mmaps(from_hex('50455246494c45326800000000000000400000000000000068000000000000004000000000000000a800000000000000a00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000a00f000000000000a70100000000000000000000000000000000000000000000000000000000000000000000000000000300000002001800d2040000d20400006c6f6f70000000000a00000002405800d2040000d204000000004000000000000010000000000000000000000000000014000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000002f7573722f62696e2f6c6f6f700000000a00000002406000d2040000d204000000000000007f00000000200000000000000000000000000014000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000002f7573722f6c69622f6c6962632e736f2e3600000000000009000000020048000001400000000000d2040000d2040000e8030000000000000200000000000000a00f000000000000020000000000000000014000000000005000400000000000090000000200480000010000007f0000d2040000d2040000d0070000000000000200000000000000a00f000000000000020000000000000000010000007f0000000140000000000009000000020040000001400000000000d2040000d2040000b80b0000000000000300000000000000a00f00000000000001000000000000000001400000000000')) m ON s.pid = m.pid AND s.ip >= m.addr AND s.ip < m.addr + m.len
GROUP BY m.filename
ORDER BY hits DESC, m.filename;
Symbolication input for vgi-symbols: each sampled ip's DSO build-id and file offset (ip - addr + pgoff), with hit counts.
SELECT m.filename, m.build_id, s.ip - m.addr + m.pgoff AS file_offset,
count(*) AS hits
FROM perf.main.samples(from_hex('50455246494c45326800000000000000400000000000000068000000000000004000000000000000a800000000000000a00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000a00f000000000000a70100000000000000000000000000000000000000000000000000000000000000000000000000000300000002001800d2040000d20400006c6f6f70000000000a00000002405800d2040000d204000000004000000000000010000000000000000000000000000014000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000002f7573722f62696e2f6c6f6f700000000a00000002406000d2040000d204000000000000007f00000000200000000000000000000000000014000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000002f7573722f6c69622f6c6962632e736f2e3600000000000009000000020048000001400000000000d2040000d2040000e8030000000000000200000000000000a00f000000000000020000000000000000014000000000005000400000000000090000000200480000010000007f0000d2040000d2040000d0070000000000000200000000000000a00f000000000000020000000000000000010000007f0000000140000000000009000000020040000001400000000000d2040000d2040000b80b0000000000000300000000000000a00f00000000000001000000000000000001400000000000')) s
JOIN perf.main.mmaps(from_hex('50455246494c45326800000000000000400000000000000068000000000000004000000000000000a800000000000000a00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000a00f000000000000a70100000000000000000000000000000000000000000000000000000000000000000000000000000300000002001800d2040000d20400006c6f6f70000000000a00000002405800d2040000d204000000004000000000000010000000000000000000000000000014000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000002f7573722f62696e2f6c6f6f700000000a00000002406000d2040000d204000000000000007f00000000200000000000000000000000000014000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000002f7573722f6c69622f6c6962632e736f2e3600000000000009000000020048000001400000000000d2040000d2040000e8030000000000000200000000000000a00f000000000000020000000000000000014000000000005000400000000000090000000200480000010000007f0000d2040000d2040000d0070000000000000200000000000000a00f000000000000020000000000000000010000007f0000000140000000000009000000020040000001400000000000d2040000d2040000b80b0000000000000300000000000000a00f00000000000001000000000000000001400000000000')) m ON s.pid = m.pid AND s.ip >= m.addr AND s.ip < m.addr + m.len
WHERE m.build_id IS NOT NULL
GROUP BY m.filename, m.build_id, file_offset
ORDER BY hits DESC, m.filename, file_offset;
samples (src ANY)
Decode perf.data profiling samples (with raw call chains) into rows
The ten most frequent raw instruction pointers in a capture — the hottest addresses, pre-symbolication.
SELECT ip, count(*) AS hits
FROM perf.main.samples(from_hex('50455246494c45326800000000000000400000000000000068000000000000004000000000000000a800000000000000a00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000a00f000000000000a70100000000000000000000000000000000000000000000000000000000000000000000000000000300000002001800d2040000d20400006c6f6f70000000000a00000002405800d2040000d204000000004000000000000010000000000000000000000000000014000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000002f7573722f62696e2f6c6f6f700000000a00000002406000d2040000d204000000000000007f00000000200000000000000000000000000014000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000002f7573722f6c69622f6c6962632e736f2e3600000000000009000000020048000001400000000000d2040000d2040000e8030000000000000200000000000000a00f000000000000020000000000000000014000000000005000400000000000090000000200480000010000007f0000d2040000d2040000d0070000000000000200000000000000a00f000000000000020000000000000000010000007f0000000140000000000009000000020040000001400000000000d2040000d2040000b80b0000000000000300000000000000a00f00000000000001000000000000000001400000000000'))
GROUP BY ip
ORDER BY hits DESC
LIMIT 10;
The deepest call chains: each sample's leaf ip and how many frames its stack carries.
SELECT ip, length(callchain) AS depth
FROM perf.main.samples(from_hex('50455246494c45326800000000000000400000000000000068000000000000004000000000000000a800000000000000a00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000a00f000000000000a70100000000000000000000000000000000000000000000000000000000000000000000000000000300000002001800d2040000d20400006c6f6f70000000000a00000002405800d2040000d204000000004000000000000010000000000000000000000000000014000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000002f7573722f62696e2f6c6f6f700000000a00000002406000d2040000d204000000000000007f00000000200000000000000000000000000014000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000002f7573722f6c69622f6c6962632e736f2e3600000000000009000000020048000001400000000000d2040000d2040000e8030000000000000200000000000000a00f000000000000020000000000000000014000000000005000400000000000090000000200480000010000007f0000d2040000d2040000d0070000000000000200000000000000a00f000000000000020000000000000000010000007f0000000140000000000009000000020040000001400000000000d2040000d2040000b80b0000000000000300000000000000a00f00000000000001000000000000000001400000000000'))
WHERE callchain IS NOT NULL
ORDER BY depth DESC, ip
LIMIT 10;
Self vs inclusive samples per mapped file: unnest every call-chain frame, range-join it to mmaps, and count samples whose leaf ip is in the file (self) vs samples with any frame in it (inclusive).
WITH s AS (SELECT row_number() OVER () AS sample_id, pid, ip, callchain FROM perf.main.samples(from_hex('50455246494c45326800000000000000400000000000000068000000000000004000000000000000a800000000000000a00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000a00f000000000000a70100000000000000000000000000000000000000000000000000000000000000000000000000000300000002001800d2040000d20400006c6f6f70000000000a00000002405800d2040000d204000000004000000000000010000000000000000000000000000014000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000002f7573722f62696e2f6c6f6f700000000a00000002406000d2040000d204000000000000007f00000000200000000000000000000000000014000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000002f7573722f6c69622f6c6962632e736f2e3600000000000009000000020048000001400000000000d2040000d2040000e8030000000000000200000000000000a00f000000000000020000000000000000014000000000005000400000000000090000000200480000010000007f0000d2040000d2040000d0070000000000000200000000000000a00f000000000000020000000000000000010000007f0000000140000000000009000000020040000001400000000000d2040000d2040000b80b0000000000000300000000000000a00f00000000000001000000000000000001400000000000')) WHERE callchain IS NOT NULL), frames AS (SELECT sample_id, pid, ip, unnest(callchain) AS frame FROM s) SELECT m.filename, count(DISTINCT f.sample_id) FILTER (WHERE f.frame = f.ip) AS self_samples, count(DISTINCT f.sample_id) AS inclusive_samples
FROM frames f
JOIN perf.main.mmaps(from_hex('50455246494c45326800000000000000400000000000000068000000000000004000000000000000a800000000000000a00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000a00f000000000000a70100000000000000000000000000000000000000000000000000000000000000000000000000000300000002001800d2040000d20400006c6f6f70000000000a00000002405800d2040000d204000000004000000000000010000000000000000000000000000014000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000002f7573722f62696e2f6c6f6f700000000a00000002406000d2040000d204000000000000007f00000000200000000000000000000000000014000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb00000000000000002f7573722f6c69622f6c6962632e736f2e3600000000000009000000020048000001400000000000d2040000d2040000e8030000000000000200000000000000a00f000000000000020000000000000000014000000000005000400000000000090000000200480000010000007f0000d2040000d2040000d0070000000000000200000000000000a00f000000000000020000000000000000010000007f0000000140000000000009000000020040000001400000000000d2040000d2040000b80b0000000000000300000000000000a00f00000000000001000000000000000001400000000000')) m ON f.pid = m.pid AND f.frame >= m.addr AND f.frame < m.addr + m.len
GROUP BY m.filename
ORDER BY inclusive_samples DESC, m.filename;
Try these queries
Read the capture-wide metadata (one row).
SELECT hostname, arch, nrcpus, perf_version, cmdline, total_events
FROM perf.main.meta('/data/perf.data')
Uses meta
List the events the capture sampled and how.
SELECT name, type, sample_period, sample_freq
FROM perf.main.events('/data/perf.data')
ORDER BY name
Uses events
The first ten samples with their raw call chains.
SELECT time, pid, ip, callchain
FROM perf.main.samples('/data/perf.data')
ORDER BY time
LIMIT 10
Uses samples
Every mapped DSO and its build-id (the vgi-symbols input).
SELECT filename, build_id
FROM perf.main.mmaps('/data/perf.data')
WHERE build_id IS NOT NULL
ORDER BY filename
Uses mmaps
Hot mapped files per process name: samples range-joined to mmaps, labelled with each pid's latest command name from comms (exec renames keep the newest), with hits and total sample period.
WITH names AS (SELECT pid, arg_max(comm, coalesce(time, 0)) AS comm FROM perf.main.comms('/data/perf.data') GROUP BY pid) SELECT n.comm, m.filename, count(*) AS hits, sum(s.period) AS total_period
FROM perf.main.samples('/data/perf.data') s
JOIN perf.main.mmaps('/data/perf.data') m ON s.pid = m.pid AND s.ip >= m.addr AND s.ip < m.addr + m.len
LEFT JOIN names n ON n.pid = s.pid
GROUP BY n.comm, m.filename
ORDER BY hits DESC, m.filename
List the decode table functions and the columns each one returns.
SELECT object_name, result_columns
FROM perf.main.functions
WHERE object_kind = 'table function'
ORDER BY object_name
Uses functions
12 more examples in the Catalog, each listed under the table or function it uses.
Perf is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.
Related workers
pprof
Developer & networking
Decode Go, gperftools, Parca and py-spy pprof profiles into SQL rows for flamegraph diffs and CI performance-regression gates
Symbols
Developer & networking
Symbolicate native stack addresses to function, file and line from DWARF and PDB debug info
NetFlow
Developer & networking
Turn captured NetFlow v5/v9, IPFIX, and sFlow v5 datagrams into normalized, queryable flow rows