Does python-dtrace support using integer keys in aggregates?
Here is a simple example:
from dtrace import DTraceConsumerThread
from subprocess import check_output, Popen, PIPE, STDOUT
import time
script = """syscall::read:entry /execname == "dd"/
{
@values[arg2] = count();
}"""
command = ["dd", "if=/dev/zero", "of=/dev/null", "status=none", "bs=1M", "count=10"]
print("Running with dtrace-python")
dtrace_thread = DTraceConsumerThread(script, sleep=1)
dtrace_thread.start()
check_output(command)
dtrace_thread.stop()
dtrace_thread.join()
print("\nRunning with command line dtrace")
with Popen(["dtrace", "-n", script], stderr=STDOUT, stdout=PIPE) as proc:
time.sleep(0.5) # let dtrace start
check_output(command)
proc.terminate()
print(proc.stdout.read().decode())
python-dtrace prints:
1793 1 [b'/'] 1
1793 1 [b'\x80'] 1
1793 1 [b''] 10
The dtrace command prints
Is there some way to recover the integer aggregate keys from the byte strings returned (b'/', b'\x80', b''), or is this functionality not yet supported?
Thanks in advance.
(I'm using version 0.0.12 installed from master, on FreeBSD 13)
Does
python-dtracesupport using integer keys in aggregates?Here is a simple example:
python-dtraceprints:The
dtracecommand printsIs there some way to recover the integer aggregate keys from the byte strings returned (
b'/',b'\x80',b''), or is this functionality not yet supported?Thanks in advance.
(I'm using version
0.0.12installed from master, on FreeBSD 13)