beautypg.com

HP NonStop G-Series User Manual

Page 101

background image

Defining Custom Counters

Measure User’s Guide 520560-003

5 -5

Sample TAL Program

The array size for transactions (that is, the number of elements) is defined by the
measurement configuration. For the configuration to measure this instrumented code,
see

Section 6, Creating a Custom Measurement Application

.

! open the terminal
CALL MYTERM (term);
CALL OPEN (term, term^number);
IF <> THEN CALL DEBUG;

! determine location of each counter
error := MEASCOUNTERBUMPINIT (transactions,
transactions^offset);
call checkiniterr;

error := MEASCOUNTERBUMPINIT (timeper, timeper^offset);
call checkiniterr;

error := MEASCOUNTERBUMPINIT (waiting, waiting^offset);
call checkiniterr;

! increment both counters of the TRANSACTIONS array
error := MEASCOUNTERBUMP (transactions^offset, INC);
call checkerr;
error := MEASCOUNTERBUMP (transactions^offset, INC,,1);
call checkerr;

! start the TIMEPER busy counter
error := MEASCOUNTERBUMP (timeper^offset, SETBUSY);
call checkerr;

! increment the WAITING queue counter
error := MEASCOUNTERBUMP (waiting^offset, INCQUEUE);
call checkerr;
.
. application code
.
! stop the TIMEPER busy counter
error := MEASCOUNTERBUMP (timeper^offset, RESETBUSY);
call checkerr;

! decrement the WAITING queue counter
error := MEASCOUNTERBUMP (waiting^offset, DECQUEUE);
call checkerr;

! close the terminal
CALL CLOSE (term^number);

END;

Example 5-1. TAL Application Containing User-Defined Counters (page 3 of 3)