Esempio n. 1
0
        public RateListViewItem(IStatsCounter ctr, int filter_pid) :
            base(ctr.name)
        {
            StatsCounterRate rate = ctr as StatsCounterRate;

            Name = rate.name;
            SubItems.Add(NewSubItem());
            SubItems.Add(NewSubItem());
            SubItems.Add(NewSubItem());
            Update(ctr, filter_pid);
        }
Esempio n. 2
0
 // If we have two StatsTableEntries with the same name,
 // attempt to upgrade them to a higher level type.
 // Example:  A counter + a timer == a rate!
 private void UpgradeCounter(IStatsCounter old_counter, IStatsCounter counter)
 {
     if (old_counter is StatsCounter && counter is StatsTimer)
     {
         StatsCounterRate rate = new StatsCounterRate(old_counter as StatsCounter,
                                                      counter as StatsTimer);
         counters_.Remove(old_counter);
         counters_.Add(rate);
     }
     else if (old_counter is StatsTimer && counter is StatsCounter)
     {
         StatsCounterRate rate = new StatsCounterRate(counter as StatsCounter,
                                                      old_counter as StatsTimer);
         counters_.Remove(old_counter);
         counters_.Add(rate);
     }
 }
Esempio n. 3
0
        public override void Update(IStatsCounter counter, int filter_pid)
        {
            Debug.Assert(counter is StatsCounterRate);

            StatsCounterRate new_rate = counter as StatsCounterRate;
            int new_count             = new_rate.GetCount(filter_pid);
            int new_time = new_rate.GetTime(filter_pid);
            int old_avg  = Tag != null ? (int)Tag : 0;
            int new_avg  = new_count > 0 ? (new_time / new_count) : 0;
            int delta    = new_avg - old_avg;

            SetSubItem(SubItems[column_count_index], new_count);
            SetSubItem(SubItems[column_time_index], new_time);
            if (SetSubItem(SubItems[column_avg_index], new_avg))
            {
                ColorItem(delta);
            }
            Tag = new_avg;
        }
Esempio n. 4
0
 // If we have two StatsTableEntries with the same name,
 // attempt to upgrade them to a higher level type.
 // Example:  A counter + a timer == a rate!
 private void UpgradeCounter(IStatsCounter old_counter, IStatsCounter counter)
 {
     if (old_counter is StatsCounter && counter is StatsTimer)
       {
     StatsCounterRate rate = new StatsCounterRate(old_counter as StatsCounter,
                                   counter as StatsTimer);
     counters_.Remove(old_counter);
     counters_.Add(rate);
       }
       else if (old_counter is StatsTimer && counter is StatsCounter)
       {
     StatsCounterRate rate = new StatsCounterRate(counter as StatsCounter,
                                  old_counter as StatsTimer);
     counters_.Remove(old_counter);
     counters_.Add(rate);
       }
 }