Rate and RatePerSecond (UserStatistics functions): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(2 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 <var>[[UserStatistics class#login|Login]]</var> (also called "Final") statistic.  
<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.  


==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>%number</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>userStatistics</th>
<tr><th>userStatistics</th>
<td>A <var>UserStatistics</var> object variable. </td></tr>
<td>A <var>UserStatistics</var> object variable. </td></tr>
<tr><th>%ustatOld</th>
 
<tr><th>ustatOld</th>
<td>An older <var>UserStatistics</var> object variable for the same user login as <var class="term">userStaistics</var>. </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>
<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>
<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>
Line 20: Line 24:
<ul>
<ul>
<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"]].
<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"]].
<li>The statistics UpdtTime(MS) and LongupdTime(MS) can also be specified without the parentheses: for example, 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>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>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.
 
<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>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.
 
<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>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.


</ul>
</ul>


==Examples==
==Examples==
<ol><li>The following statement returns the rate for DKRD over the interval from the creation of %ustatOld to the creation of %ustat:
<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 class="code">%dkrdPerSecond = %ustat:rate(%ustatOld, 'dkrd')
</p>
</p>
<li>To get rates with a divisor other than time, use <var>[[Difference (UserStatistics function)|Difference]]</var>. For example:
 
<p class="code">%dkrdPerDkpr = %stat:difference(%statOld, 'DKRD') / -
<li>To get rates with a divisor other than time, use <var>[[Difference (UserStatistics function)|Difference]]</var>. For example:
              %stat:difference(%statOld, 'DKPR')
<p class="code">%dkrdPerDkpr = %stat:difference(%statOld, 'DKRD') / %stat:difference(%statOld, 'DKPR')
</p>
</p>
</ol>
</ol>
Line 39: Line 47:
==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