Sampling Computing Threads by CPU Service and Wait State Time
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional methods for determining CPU hot spots in computer programs are inaccurate due to the failure to account for CPU wait states, leading to unnecessary examination of efficient code portions.
Innovation Solution
A method for sampling computing threads where the probability of sampling is proportional to the activity's time period, allowing for accurate recording of CPU time based on the CPU state, whether actively servicing or in a wait state, and distributing CPU time accurately across activities in the call stack.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of manufacture
If total CPU time is retrieved from the operating system for each sample, then the data retrieval process is simple, but the determination of hot spots becomes inaccurate due to CPU wait states not being accounted for
Solution Approach 1:
The patent segments the total time period into two distinct components: CPU service time and CPU wait state time. By separating these time elements and tracking them independently, the system achieves accurate hot spot determination while maintaining simple data retrieval through the operating system's total time information.
2Ease of operation
If conventional sampling methods are used to obtain thread data at various times, then the sampling process is straightforward, but the CPU time recording becomes inaccurate when CPUs enter wait states
Solution Approach 1:
The patent introduces an intermediary mechanism that monitors CPU state transitions between service and wait states. This intermediary tracks when the CPU enters and exits wait states, allowing the system to accurately attribute time periods to either CPU service or wait state, thereby maintaining reliable CPU time recording alongside straightforward sampling operations.
3Productivity
If total CPU time is used to determine hot spots, then the analysis process is efficient, but developers examine code portions that are already efficient, wasting time
Solution Approach 1:
The patent replaces the conventional mechanical approach of using total CPU time with a refined measurement system that subtracts CPU wait state time from total time. This substitution provides accurate CPU service time that truly reflects code execution demands, enabling developers to efficiently identify actual hot spots without wasting time on already-efficient code portions.
Data Source
AI summary
Computing threads can be sampled such that the samples hit each activity with a probability proportional to a time period of that activity. Therefore, the sampling can advantageously account for all activities, including activities that are smaller than the applicable sampling interval.


