Rate and RatePerSecond (UserStatistics functions): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (match syntax table to syntax template, tags and edits)
Line 1: Line 1:
{{Template:UserStatistics:Rate and RatePerSecond subtitle}}
{{Template:UserStatistics:Rate and RatePerSecond subtitle}}
<var>Rate</var> and <var>RatePerSecond</var> are aliases for each other.  They return the difference in statistic values between one <var>UserStatistics</var> object and another divided by the number of seconds between the time the two <var>UserStatistics</var> objects were instantiated.  They report the rate of a <var class="product">Model 204</var> user <var>[[UserStatistics class#login|Login]]</var> (also called "Final") statistic.


These functions, which are aliases for each other, return the difference in statistic values between one UserStatistics
object and another divided by the number of seconds between the time
the two UserStatistics objects were instantiated.
The Rate method reports the rate of a ''Model 204'' user [[UserStatistics class#login|Login]] (also called &amp;amp;amp;amp;ldquo;Final&amp;amp;amp;amp;rdquo;) statistic.
The method cancels the request if it is applied to a statistic
that is exclusively a [[UserStatistics class#request|Request
statistic]].
'''RatePerSecond''' is a synonym for <tt>Rate</tt>.
==Syntax==
==Syntax==
{{Template:UserStatistics:Rate syntax}}
{{Template:UserStatistics:Rate syntax}}
Line 16: Line 7:
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th><i>%num</i></th>
<tr><th>%number</th>
<td>A numeric variable to contain the rate for the specified statistic. </td></tr>
<td>A numeric variable to contain the rate for the specified statistic. </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><i>%ustatOld</i></th>
<tr><th>%ustatOld</th>
<td>An older UserStatistics object variable for the same user login as ''%ustat''. </td></tr>
<td>An older <var>UserStatistics</var> object variable for the same user login as <var class="term">userStaistics</var>. </td></tr>
<tr><th><i>statistic</i></th>
<tr><th>string</th>
<td>This case-independent string contains the name of a ''Model 204'' user Login statistic. All other names return an UnknownStatistic exception.</td></tr>
<td>This case-independent string contains the name of a <var class="product">Model 204</var> user Login statistic. All other names return an <var>[[UnknownStatistic_class|UnknownStatistic]]</var> exception.</td></tr>
</table>
</table>
==Usage notes==
==Usage notes==
<ul>
<ul>
<li>The statistics UpdtTime(MS) and LongupdTime(MS) can also be specified
<li><var>Rate</var> or <var>RatePerSecond</var> will cancel the request if they are applied to a statistic that is exclusively a [[UserStatistics class#request|"Request statistic"]].
without the parentheses: for example,
<li>The statistics UpdtTime(MS) and LongupdTime(MS) can also be specified without the parentheses: for example, UpdtTimeMs and LongUpdtimeMs, respectively.
UpdtTimeMs and LongUpdtimeMs, respectively.
<li><var>Request</var> statistics are not valid for <var>Rate</var> or <var>RatePerSecond</var>, since most don't really make sense for this operation. The <var>Request</var> statistics for which it does make sense (CPU, for example) have corresponding <var>Login</var> statistics that return the exact same difference.
<li>Request statistics are not valid for the Rate method since most don't
<li>Some <var>Login</var> statistics (like PCPU) don't really make sense as a rate, but <var>Rate</var> or <var>RatePerSecond</var> will return a rate anyway.
really make sense for this operation.
<li>All rates are rounded to thousandths, except for the CPU statistic. The units for CPU are milliseconds, so CPU rates are rounded to thousandths of a millisecond.
The Request statistics for which it does make sense (CPU, for example)
 
have corresponding Login statistics that return the exact same difference.
</ul>
<li>Some Login statistics (like PCPU) don't really make sense as a rate, but
 
the Rate method returns a rate anyway.
==Examples==
<li>All rates are rounded to thousandths, except for the CPU statistic.
<ol><li>The following statement returns the rate for DKRD over the interval from the creation of %ustatOld to the creation of %ustat:
The units for CPU are milliseconds, so
<p class="code">%dkrdPerSecond = %ustat:rate(%ustatOld, 'dkrd')
CPU rates are rounded to thousandths of a millisecond.
</p>
<li>To get rates with a divisor other than time, use the [[Difference (UserStatistics function)|Difference]] function.
<li>To get rates with a divisor other than time, use <var>[[Difference (UserStatistics function)|Difference]]</var>. For example:
For example:
<p class="code">%dkrdPerDkpr = %stat:difference(%statOld, 'DKRD') /  -
<p class="code">%dkrdPerDkpr = %stat:difference(%statOld, 'DKRD') /  -
%stat:difference(%statOld, 'DKPR')
              %stat:difference(%statOld, 'DKPR')
</p>
</p>
</ul>
</ol>
==Examples==


The following statement returns the rate for DKRD
over the interval from the creation of %ustatOld to the creation of %ustat:
<p class="code">%dkrdPerSecond = %stat:difference(%statOld, 'dkrd')
</p>
==See also==
==See also==
{{Template:UserStatistics:Rate and RatePerSecond footer}}
{{Template:UserStatistics:Rate and RatePerSecond footer}}
{{Template:UserStatistics:Rate footer}}
{{Template:UserStatistics:Rate footer}}

Revision as of 09:40, 31 March 2011

Per second rate of change of statistic (UserStatistics class)

Rate and RatePerSecond are aliases for each other. They return the difference in statistic values between one UserStatistics object and another divided by the number of seconds between the time the two UserStatistics objects were instantiated. They report the rate of a Model 204 user Login (also called "Final") statistic.

Syntax

%number = userStatistics:Rate( ustatOld, string) Throws UnknownStatistic

%number = userStatistics:RatePerSecond( ustatOld, string) Throws UnknownStatistic

Syntax terms

%number A numeric variable to contain the rate for the specified statistic.
userStatistics A UserStatistics object variable.
%ustatOld An older UserStatistics object variable for the same user login as userStaistics.
string This case-independent string contains the name of a Model 204 user Login statistic. All other names return an UnknownStatistic exception.

Usage notes

  • Rate or RatePerSecond will cancel the request if they are applied to a statistic that is exclusively a "Request statistic".
  • The statistics UpdtTime(MS) and LongupdTime(MS) can also be specified without the parentheses: for example, UpdtTimeMs and LongUpdtimeMs, respectively.
  • Request statistics are not valid for Rate or RatePerSecond, since most don't really make sense for this operation. The Request statistics for which it does make sense (CPU, for example) have corresponding Login statistics that return the exact same difference.
  • Some Login statistics (like PCPU) don't really make sense as a rate, but Rate or RatePerSecond will return a rate anyway.
  • All rates are rounded to thousandths, except for the CPU statistic. The units for CPU are milliseconds, so CPU rates are rounded to thousandths of a millisecond.

Examples

  1. The following statement returns the rate for DKRD over the interval from the creation of %ustatOld to the creation of %ustat:

    %dkrdPerSecond = %ustat:rate(%ustatOld, 'dkrd')

  2. To get rates with a divisor other than time, use Difference. For example:

    %dkrdPerDkpr = %stat:difference(%statOld, 'DKRD') / - %stat:difference(%statOld, 'DKPR')

See also