Non-privileged Extract CPU Time Instruction for Low Overhead Measurement
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for determining resource usage, such as elapsed CPU time, in processing environments are inefficient and incur significant overhead when using operating system services or privileged instructions, which can skew measurements and perturb the tasks being measured.
Innovation Solution
A non-privileged Extract CPU Time machine instruction is introduced, allowing users to accurately measure CPU time without calling operating system services or using privileged operations, by obtaining and subtracting CPU timer values from a memory location, enabling atomic operations that determine resource usage efficiently.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If the TIMEUSED service routine is used to determine CPU time, then the CPU time usage can be obtained, but the overhead of the service routine (hundreds of CPU cycles) severely perturbs the measurement of small code fragments
Solution Approach 1:
The patent extracts the CPU timer value directly from the timer unit without going through the operating system service routine. By using a privileged instruction to read the timer value and storing it in a location accessible by problem-state programs, the measurement process bypasses the TIMEUSED service routine overhead, enabling direct extraction of timing data with minimal perturbation to the measured code
Solution Approach 2:
The patent introduces an intermediary mechanism - a storage location (memory location or register) that holds the CPU timer value and is accessible to both privileged and non-privileged modes. This intermediary allows problem-state programs to obtain timing information without calling the operating system service routine, thus eliminating the overhead while maintaining measurement accuracy
2Measurement precision
If privileged instructions (SPT, STPT) are used to set and inspect CPU timer, then the accuracy of time measurement is ensured, but these instructions are not usable by problem-state programs (user programs)
Solution Approach 1:
The patent segments the CPU time measurement functionality into two parts: a privileged operation to set and read the timer, and a non-privileged storage location that makes the timer value accessible to user programs. This segmentation allows problem-state programs to access timing information without requiring privileged instruction execution, thus improving ease of operation while maintaining measurement accuracy through the initial privileged setup
Solution Approach 2:
The patent introduces an intermediary storage location that acts as a bridge between the privileged CPU timer and non-privileged user programs. The timer value is stored in this intermediary location by a privileged instruction, and then problem-state programs can read from this location using non-privileged instructions, thus making accurate time measurement accessible to user programs without requiring them to execute privileged instructions
Data Source
AI summary
An efficient facility for determining resource usage, such as a processor time used by tasks. The determination is performed on behalf of user applications that do not require a call to operating system services. The facility includes an instruction that determines elapsed time and reports it to the user as a single unit of operation.


