Tracing System Calls in Python
Last time we counted CPU
instructions,
let’s look at syscalls now!
I’ll show you a little tiny tool I added to
Cirron that lets you see exactly what
syscalls a piece of Python code is calling and how to analyze the trace more effectively.
Let’s start with print("Hello") as before:
from cirron import Tracer
t = Tracer()
t.start()
print("Hello")
trace = t.end()
print(trace)
# write(1, "Hello\n", 6) = 6 <0.000150s>
You can see1 print uses only a single
write to write the string
"Hello\n" to stdout ...
Read more at mattstuchlik.com