Reading active counters – HP NonStop G-Series User Manual

Page 129

Advertising
background image

Creating a Custom Measurement Application

Measure User’s Guide 520560-003

6- 17

Reading Active Counters

After the records are received, they are validated by checking the ERROR field. An
extended structure pointer based on the template structure DISC^DEF (not shown),
which defines a DISC record, is used for validation.

Reading Active Counters

While an entity is being measured, you can obtain a counter record for it that contains
the current values in its active counters. The active counter records are maintained by
MEASCTL, not MEASFH, so you do not need to open the measurement data file to
read an active counter record. You cannot read active counter records for DISCOPEN,
DISKFILE, or PROCESSH entities. You must use MEASREAD or MEASREAD_DIFF_
to read these records.

To read an active counter record, call MEASREADACTIVE (for buffers up to 32 KB) or
MEAS_READACTIVE_ (for buffers larger than 32 KB) and pass it an entity descriptor
and the size and location of the buffer. The entity descriptor must specify a single
entity. Besides the

type

and

len

fields, these fields in these descriptors must contain

specific values (wild-card values are not permitted):

For systems running D-series or G-series RVUs:

°

The

cpu

^

number

field in the CPU and TMF descriptors

DO
BEGIN
SPACE^AVAILABLE := SPACE^AVAILABLE - $DBL(BYTESRET);
IF SPACE^AVAILABLE < RECORD^LENGTH
THEN ... ! not enough space for one record
IF SPACE^AVAILABLE > 32000D
THEN BUFSIZE := 32000
ELSE BUFSIZE := $INT(SPACE^AVAILABLE);
IF ERROR := MEASREAD(DFNUM,DESCRIPTOR,READ^PTR,
BUFSIZE,BYTESRET,FIRSTCALL)
THEN ... ! handle error
IF NOT BYTESRET
THEN ... ! no records returned
TOTAL^BYTES := TOTAL^BYTES + $DBL(BYTESRET);
@READ^PTR := @READ^PTR + $DBL(BYTESRET);
END
UNTIL FIRSTCALL = 0F OR ERROR <> 0;
! Begin FOR loop to validate returned records.
! Assumes number of records is less than 32767.

NUM^OF^RECORDS := $INT(TOTAL^BYTES/RECORD^LENGTH);
FOR I := 0 TO NUM^OF^RECORDS - 1 DO
BEGIN
IF RECORD^PTR[I].ERROR THEN ... !invalid counter values
.
.
.

Example 6-3. Reading Records From a Data File (page 2 of 2)

Advertising