Browse Prior Art Database

Method to Allow a Virtual Machine Guest Operating System to Calculate Accurate Elapsed Times for Accounting Purposes

IP.com Disclosure Number: IPCOM000121054D
Original Publication Date: 1991-Jul-01
Included in the Prior Art Database: 2005-Apr-03
Document File: 2 page(s) / 85K

Publishing Venue

IBM

Related People

Spano, JP: AUTHOR

Abstract

Operating systems often need to calculate elapsed CPU times for purposes of accounting, tuning, etc. One method commonly used is to record the time-of-day (TOD) clock at the beginning and end of a task and to use the difference to obtain elapsed time (and hence CPU time) consumed by the task.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 52% of the total text.

Method to Allow a Virtual Machine Guest Operating System to Calculate
Accurate Elapsed Times for Accounting Purposes

      Operating systems often need to calculate elapsed CPU
times for purposes of accounting, tuning, etc.  One method commonly
used is to record the time-of-day (TOD) clock at the beginning and
end of a task and to use the difference to obtain elapsed time (and
hence CPU time) consumed by the task.

      However, in a Virtual Machine (VM) environment, this may not
product accurate elapsed times as the host operating system may have
interrupted the guest during the time its task was in control and may
have dispatched other guests. Thus, the difference in the guest TOD
calculations would include the time used by its task as well as the
time used by any other guests dispatched by the host during the
measurement interval.

      In the past the VM operating system contained an interface
which provided the guest OS with the capability of calculating
accurate elapsed CPU usage.  This is the Diagnose X'70' interface.
When running above a VM host, the guest would issue the Diagnose
instruction with a code of X'70' and would pass to the VM host the
address (guest) on a 16-byte interface area.

      The VM host would then fill in the interface area each time it
dispatched the guest.  Two values were passed to the guest:  the TOD
clock value at dispatch and the guest VTIME at dispatch.  VTIME is
the amount of guest CPU consumed to date by the individual guest (as
calculated by the VM host).

      This allowed the guest to calculate CPU usage by means of the
following:
1.   Record VTIME value when starting a task,
2.   When ending a task Store the TOD Clock (STCK instruction) and
then record the contents of the interface area,
3.   Obtain the difference in the VTIME values and add to that the
difference between...