$TkStatL: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (link repair)
 
(13 intermediate revisions by 3 users not shown)
Line 2: Line 2:
<span class="pageSubtitle">Retrieve statistics for all tasks into $list</span>
<span class="pageSubtitle">Retrieve statistics for all tasks into $list</span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $TkStatL function.</p>
<p class="warn"><b>Note:</b> Many $functions are deprecated in favor of Object Oriented methods. There is no OO equivalent for the $TkStatL function.</p>


This function allows retrieval of statistics for all tasks into a $list.  
This function allows retrieval of statistics for all tasks into a $list.  
Line 8: Line 8:
The $TkStatL function accepts two argument and returns a numeric error code.  
The $TkStatL function accepts two argument and returns a numeric error code.  


The first argument is the identifier of the $list that is to receive the results. The current contents of the $list are deleted and replaced with the requested statistics. The format of each $list item is:
==Syntax==
<p class="syntax"><span class="term">%result</span> = <span class="literal">$TkStatL</span>(<span class="term">list_identifier</span>, <span class="term">stat_list</span>, <span class="term">criterion</span>)
</p>
 
===Syntax terms===
<table>
<tr><th>%result</th>
<td>Either a positive number, which is the milliseconds since the online was brought up, or a negative error code.</td></tr>
 
<tr><th>list_identifier</th>
<td>The identifier of the $list that is to receive the results. The current contents of the $list are deleted and replaced with the requested statistics. The format of each $list item is:


<table class="syntaxTable">
<table class="thJustBold">
<tr><th>Byte 1-10</th>
<tr><th>Byte 1-10</th>
<td>Blanks</td></tr>
<td>Blanks</td></tr>
<tr><th>Byte 11-12</th>
<tr><th>Byte 11-12</th>
<td>Binary task number</td></tr>
<td>Binary task number</td></tr>
<tr><th>Byte 13-</th>
<tr><th>Byte 13-</th>
<td>Returned statistics
<td>Returned statistics</td></tr>
</table>
</td></tr>
</td></tr>
<tr><th>stat_list</th>
<td>A string of blank-delimited words indicating the statistics to be returned. The length of each returned statistic is always a multiple of four bytes. This facilitates the use of [[$StatLD]] with the returned $list.
<p>
For more information about available statistics, see [[Task statistics displayed in SirMon]]. </p></td></tr>
</table>
</table>


