https://foojay.io/today/writing-a-profiler-from-scratch-the-profiling-loop/
Writing a Profiler from Scratch: The Profiling Loop