Example 6-4, Reading active counters – HP NonStop G-Series User Manual

Page 131

Advertising
background image

Creating a Custom Measurement Application

Measure User’s Guide — 520560-003

6- 19

Checking the Status of the Subsystem or a

Measurement

structures based on the template structure CPU^DEF (not shown), which defines a
CPU counter record.

Checking the Status of the Subsystem or a
Measurement

Two procedure calls are used to check the status of the Measure subsystem and an
active measurement.

The MEASMONSTATUS procedure call returns this information about the Measure
subsystem:

•

The number of measurements currently active.

•

The names of the currently active or configured measurements. The names are
ordered by measurement number. Therefore, you can use MEASMONSTATUS to
obtain the measurement number of an active measurement.

A call to MEASCONFIGURE adds a measurement to the list of active measurements.
Therefore, a measurement that is configured but not started appears in the array
returned by MEASMONSTATUS. A measurement remains on the list of active
measurements until a call to MEASCONTROL stops it.

Example 6-4. Reading Active Counters

LITERAL MAX^CPU = 15;

STRUCT .CPU(CPU^DEF)[0:MAX^CPU]; ! counter record buffer
STRUCT .DESCRIPTOR(CPU^DESC); ! CPU descriptor

INT BYTESRET,
ERROR[0:MAX^CPU],
I;
.
.
.

! Initialize first two words of CPU descriptor.

DESCRIPTOR.TYPE := CPU^T;
DESCRIPTOR.LEN := $LEN(CPU.DESC);

! Read in CPU records.

FOR I := 0 TO MAX^CPU DO
BEGIN
DESCRIPTOR.CPU^NUMBER := I;
ERROR[I] := MEASREADACTIVE(MEASCB,MEASNUM,DESCRIPTOR,
CPU[I],$LEN(CPU^DEF),BYTESRET);
END;

Advertising