Rate and RatePerSecond (UserStatistics functions): Difference between revisions
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. | |||
==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 | <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> | <tr><th>userStatistics</th> | ||
<td>A UserStatistics object variable. </td></tr> | <td>A <var>UserStatistics</var> object variable. </td></tr> | ||
<tr><th | <tr><th>%ustatOld</th> | ||
<td>An older UserStatistics object variable for the same user login as | <td>An older <var>UserStatistics</var> object variable for the same user login as <var class="term">userStaistics</var>. </td></tr> | ||
<tr><th> | <tr><th>string</th> | ||
<td>This case-independent string contains the name of a | <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 | <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 | |||
==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 | <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> | ||
</ | </ol> | ||
==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
- 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')
- To get rates with a divisor other than time, use Difference. For example:
%dkrdPerDkpr = %stat:difference(%statOld, 'DKRD') / - %stat:difference(%statOld, 'DKPR')