[PATCH] Add an ETW backend for the static probes on Windows

From: Bryan Green <dbryan(dot)green(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] Add an ETW backend for the static probes on Windows
Date: 2026-10-30 21:38:21
Message-ID: 31c8eade-54a8-4283-be36-ac3a4fbb9c79@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greetings,

The attached patch set adds event tracing to windows for PG. It doesn't
add any new probes. It just gets windows on par with our other
platforms, at least for the MSVC build.

The existing probes become TraceLogging events that wpr and WPA can
record and show in the same trace as the kernel's disk and scheduler events.

probes.h is generated from probes.d as it is today, plus a small
data file that carries a keyword and level for each event and a name for
each argument. probes.d and the call sites don't change, and the build
fails on every platform, not just Windows, if the two files disagree.

There's one provider, "PostgreSQL.Server", with its GUID derived
from the name, registered once per process.

It's a meson option, on by default where the Windows SDK's
TraceLogging header is available, so MSVC builds get it and MinGW
keeps the dummy. On pgbench -S an idle ETW build was within 0.5% of
the dummy build, which is within noise here.

0002 turns it on in the Windows - Visual Studio CI task, and 0003 is
the docs.

To see events, from a prompt whose user is in Performance Log Users:

logman create trace pg -p "{ea7811de-e757-5488-7ad6-2b057cced37d}" 0x3
0x4 -bs 64 -o pg.etl -ets
pgbench -S -T 5 postgres
logman stop pg -ets
tracerpt pg.etl -o pg.xml -of XML

--
Bryan Green
EDB: https://www.enterprisedb.com

Attachment Content-Type Size
v1-0001-Add-an-ETW-backend-for-the-static-probes-on-Windo.patch text/plain 31.6 KB
v1-0002-ci-Enable-the-ETW-build-in-the-Windows-Visual-Stu.patch text/plain 988 bytes
v1-0003-Document-the-ETW-probe-backend.patch text/plain 13.1 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2026-10-30 21:43:27 Re: [PG19] Three bugs with a CHECK constraint that only the child enforces
Previous Message Guillaume Lelarge 2026-10-30 20:19:24 Re: Setting the number of digits after the decimal point with a psql's pset variable