From 038528dc80e0fe03956d61872ba30a887b2890a1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 15 Nov 2012 02:02:59 +0000 Subject: Make PacketPool class stats pull stats instead of push stats so they can be lifted up into LLUDPServer and be distiguished by scene name --- OpenSim/Framework/Monitoring/StatsManager.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') 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 public class PercentageStat : Stat { - public int Antecedent { get; set; } - public int Consequent { get; set; } + public long Antecedent { get; set; } + public long Consequent { get; set; } public override double Value { get { - int c = Consequent; + // Asking for an update here means that the updater cannot access this value without infinite recursion. + // XXX: A slightly messy but simple solution may be to flick a flag so we can tell if this is being + // called by the pull action and just return the value. + if (StatType == StatType.Pull) + PullAction(this); + + long c = Consequent; // Avoid any chance of a multi-threaded divide-by-zero if (c == 0) @@ -400,7 +406,7 @@ namespace OpenSim.Framework.Monitoring set { - throw new Exception("Cannot set value on a PercentageStat"); + throw new InvalidOperationException("Cannot set value on a PercentageStat"); } } -- cgit v1.1