Browse Prior Art Database

Unbiased, Accurated CPU Utilization Measurement for MP and UP Systems Independent of MP Scheduling Algorithms

IP.com Disclosure Number: IPCOM000014044D
Original Publication Date: 2000-Mar-01
Included in the Prior Art Database: 2003-Jun-19
Document File: 2 page(s) / 48K

Publishing Venue

IBM

Abstract

Unbiased, Accurated CPU Utilization Measurement for MP and UP Systems Independent of MP Scheduling Algorithms Disclosed here is a method for acquiring accurate, high resolution CPU utilization information in a UP or MP environment based upon a "stop watch" model whereby a high resolution timer is read immediately after a CPU leaves its idle loop and immediately prior to re-entering the idle loop to effectively accurately measure the "busy" time. "Busy times" are accumulated per CPU and made available to user callable routines. Previous approaches to accurately measuring cpu utilization (with code in the idle loop for example) are destined to failure due to increasing amounts of code added to the loop (resulting from newer scheduling algorithms for example). Offloading utilization measurement code to the idle loop is a desirable goal as long as the idle loop pathlength is minimal; however, as the pathlength increases, more and more error is added to the cpu busy time accumulation counter. And the problem is exacerbated if the idle loop pathlength is variable (as is often the case in MP environments) due to random (or variable) error that is difficult to adjust out. Also, previous approaches require use of locking to access the cpu utilization data.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 49% of the total text.

Page 1 of 2

Unbiased, Accurated CPU Utilization Measurement for MP and UP Systems

Independent of MP Scheduling Algorithms

Disclosed here is a method for acquiring accurate, high resolution CPU utilization information in a UP or MP environment based upon a "stop watch" model whereby a high resolution timer is read immediately after a CPU leaves its idle loop and immediately prior to re-entering the idle loop to effectively accurately measure the "busy" time. "Busy times" are accumulated per CPU and made available to user callable routines.

Previous approaches to accurately measuring cpu utilization (with code in the idle loop for example) are destined to failure due to increasing amounts of code added to the loop (resulting from newer scheduling algorithms for example). Offloading utilization measurement code to the idle loop is a desirable goal as long as the idle loop pathlength is minimal; however, as the pathlength increases, more and more error is added to the cpu busy time accumulation counter. And the problem is exacerbated if the idle loop pathlength is variable (as is often the case in MP environments) due to random (or variable) error that is difficult to adjust out. Also, previous approaches require use of locking to access the cpu utilization data.

Based on a "stop watch" model, we add minimal code immediately after leaving the idle loop, ie, very close after the cpu goes "busy", which "starts" the stopwatch. Similarly, we add minimal code immediately prior to the cpu entering the idle loop, ie, prior to the cpu going "idle", which "stops" the stopwatch and accumulates the busy time to a counter. We utilize a high resolution timer (the 64 bit Timebase counter on POWERPC* for example) as our stopwatch; however, we selectively divide this timer down such that we can maintain both the start_time and accumulation counter in one 64 bit unit (whichs allows for atomic access and eliminates the need for locking in critical path code such as at the begin and end of interrupts). We also provide the mechanism for accurately reading current cpu utilization for a cpu that is "hung up" in an interrupt handler (and therefore not accumulating utilization time) for a long period of time.

Only cpu N can write/modify ppda[N] utilization data; other cpu's can read cpu N's utilization data.

1. We add the following two 32-bit variables to the per processor data area (PPDA) for each processor:

util_start_time

util_accumlator

2. In the interrupt handler which gets control immediately after leaving the idle loop (ie, at the beginning of an interrupt) we add the following:

if ( PPDA->util_start_time == 0 )

PPDA->util_start_time = (read_timer() >> Shift_Amount) | 1;

/* We only "start" the stopwatch if it is not already running (ie, a start time of zero indicates the "stop watch" is NOT running) */

/* We don't allow a time of zero (zero flags the case where we have not started the "stop watch"; by implementing this dual-function */

/* of start/stop flag and s...