Structured/machine-readable output for DTrace

From: Domagoj Stolfa <>
Date: Wed, 06 Sep 2023 19:24:32 UTC

I've implemented machine-readable output in the form of JSON, XML and 
HTML into libdtrace, and by extension dtrace(1) using libxo. The goal is 
not to replace linking to libdtrace in any way when one wishes to build 
a custom application around it, but rather to supplement it (as it would 
now also support this form of output by default) and act as a 
middle-ground between linking directly to libdtrace and parsing the 
pretty-printed dtrace(1) output that is available today (but not replace 

In order to get it to work, you can simply run dtrace(1) as normal, but 
add -x oformat=json|xml|html|plain.

I've posted the patch up for review if anyone wants to take a look or 
try it out [1] and posted a hacked up Python program (by no means good 
Python code) as an example of how this might be used [2]. I would 
appreciate any feedback you might have.

As this patch is still in its early stages however, there isn't much 
documentation available for it. I aim to address this soon.