$StatLD: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
(No difference)

Revision as of 20:44, 24 October 2012

Calculate differences and rates for statistics $lists

Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $StatLD function.

This function allows calculation of differences and rates for statistics $lists. These statistics $lists must be in a format identical to $lists produced by $CFStatL, $FiStatL, $TkStatL, $SsStatL, $UsStatL and $JPStatL.

The $StatLD function accepts six arguments and returns a numeric error code.

The first argument is the identifier of a $list where each item contains an EBCDIC identifier in bytes 1-10, a binary number in bytes 11-12 and data in bytes 13 to the end of the $list item.

The second argument is the identifier of a $list where each item contains an EBCDIC identifier in bytes 1-10, a binary number in bytes 11-12 and data in bytes 13 to the end of the $list item.

The third argument is the identifier of an output $list. The contents of this $list are deleted and replaced by the differences between the argument 1 $list and the argument 2 $list.

The fourth argument is a control string containing blank delimited tokens describing the action to be performed for each 4 byte chunk of the input $list items. The available actions are

  • 'N' - stands for number. Simply copy 4 bytes from argument 2.
  • 'D' - stands for difference. Calculate binary difference between 4 bytes in argument 2 and argument 1.
  • 'R' - stands for rate. Calculate binary difference between 4 bytes in argument 2 and argument 1, multiply by 1,000,000 and then divide by argument 4. The fifth argument is required if an R is included in the control string.

The fifth argument is a number to be used as a divisor in calculating rates. This is an optional argument but is required if there is an 'R' in the control string (argument 4). This would ordinarily be the elapsed time between calculation of the first argument and the second.

The sixth argument is a number of characters at the beginning of the output list (parameter 3) reserved for the name of the monitored entity. Should be set to 30 when monitoring Janus ports and 10 (the default) for all other entities.

Syntax

<section begin="syntax" />%result = $StatLD(list1_id, list2_id, list3_id, - action_list, divisor, prelen) <section end="syntax" />

$StatLD Function

%result is either 0 or a negative error code.

The data returned into the output $list by $StatLD is binary with the first 12 bytes matching the first 12 bytes of an item in the second $list that matches one in the first list. Any item in the second $list that has the high order bit of byte 11 on (set to flag exclusion by a selection criterion on $FISTATL, $TKSTATL, $SsStatL or $UsStatL) is excluded from the new $list. The actual difference data starts at offset 12 (byte number 13) in the result $list items.

-3 - CCATEMP is full (if LISTFC $SirParm parameter not set) -5 - Required parameter not specified -6 - Invalid $list identifier -12 - Invalid control string -13 - Invalid rate divisor -14 - Invalid length $list item

$StatLD return codes

The following program displays every user's CPU usage as a rate over one second interval and as a total over the whole run.

Begin %i is float %list1 is float %list2 is float %list3 is float %time1 is float %time2 is float %rc is float %data is string len 255 %list1 = $ListNew %list2 = $ListNew %list3 = $ListNew %time1 = $UsStatL(%list1, 'IODEV CPU') Pause 1 %time2 = $UsStatL(%list2, 'IODEV CPU') %rc = $StatLD(%list1, %list2, %list3, 'N N', %time2 - %time1) For %i from 1 to $ListCnt(%list3) %data = $ListInf(%list3, %i) Text userid = { $substr(%data,1,10) } - usernum = { $unbin($substr(%data,11,2)) } - iodev = { $unbin($substr(%data,13,4)) } - cpu total = { $unbin($substr(%data,17,4)) } End Text End For End

Products authorizing $StatLD