Difference (UserStatistics function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 6: Line 6:
Difference is a member of the [[UserStatistics class]].
Difference is a member of the [[UserStatistics class]].
</p>
</p>
 
This function returns the difference in [[UserStatistics class#login|Login]]
This function returns the difference in [[UserStatistics class#login|Login]]
(also called &ldquo;Final&rdquo;) statistic values
(also called &ldquo;Final&rdquo;) statistic values
between one UserStatistics object and another.
between one UserStatistics object and another.
 
The Difference method cancels the request if it is applied to a statistic
The Difference method cancels the request if it is applied to a statistic
[[UserStatistics class#request|Request statistic]].
[[UserStatistics class#request|Request statistic]].
Line 29: Line 29:
<dd>This case-independent string contains the name of a ''Model 204'' user Login statistic
<dd>This case-independent string contains the name of a ''Model 204'' user Login statistic
All other names return an UnknownStatistic exception.
All other names return an UnknownStatistic exception.
 
</dl>
</dl>
===Usage Notes===
===Usage Notes===
Line 48: Line 48:
</ul>
</ul>
===Examples===
===Examples===
 
The following example returns
The following example returns
the amount of CPU a request uses and how many DKRDs it did:
the amount of CPU a request uses and how many DKRDs it did:
<pre>
<p class="code"><nowiki>b
    b
%statStart  is object userStatistics
    %statStart  is object userStatistics
%statEnd    is object userStatistics
    %statEnd    is object userStatistics
%statStart = new
    %statStart = new
... processing
    ... processing
%statEnd  = new
    %statEnd  = new
printText CPU:  {%statEnd:difference(%statStart, 'CPU')}
    printText CPU:  {%statEnd:difference(%statStart, 'CPU')}
printText DKRDs: {%statEnd:difference(%statStart, 'DKRD')}
    printText DKRDs: {%statEnd:difference(%statStart, 'DKRD')}
end
    end
</nowiki></p>
</pre>

Revision as of 16:48, 28 February 2011

Difference of specified Login statistic value (between two U

Difference is a member of the UserStatistics class.

This function returns the difference in Login (also called “Final”) statistic values between one UserStatistics object and another.

The Difference method cancels the request if it is applied to a statistic Request statistic.

Syntax

  %dif = %ustat:Difference(%ustatOld, statistic)

Syntax terms

%dif
A numeric variable to contain the difference between the values of the specified statistic contained in the method object and contained in the older UserStatistics object.
%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 Difference 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 statistics (like PCPU) don't really make sense as a difference but the Difference method returns a difference anyway.
  • The DifferenceToString function returns the value differences between two UserStatistics objects for the Login statistics. The DifferenceToXmlDoc function returns the differences to an XmlDoc object.

Examples

The following example returns the amount of CPU a request uses and how many DKRDs it did:

b %statStart is object userStatistics %statEnd is object userStatistics %statStart = new ... processing %statEnd = new printText CPU: {%statEnd:difference(%statStart, 'CPU')} printText DKRDs: {%statEnd:difference(%statStart, 'DKRD')} end