Designing a new CPU
High-precision, fine-grained control over measurements.
Last Significant Update: |
2024-06-23 |
Status: |
Draft |
Comments to: |
Ήφαιστος (Hephaistos) the smith is forging a new kind of CPU in his workshop — a CPU incorporating some of the best ideas in the history of computing.
Hephaistos wants to understand how his design actually performs in the real world. For example, Hephaistos wants to measure memory bus behavior when a particular CPU in a multi-processing system is executing code in a specific kernel function on behalf of a particular user process.
Hephaistos uses Mensurae's programmability to set up “triggers” that turn on measurements when his chosen preconditions hold.
He soon has the fine-grained measurements he needs to guide his design choices.
Design Considerations
Control Language
Mensurae would offer a notation for specifying triggers.
BEGIN { // Configure hardware counters. e1 = count_hardware_events(..spec..) } // Record counts for event 'e1', but only when // in KERNEL-FUNC on behalf of process PROC-NAME. process ~ PROC-NAME && callstack ~ KERNEL-FUNC { count_events(e1) }
In-Kernel API
Mensurae’s functionality would need to be accessible from within the kernel via a documented and tested API.
This in-kernel API would be used to implement the control language above, and for other integrations such as OpenDTrace or Lua/NetBSD.
OpenDTrace Integration
On platforms offering OpenDTrace, we could implement ways for Mensurae’s functionality to be used from within OpenDTrace’s probes.
However, OpenDTrace is a complex system, and not all of Mensurae’s target platforms implement it. We cannot assume its availability as a pre-requisite.