The second argument is a string of blank delimited words indicating the statistics to be returned. The length of each returned statistic is always a multiple of 4 bytes. This facilitates the use of [[$StatLD]] with the returned $list. For more information about available statistics, see the <var class="product">[http://sirius-software.com/maint/download/monr.pdf SirMon User's Guide]</var>.
===Return codes===
 
<p class="code"> -3 - No room to create $list items (if LISTFC <var>$SirParm</var> parameter not set)
==Syntax==
-5 - Required parameter not specified
<p class="syntax"><section begin="syntax" />%result = $TkStatL(list_identifier, stat_list, criterion)
-6 - Invalid $list identifier
<section end="syntax" /></p>
-13 - STAT not linked in
<p class="caption">%result is a either a positive number, which is the milliseconds since the online was brought up, or is a negative error code.</p>
</p>


<p class="code">
==Example==
  -3 - No room to create $list items
          (if LISTFC <var>$SirParm</var> parameter not set)
  -5 - Required parameter not specified
  -6 - Invalid $list identifier
-13 - STAT not linked in
</p>
<p class="caption">$TkStatL return codes
</p>
The following program displays some statistics for all tasks:
The following program displays some statistics for all tasks:


<p class="code"> B
<p class="code">B
   
   
%DATA IS STRING LEN 255
%DATA IS STRING LEN 255
   
   
%LIST = $ListNew
%LIST = $ListNew
   
   
%DATA = $TkStatL(%LIST, 'CPU STDEQ LKWAIT')
%DATA = $TkStatL(%LIST, 'CPU STDEQ LKWAIT')
IF %DATA < 0 THEN
IF %DATA < 0 THEN
    PRINT '$TKSTATL ERROR... RC = ' WITH %DATA
  PRINT '$TKSTATL ERROR... RC = ' WITH %DATA
    STOP
  STOP
END IF
END IF
   
   
FOR %I FROM 1 TO $ListCnt(%LIST)
FOR %I FROM 1 TO $ListCnt(%LIST)
    %DATA = $ListInf(%LIST, %I)
  %DATA = $ListInf(%LIST, %I)
    PRINT 'TASKNUM = ' WITH $UNBIN( $SUBSTR(%DATA, 11, 2) )
  PRINT 'TASKNUM = ' WITH $UNBIN( $SUBSTR(%DATA, 11, 2) )
    PRINT 'CPU = ' WITH $UNBIN( $SUBSTR(%DATA, 13, 4) )
  PRINT 'CPU = ' WITH $UNBIN( $SUBSTR(%DATA, 13, 4) )
    PRINT 'STDEQ = ' WITH $UNBIN( $SUBSTR(%DATA, 17, 4) )
  PRINT 'STDEQ = ' WITH $UNBIN( $SUBSTR(%DATA, 17, 4) )
    PRINT 'LKWAIT = ' WITH $UNBIN( $SUBSTR(%DATA, 21, 4) )
  PRINT 'LKWAIT = ' WITH $UNBIN( $SUBSTR(%DATA, 21, 4) )
    PRINT
  PRINT
END FOR
END FOR
   
   
END
END
</p>
</p>


<h2>Products authorizing {{PAGENAMEE}}</h2><ul class="smallAndTightList">
==Products authorizing {{PAGENAMEE}}==
<li>[[Sirius $Functions]]
<ul class="smallAndTightList">
<li>[[List of $functions|Sirius functions]]</li>
</ul>
</ul>
<p>
</p>


[[Category:$Functions|$TkStatL]]
[[Category:$Functions|$TkStatL]]

Latest revision as of 22:15, 27 November 2017

Retrieve statistics for all tasks into $list

Note: Many $functions are deprecated in favor of Object Oriented methods. There is no OO equivalent for the $TkStatL function.

This function allows retrieval of statistics for all tasks into a $list.

The $TkStatL function accepts two argument and returns a numeric error code.

Syntax

%result = $TkStatL(list_identifier, stat_list, criterion)

Syntax terms

%result Either a positive number, which is the milliseconds since the online was brought up, or a negative error code.
list_identifier The identifier of the $list that is to receive the results. The current contents of the $list are deleted and replaced with the requested statistics. The format of each $list item is:
Byte 1-10 Blanks
Byte 11-12 Binary task number
Byte 13- Returned statistics
stat_list A string of blank-delimited words indicating the statistics to be returned. The length of each returned statistic is always a multiple of four bytes. This facilitates the use of $StatLD with the returned $list.

For more information about available statistics, see Task statistics displayed in SirMon.

Return codes

-3 - No room to create $list items (if LISTFC $SirParm parameter not set) -5 - Required parameter not specified -6 - Invalid $list identifier -13 - STAT not linked in

Example

The following program displays some statistics for all tasks:

B %DATA IS STRING LEN 255 %LIST = $ListNew %DATA = $TkStatL(%LIST, 'CPU STDEQ LKWAIT') IF %DATA < 0 THEN PRINT '$TKSTATL ERROR... RC = ' WITH %DATA STOP END IF FOR %I FROM 1 TO $ListCnt(%LIST) %DATA = $ListInf(%LIST, %I) PRINT 'TASKNUM = ' WITH $UNBIN( $SUBSTR(%DATA, 11, 2) ) PRINT 'CPU = ' WITH $UNBIN( $SUBSTR(%DATA, 13, 4) ) PRINT 'STDEQ = ' WITH $UNBIN( $SUBSTR(%DATA, 17, 4) ) PRINT 'LKWAIT = ' WITH $UNBIN( $SUBSTR(%DATA, 21, 4) ) PRINT END FOR END

Products authorizing $TkStatL