public override int GetHashCode()
 {
     unchecked
     {
         return(((CounterCategory != null ? CounterCategory.GetHashCode() : 0) * 397) ^ (CounterName != null ? CounterName.GetHashCode() : 0));
     }
 }
示例#2
0
        public Counter Get(CounterCategory category)
        {
            Counter counter = cabinets.Find(x => x.category == category);

            if (counter == null)
            {
                counter = new Counter()
                {
                    category = category,
                    name = category.ToString(),
                    time = -1,
                    commodities = new List<Commodity>()
                };

                for (int i = 0; i < UnityEngine.Random.Range(5, 20); i++)
                {
                    counter.commodities.Add(new Commodity()
                    {
                        props = new List<Prop>()
                        {
                            new Prop()
                            {
                                identification = 1001,
                                number = 1,
                                parallelism = (uint)UnityEngine.Random.Range(0,4),
                            }
                        }
                    });
                }
                cabinets.Add(counter);
            }
            return counter;
        }
        void AppendCategory(TreeIter it, CounterCategory cat)
        {
            TreeIter catIt;

            if (it.Equals(TreeIter.Zero))
            {
                catIt = store.AppendValues(false, cat.Name, cat, null, false);
            }
            else
            {
                catIt = store.AppendValues(it, false, cat.Name, cat, null, false);
            }

            foreach (Counter c in cat.Counters)
            {
                store.AppendValues(catIt, false, c.Name, null, c, true);
            }
        }
示例#4
0
        void AppendCategory(CounterCategory cat)
        {
            IEnumerable <Counter> counters = cat.Counters.Where(c => c is TimerCounter);

            if (counters.Any())
            {
                TimeSpan time  = TimeSpan.Zero;
                TimeSpan min   = TimeSpan.MaxValue;
                TimeSpan max   = TimeSpan.Zero;
                int      count = 0;
                foreach (TimerCounter c in counters)
                {
                    if (c.CountWithDuration > 0)
                    {
                        time  += c.TotalTime;
                        count += c.CountWithDuration;
                        if (c.MinTime < min)
                        {
                            min = c.MinTime;
                        }
                        if (c.MaxTime > max)
                        {
                            max = c.MaxTime;
                        }
                    }
                }
                double avg = count > 0 ? (time.TotalMilliseconds / count) : 0d;
                if (count == 0)
                {
                    min = TimeSpan.Zero;
                }

                TreeIter it = store.AppendValues(null, cat.Name, count, (float)time.TotalMilliseconds, (float)avg, (double)min.TotalMilliseconds, (double)max.TotalMilliseconds, false, null, null, true, false, normalColor);
                foreach (Counter c in counters)
                {
                    AppendCounter(it, (TimerCounter)c);
                }
            }
        }
 void UpdateSelectedCounters(TreeIter it)
 {
     do
     {
         Counter c = (Counter)store.GetValue(it, 3);
         if (c != null)
         {
             store.SetValue(it, 0, selection.Contains(c));
         }
         else
         {
             CounterCategory cat = (CounterCategory)store.GetValue(it, 2);
             if (cat != null)
             {
                 TreeIter ci;
                 if (store.IterChildren(out ci, it))
                 {
                     UpdateSelectedCounters(ci);
                 }
             }
         }
     }while (store.IterNext(ref it));
 }
示例#6
0
 public IPerformanceCounter Create(CounterCategory category, string counterName, string instanceName)
 {
     return(new NullPerformanceCounter());
 }
示例#7
0
 public bool Equal(CounterCategory category)
 {
     return(this.category == category);
 }
 public IPerformanceCounter Create(CounterCategory category, string counterName, string instanceName)
 {
     return new NullPerformanceCounter();
 }
示例#9
0
        public IPerformanceCounter Create(CounterCategory category, string counterName, string instanceName)
        {
            var counter = new PerformanceCounter(category.Name, counterName, instanceName, false);

            return(new WindowsPerformanceCounter(counter));
        }
 public IPerformanceCounter Create(CounterCategory category, string counterName, string instanceName)
 {
     return new StatsDPerformanceCounter(_config, category.Name, counterName, instanceName );
 }
示例#11
0
 public IPerformanceCounter Create(CounterCategory category, string counterName, string instanceName)
 {
     return(new StatsDPerformanceCounter(_config, category.Name, counterName, instanceName));
 }
 public IPerformanceCounter Create(CounterCategory category, string counterName, string instanceName)
 {
     var counter = new PerformanceCounter(category.Name, counterName, instanceName, false);
     return new WindowsPerformanceCounter(counter);
 }