ToString (UserStatistics function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (match syntax table to syntax template, tags and edits)
Line 1: Line 1:
{{Template:UserStatistics:ToString subtitle}}
{{Template:UserStatistics:ToString subtitle}}
<var>ToString</var> prints the values of the statistics in the method <var>UserStatistics</var> object.  By default, it will only print those statistics with non-zero values; but, optionally, may print all (including zero) statistics.


This method prints the values of the statistics in the method UserStatistics
object.
It prints all statistics with non-zero values (by default), or it prints
all statistics (as an option).
==Syntax==
==Syntax==
{{Template:UserStatistics:ToString syntax}}
{{Template:UserStatistics:ToString syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th><i>%ls</i></th>
<tr><th>%string</th>
<td>A longstring variable to contain the listing of the values of the statistics. </td></tr>
<td>A <var>longstring</var> variable to receive the listing of the values of the statistics. </td></tr>
<tr><th><i>%ustat</i></th>
<tr><th>userStatistics</th>
<td>A UserStatistics object variable. </td></tr>
<td>A <var>UserStatistics</var> object variable. </td></tr>
<tr><th><b>Zeros= </b><i>bool</i></th>
<tr><th>Zeros</th>
<td>This name required argument (<tt>Zeros</tt>) is a boolean value that indicates whether statistics with a zero value should be included in the returned data. Zeros is an optional argument that defaults to <tt>False</tt>, which results in the inclusion of only statistics with non-zero values.</td></tr>
<td>This <var>[[Methods#Named parameters|Name-Required]]</var> argument (<var class="term">Zeros</var>) is a <var>[[Boolean]]</var> value that indicates whether statistics with a zero value should be included in the returned data. <var class="term">Zeros</var> is an optional argument that defaults to <var>False</var>, which results in the inclusion of only statistics with non-zero values.</td></tr>
<tr><th>NamesToLower</th><td>This <var>[[Methods#Named parameters|Name-Required]]</var> argument is a <var>[[Boolean]]</var> value that indicates whether the returned <var class="product">Model 204</var> statistic names, which are normally all uppercase, should be returned as lowercase.  This is an optional argument which defaults to <var>False</var>.</td></tr>
<tr><th>NamesToLower</th><td>This <var>Name-Required</var> argument is a <var>Boolean</var> value that indicates whether the returned <var class="product">Model 204</var> statistic names, which are normally all uppercase, should be returned as lowercase.  This is an optional argument which defaults to <var>False</var>.</td></tr>
</table>
</table>


==Usage notes==
==Usage notes==
<ul>
<ul>
<li>The ToString method can be applied implicitly:
<li><var>ToString</var> can be applied implicitly: simply Print (or Audit) an object variable, and the <var>ToString</var> method is automatically applied to the object. That is:
simply Print (or Audit) an object variable, and
<p class="code">print %statobject</p> is equivalent to <p class="code">print %statobject:ToString</p>.
the ToString method is automatically applied to the object.
<tt>Print %statobject</tt> is equivalent to <tt>Print %statobject:ToString</tt>.
<li>The [[LoginToString (UserStatistics function)|LoginToString]] function
returns the values of the [[UserStatistics class#login|Login statistics]] in the UserStatistics object.
The [[RequestToString (UserStatistics function)|RequestToString]] function
returns the values of the [[UserStatistics class#request|Request statistics]] in the object.
</ul>
</ul>


==Examples==
==Examples==
 
<ol><li>The following display of non-zero <var>[[UserStatistics class#login|Login]]</var> and <var>[[UserStatistics class#request|Request]]</var> statistics is produced by a
The following display of non-zero Login and Request statistics is produced by a
<p class="code">print %ustat</p>
<br>
statement. The output line wrapping is altered for display purposes.
<tt>Print %ustat</tt> statement.
<p class="output">time='20080730102646772' userNumber=6 loginTime='20080730-
The output line wrapping is altered for display purposes.
<p class="code">time='20080730102646772' userNumber=6 loginTime='20080730-
102645880' login: cnct=1 sqrd=29 sqwr=4 sgmto=27 cpu=890 -
102645880' login: cnct=1 sqrd=29 sqwr=4 sgmto=27 cpu=890 -
req=1 move=97 slic=71 audit=32 dkar=253 dkpr=124751 pcpu=-
req=1 move=97 slic=71 audit=32 dkar=253 dkpr=124751 pcpu=-
Line 43: Line 32:
9 dkpr=124750 objswap=250247
9 dkpr=124750 objswap=250247
</p>
</p>
<li><p class="code">print %ustat:ToString(Zeros=true)</p> statement would print all the statistics, including those with a <code>0</code> value.
</ol>


A <tt>Print %ustat:ToString(Zeros=true)</tt> statement would
print all the statistics, including those with a <tt>0</tt> value.
==See also==
==See also==
<ul>
<li><var>[[LoginToString (UserStatistics function)|LoginToString]]</var> returns the values of the <var>Login</var> statistics in the <var>UserStatistics</var> object.
<li><var>[[RequestToString (UserStatistics function)|RequestToString]]</var> returns the values of the <var>Request</var> statistics in the object.
</ul>
{{Template:UserStatistics:ToString footer}}
{{Template:UserStatistics:ToString footer}}

Revision as of 02:59, 1 April 2011

Print UserStatistics values (UserStatistics class)

ToString prints the values of the statistics in the method UserStatistics object. By default, it will only print those statistics with non-zero values; but, optionally, may print all (including zero) statistics.

Syntax

%string = userStatistics:ToString[( [Zeros= boolean], [NamesToLower= boolean])]

Syntax terms

%string A longstring variable to receive the listing of the values of the statistics.
userStatistics A UserStatistics object variable.
Zeros This Name-Required argument (Zeros) is a Boolean value that indicates whether statistics with a zero value should be included in the returned data. Zeros is an optional argument that defaults to False, which results in the inclusion of only statistics with non-zero values.
NamesToLowerThis Name-Required argument is a Boolean value that indicates whether the returned Model 204 statistic names, which are normally all uppercase, should be returned as lowercase. This is an optional argument which defaults to False.

Usage notes

  • ToString can be applied implicitly: simply Print (or Audit) an object variable, and the ToString method is automatically applied to the object. That is:

    print %statobject

    is equivalent to

    print %statobject:ToString

    .

Examples

  1. The following display of non-zero Login and Request statistics is produced by a

    print %ustat

    statement. The output line wrapping is altered for display purposes.

    time='20080730102646772' userNumber=6 loginTime='20080730- 102645880' login: cnct=1 sqrd=29 sqwr=4 sgmto=27 cpu=890 - req=1 move=97 slic=71 audit=32 dkar=253 dkpr=124751 pcpu=- 996 objswap=250247 request: ntbl=10 qtbl=29 stbl=524 vtbl- =51 pdl=508 cnct=1 cpu=887 out=1 slic=71 pcpu=996 rqtm=88- 9 dkpr=124750 objswap=250247

  2. print %ustat:ToString(Zeros=true)

    statement would print all the statistics, including those with a 0 value.

See also

  • LoginToString returns the values of the Login statistics in the UserStatistics object.
  • RequestToString returns the values of the Request statistics in the object.