UserStatistics class: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
m (link repair)
 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Intended for performance work, the UserStatistics class
Intended for performance work, the <var>UserStatistics</var> class
is designed to replace $STAT and similar tools that return the
is designed to replace <var>[[$Stat]]</var> and similar tools that return the
values for selected ''Model 204'' User statistics.
values for selected <var class="product">Model 204</var> User statistics.
The <var>[[New_(UserStatistics_constructor)|New]]</var> constructor takes a snapshot of the user stat block at the time the constructor is invoked. You then use the <var>UserStatistics</var> methods to extract the statistical data from the instantiated object.


The methods in this class are listed in [[:Category:UserStatistics methods|UserStatistics methods]].
__TOC__
   
   
The UserStatistics constructor takes a snapshot of the user stat block at the
==About the UserStatistics statistics==
time the constructor is invoked.
The object holds two types of user statistics: '''Login''' and '''Request'''.
You then use the UserStatistics methods to extract
the statistical data from the instantiated object.
The object holds two types of user statistics:
'''Login''' and '''Request'''.
<ul>
<ul>
<li><div id="login"></div>Login statistics (also called &ldquo;Final&rdquo;) are those that keep
<li><div id="login"></div>Login statistics (also called "Final") are those that keep data per user since the user's most recent login. The statistics available to the <var class="product">Model 204</var> <var>$Stat</var> function, as well as the <var>OBJSWAP</var> statistic for [[Object oriented programming in SOUL|SOUL objects]], are valid.
data per user since the user's most recent login.
 
The statistics available to the ''Model 204'' $STAT function,
as well as the OBJSWAP statistic for [[Janus SOAP]] objects, are valid.
<li><div id="request"></div>Request statistics are a combination of:
<li><div id="request"></div>Request statistics are a combination of:
<ul>
<ul>
<li>Statistics that keep the
<li>Statistics that keep the current highwater marks for some work tables per user.
current high-water marks for some work tables per user.
<var class="product">Model&nbsp;204</var> documentation includes these with "since last" statistics.
''Model 204'' documentation includes these with &ldquo;since last&rdquo; statistics.
 
