예제 #1
0
        public double CalcDiff(CounterUnit unit)
        {
            double octets;

            if (Previous > Current)
            {
                if (Previous < Math.Pow(2, 32))
                {
                    octets = Math.Pow(2, 32) - Previous + Current;
                }
                else if (Previous < Math.Pow(2, 64))
                {
                    octets = Math.Pow(2, 64) - Previous + Current;
                }
                else
                {
                    octets = 0;
                }
            }
            else
            {
                octets = Current - Previous;
            }

            if (unit == CounterUnit.Bits)
            {
                Diff = octets * 8 / ElapsedTime / 1000;
            }
            else
            {
                Diff = octets / ElapsedTime / 1000;
            }
            return(Diff);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         return((CounterUnit.GetHashCode() * 397) ^ DenominatorUnit.GetHashCode());
     }
 }
예제 #3
0
 protected Counter(string category, string name, CounterType type, CounterLevel level, CounterKind kind, CounterUnit unit)
 {
     Category = category;
     Name     = name;
     Type     = type;
     Level    = level;
     Kind     = kind;
     Unit     = unit;
 }
        public IReadOnlyList <DecomposableUnitItem> Decompose()
        {
            // generator : FractionUnitGenerator.Add_Decompose
            var counterUnit = CounterUnit.GetBasicUnit();

            return(new []
            {
                new DecomposableUnitItem(counterUnit.Unit, counterUnit.Power),
                new DecomposableUnitItem(DenominatorUnit, -1)
            });

            /*
             * var decomposer = new UnitDecomposer();
             * decomposer.Add(CounterUnit, 1);
             * decomposer.Add(DenominatorUnit, -1);
             * return decomposer.Items;
             */
        }
 public bool Equals(PlanarDensityUnit other)
 {
     return(CounterUnit.Equals(other.CounterUnit) && DenominatorUnit.Equals(other.DenominatorUnit));
 }
예제 #6
0
 public bool Equals(IrradianceUnit other)
 {
     return(CounterUnit.Equals(other.CounterUnit) && DenominatorUnit.Equals(other.DenominatorUnit));
 }
예제 #7
0
        public static CounterItem <T> Retrieve(string category, string name, CounterType type, CounterLevel level, CounterKind kind, CounterUnit unit, List <CounterItemValue <T> > values)
        {
            var item = ReferencePool <CounterItem <T> > .Shared.New();

            item.Environment = Core.EnvironmentName;
            item.Application = Core.ApplicationName;
            item.Category    = category;
            item.Name        = name;
            item.Type        = type;
            item.Level       = level;
            item.Kind        = kind;
            item.Unit        = unit;
            item.Values      = values;
            return(item);
        }
예제 #8
0
 internal DecimalCounter(string category, string name, CounterType type, CounterLevel level, CounterKind kind, CounterUnit unit) : base(category, name, type, level, kind, unit)
 {
 }
 public bool Equals(AccelerationUnit other)
 {
     return(CounterUnit.Equals(other.CounterUnit) && DenominatorUnit.Equals(other.DenominatorUnit));
 }
예제 #10
0
 public bool Equals(SpecificHeatCapacityUnit other)
 {
     return(CounterUnit.Equals(other.CounterUnit) && DenominatorUnit.Equals(other.DenominatorUnit));
 }
예제 #11
0
 public bool Equals(MassStreamUnit other)
 {
     return(CounterUnit.Equals(other.CounterUnit) && DenominatorUnit.Equals(other.DenominatorUnit));
 }
예제 #12
0
 public bool Equals(VelocityUnit other)
 {
     return(CounterUnit.Equals(other.CounterUnit) && DenominatorUnit.Equals(other.DenominatorUnit));
 }
예제 #13
0
 public bool Equals(LinearForceUnit other)
 {
     return(CounterUnit.Equals(other.CounterUnit) && DenominatorUnit.Equals(other.DenominatorUnit));
 }
 public bool Equals(EnergyMassDensityUnit other)
 {
     return(CounterUnit.Equals(other.CounterUnit) && DenominatorUnit.Equals(other.DenominatorUnit));
 }
 public bool Equals(PressureDropUnit other)
 {
     return(CounterUnit.Equals(other.CounterUnit) && DenominatorUnit.Equals(other.DenominatorUnit));
 }