Rate and RatePerSecond (UserStatistics functions): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
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 [[UserStatistics class#login|Login]] (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}}
{{Template:UserStatistics:RatePerSecond syntax}}
{{Template:UserStatistics:RatePerSecond syntax}}
===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>
 
<td>A UserStatistics object variable. </td></tr>
<tr><th>userStatistics</th>
<tr><th><i>%ustatOld</i></th>
<td>A <var>UserStatistics</var> object variable. </td></tr>
<td>An older UserStatistics object variable for the same user login as ''%ustat''. </td></tr>
 
<tr><th><i>statistic</i></th>
<tr><th>ustatOld</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>An older <var>UserStatistics</var> object variable for the same user login as <var class="term">userStaistics</var>. </td></tr>
 
<tr><th>string</th>
<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,
 
UpdtTimeMs and LongUpdtimeMs, respectively.
<li>The statistics <var>UpdtTime(MS)</var> and <var>LongupdTime(MS)</var> can also be specified without the parentheses: for example, <code>UpdtTimeMs</code> and <code>LongUpdtimeMs</code>, respectively.
<li>Request statistics are not valid for the Rate method since most don't
 
really make sense for this operation.
<li>Request statistics are not valid for <var>Rate</var> or <var>RatePerSecond</var>, since most don't really make sense for this operation. The Request statistics for which it does make sense (<var>CPU</var>, for example) have corresponding Login statistics that return the exact same difference.
The Request statistics for which it does make sense (CPU, for example)
 
have corresponding Login statistics that return the exact same difference.
<li>Some <var>Login</var> statistics (like <var>PCPU</var>) don't really make sense as a rate, but <var>Rate</var> or <var>RatePerSecond</var> will return a rate anyway.
<li>Some Login statistics (like PCPU) don't really make sense as a rate, but
 
the Rate method returns a rate anyway.
<li>All rates are rounded to thousandths, except for the <var>CPU</var> statistic. The units for <var>CPU</var> are milliseconds, so <var>CPU</var> rates are rounded to thousandths of a millisecond.
<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.
<li>To get rates with a divisor other than time, use the [[Difference (UserStatistics function)|Difference]] function.
For example:
<p class="code">%dkrdPerDkpr = %stat:difference(%statOld, 'DKRD') /  -
%stat:difference(%statOld, 'DKPR')
</p>
</ul>
</ul>
==Examples==
==Examples==
<ol><li>The following statement returns the rate for <var>DKRD</var> over the interval from the creation of <code>%ustatOld</code> to the creation of <code>%ustat</code>:
<p class="code">%dkrdPerSecond = %ustat:rate(%ustatOld, 'dkrd')
</p>


The following statement returns the rate for DKRD
<li>To get rates with a divisor other than time, use <var>[[Difference (UserStatistics function)|Difference]]</var>. For example:
over the interval from the creation of %ustatOld to the creation of %ustat:
<p class="code">%dkrdPerDkpr = %stat:difference(%statOld, 'DKRD') / %stat:difference(%statOld, 'DKPR')
<p class="code">%dkrdPerSecond = %stat:difference(%statOld, 'dkrd')
</p>
</p>
</ol>
==See also==
==See also==
{{Template:UserStatistics:Rate and RatePerSecond footer}}
{{Template:UserStatistics:Rate and RatePerSecond footer}}
{{Template:UserStatistics:Rate footer}}

Latest revision as of 21:49, 20 November 2012

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