<li>Since last statistics, which keep data per user comprising
<li>Since last statistics, which keep data per user comprising
only the user's most recent work unit (like compilation or evaluation);
only the user's most recent work unit (like compilation or evaluation);
Line 28: Line 23:
</ul>
</ul>
   
   
Login and Request statistics are not mutually exclusive.
Login and Request statistics are not mutually exclusive. Both Login and Request data are kept for some activities, so many
Both Login and Request data are kept for some activities, so many
statistics appear in lists of both types and are valid in all methods
statistics appear in lists of both types and are valid in all methods
that are restricted to one type or the other.
that are restricted to one type or the other.
   
   
The [[Model 204 System Manager's Guide]] and the [[SirMon]] documentation are good sources of information about the
The [[Using system statistics]] topic and the <var class="product">[[SirMon]]</var> documentation are good sources of information about the
available statistics; note that not all ''SirMon'' statistics
available statistics (note that not all <var class="product">SirMon</var> statistics are included in a <var>UserStatistics</var> object).
are included in a UserStatistics object.
Where they occasionally differ in spelling the name of a statistic,
Where they occasionally differ in spelling the name of a statistic,
the ''Model 204 System Manager's Guide'' is more likely to have what the UserStatistics
"Using system statistics" is more likely to have what the <var>UserStatistics</var>
methods require.
methods require.
   
   
You can also view all the individual statistics contained in a UserStatistics
You can also view all the individual statistics contained in a <var>UserStatistics</var>
object by applying the ToString method to it, as follows:
object by applying the <var>[[ToString (UserStatistics function)|ToString]]</var> method to it, as follows:
<pre>
<p class="code">Print %statObject:ToString(Zeros=true)
    %statobject:ToString(Zeros=true)
</p>
</pre>
   
   
The longstring output from this ToString method invocation displays all
This displays all of the Login statistics followed by all the Request statistics.
the Login statistics followed by all the Request statistics.
<p class="note">'''Note:'''
'''Note:'''
The <var>ToString</var> method shown above can be applied implicitly:
The ToString method shown above can be applied implicitly:
simply <var>Print</var> or <var>Audit</var> an object variable, and
simply print or audit an object variable, and
the <var>ToString</var> method is automatically applied to the object.
the ToString method is automatically applied to the object.
<code>Print %statObject</code> is equivalent to <code>Print %statObject:ToString</code>. </p>
<tt>Print %statobject</tt> is equivalent to <tt>Print %statobject:ToString</tt>.
 
==Example==
The following is a simple example that
The following is a simple example that shows how much CPU a request uses and how many <var>DKRD</var>s it did:
shows how much CPU a request uses and how many DKRDs it did:
<p class="code">b
<pre>
%statStart  is object userStatistics
    b
%statEnd    is object userStatistics
    %statStart  is object userStatistics
%statStart = new
    %statEnd    is object userStatistics
... processing
    %statStart = new
%statEnd  = new
    ... processing
printText CPU:  {%statEnd:[[Difference (UserStatistics function)|difference]](%statStart, 'CPU')}
    %statEnd  = new
printText DKRDs: {%statEnd:difference(%statStart, 'DKRD')}
    printText CPU:  {%statEnd:difference(%statStart, 'CPU')}
end
    printText DKRDs: {%statEnd:difference(%statStart, 'DKRD')}
</p>
    end
</pre>
   
   
Specifying a statistic that is not a User statistic, or that is not the type
Specifying a statistic that is not a User statistic, or that is not the type
of statistic (Login or Request) that a method calls for,
of statistic (Login or Request) that a method calls for,
triggers an UnknownStatistic exception ([[??]] refid=unkstat.).
triggers an <var>[[UnknownStatistic class|UnknownStatistic]]</var> exception.
 
The UserStatistics class methods are
==List of UserStatistics methods==
described in the following subsections.
The [[List of UserStatistics methods]] shows all the class methods.
In the method templates, <tt>%ustat</tt> is used to represent the object
 
to which the method is being applied, sometimes called the &ldquo;method object.&rdquo;
Additional conventions are described in [[Notation conventions for methods]].
The UserStatistics class is new as of Sirius Mods version 7.3.
[[Category:System classes]]
[[Category:System classes]]

Latest revision as of 18:12, 13 September 2016

Intended for performance work, the UserStatistics class is designed to replace $Stat and similar tools that return the values for selected Model 204 User statistics.

The New constructor takes a snapshot of the user stat block at the time the constructor is invoked. You then use the UserStatistics methods to extract the statistical data from the instantiated object.

About the UserStatistics statistics

The object holds two types of user statistics: Login and Request.

  • Login statistics (also called "Final") are those that keep data per user since the user's most recent login. The statistics available to the Model 204 $Stat function, as well as the OBJSWAP statistic for SOUL objects, are valid.
  • Request statistics are a combination of:
    • Statistics that keep the current highwater marks for some work tables per user. Model 204 documentation includes these with "since last" statistics.
    • Since last statistics, which keep data per user comprising only the user's most recent work unit (like compilation or evaluation); they are not accumulated.

Login and Request statistics are not mutually exclusive. Both Login and Request data are kept for some activities, so many statistics appear in lists of both types and are valid in all methods that are restricted to one type or the other.

The Using system statistics topic and the SirMon documentation are good sources of information about the available statistics (note that not all SirMon statistics are included in a UserStatistics object). Where they occasionally differ in spelling the name of a statistic, "Using system statistics" is more likely to have what the UserStatistics methods require.

You can also view all the individual statistics contained in a UserStatistics object by applying the ToString method to it, as follows:

Print %statObject:ToString(Zeros=true)

This displays all of the Login statistics followed by all the Request statistics.

Note: The ToString method shown above can be applied implicitly: simply Print or Audit an object variable, and the ToString method is automatically applied to the object. Print %statObject is equivalent to Print %statObject:ToString.

Example

The following is a simple example that shows how much CPU a request uses and how many DKRDs it did:

b %statStart is object userStatistics %statEnd is object userStatistics %statStart = new ... processing %statEnd = new printText CPU: {%statEnd:difference(%statStart, 'CPU')} printText DKRDs: {%statEnd:difference(%statStart, 'DKRD')} end

Specifying a statistic that is not a User statistic, or that is not the type of statistic (Login or Request) that a method calls for, triggers an UnknownStatistic exception.

List of UserStatistics methods

The List of UserStatistics methods shows all the class methods.