Rate (UserStatistics function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
<span style="font-size:120%; color:black"><b>Rate per second of specified Login statistic for two UserStatisti</b></span>
{{Template:UserStatistics:Rate subtitle}}
[[Category:UserStatistics methods|Rate function]]
<!--DPL?? Category:UserStatistics methods|Rate function: Rate per second of specified Login statistic for two UserStatisti-->
<!--DPL?? Category:System methods|Rate (UserStatistics function): Rate per second of specified Login statistic for two UserStatisti-->
<p>
Rate is a member of the [[UserStatistics class]].
</p>


This function returns the difference in statistic values between one UserStatistics
This function returns the difference in statistic values between one UserStatistics
Line 11: Line 5:
the two UserStatistics objects were instantiated.
the two UserStatistics objects were instantiated.


The Rate method reports the rate of a ''Model 204'' user [[UserStatistics class#login|Login]] (also called &ldquo;Final&rdquo;) statistic.
The Rate method reports the rate of a ''Model 204'' user [[UserStatistics class#login|Login]] (also called &amp;ldquo;Final&amp;rdquo;) statistic.
The method cancels the request if it is applied to a statistic
The method cancels the request if it is applied to a statistic
that is exclusively a [[UserStatistics class#request|Request
that is exclusively a [[UserStatistics class#request|Request
Line 17: Line 11:


'''RatePerSecond''' is a synonym for <tt>Rate</tt>.
'''RatePerSecond''' is a synonym for <tt>Rate</tt>.
===Syntax===
==Syntax==
  %num = %ustat:Rate(%ustatOld, statistic)
{{Template:UserStatistics:Rate syntax}}
===Syntax terms===
===Syntax terms===
<dl>
<dl>
Line 33: Line 27:


</dl>
</dl>
===Usage Notes===
==Usage notes==
<ul>
<ul>
<li>The statistics UpdtTime(MS) and LongupdTime(MS) can also be specified
<li>The statistics UpdtTime(MS) and LongupdTime(MS) can also be specified
Line 53: Line 47:
</p>
</p>
</ul>
</ul>
===Examples===
==Examples==


The following statement returns the rate for DKRD
The following statement returns the rate for DKRD
Line 59: Line 53:
<p class="code">%dkrdPerSecond = %stat:difference(%statOld, 'dkrd')
<p class="code">%dkrdPerSecond = %stat:difference(%statOld, 'dkrd')
</p>
</p>
==See also==
{{Template:UserStatistics:Rate footer}}

Revision as of 20:42, 14 March 2011

Rate method (UserStatistics class)


This function returns 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 Login (also called &ldquo;Final&rdquo;) statistic. The method cancels the request if it is applied to a statistic that is exclusively a Request statistic.

RatePerSecond is a synonym for Rate.

Syntax

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

Syntax terms

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

Usage notes

  • 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 the Rate method 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 the Rate method returns 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.
  • To get rates with a divisor other than time, use the Difference function. For example:

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

Examples

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

%dkrdPerSecond = %stat:difference(%statOld, 'dkrd')

See also