# Rate and RatePerSecond (UserStatistics functions)

(Redirected from Rate (UserStatistics function))

Jump to navigation
Jump to search
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')