diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Monitoring/StatsManager.cs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index 4844336..cebe905 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs | |||
@@ -382,14 +382,20 @@ namespace OpenSim.Framework.Monitoring | |||
382 | 382 | ||
383 | public class PercentageStat : Stat | 383 | public class PercentageStat : Stat |
384 | { | 384 | { |
385 | public int Antecedent { get; set; } | 385 | public long Antecedent { get; set; } |
386 | public int Consequent { get; set; } | 386 | public long Consequent { get; set; } |
387 | 387 | ||
388 | public override double Value | 388 | public override double Value |
389 | { | 389 | { |
390 | get | 390 | get |
391 | { | 391 | { |
392 | int c = Consequent; | 392 | // Asking for an update here means that the updater cannot access this value without infinite recursion. |
393 | // XXX: A slightly messy but simple solution may be to flick a flag so we can tell if this is being | ||
394 | // called by the pull action and just return the value. | ||
395 | if (StatType == StatType.Pull) | ||
396 | PullAction(this); | ||
397 | |||
398 | long c = Consequent; | ||
393 | 399 | ||
394 | // Avoid any chance of a multi-threaded divide-by-zero | 400 | // Avoid any chance of a multi-threaded divide-by-zero |
395 | if (c == 0) | 401 | if (c == 0) |
@@ -400,7 +406,7 @@ namespace OpenSim.Framework.Monitoring | |||
400 | 406 | ||
401 | set | 407 | set |
402 | { | 408 | { |
403 | throw new Exception("Cannot set value on a PercentageStat"); | 409 | throw new InvalidOperationException("Cannot set value on a PercentageStat"); |
404 | } | 410 | } |
405 | } | 411 | } |
406 | 412 | ||