예제 #1
0
 public StatsBaseItem(StatisticsData statisticsData, int colorIndex = -1)
 {
     maxRps = statisticsData.MaxRps;
     avgRps = statisticsData.AvgRps;
     value  = statisticsData.Count;
     if (colorIndex != -1)
     {
         this.color = colorIndex;
     }
     else
     {
         if (int.TryParse(statisticsData.Name, out int code))
         {
             if (code < 200)
             {
                 this.color = 0;
             }
             else if (code < 300)
             {
                 this.color = 1;
             }
             else if (code < 400)
             {
                 this.color = 2;
             }
             else if (code < 500)
             {
                 this.color = 3;
             }
             else if (code < 6)
             {
                 this.color = 4;
             }
             else
             {
                 this.color = 5;
             }
         }
     }
     name = statisticsData.Name;
     rps  = statisticsData.Rps;
 }
예제 #2
0
        public StatisticsData GetData()
        {
            StatisticsData result = new StatisticsData();

            result.Count  = Count;
            result.Rps    = Rps;
            result.MaxRps = MaxRps;
            result.AvgRps = AvgRps;

            result.Name = Name;
            result.Times.Add(Time10ms);
            result.Times.Add(Time20ms);
            result.Times.Add(Time50ms);
            result.Times.Add(Time100ms);
            result.Times.Add(Time200ms);
            result.Times.Add(Time500ms);
            result.Times.Add(Time1000ms);
            result.Times.Add(Time2000ms);
            result.Times.Add(Time5000ms);
            result.Times.Add(Time10000ms);
            result.Times.Add(TimeOtherms);
            double now  = TimeWatch.GetTotalSeconds();
            double time = now - mLastRpsTime;

            int value = (int)((double)(ms10 - ms10LastCount) / time);

            ms10LastCount = ms10;
            result.TimesRps.Add(value);


            value         = (int)((double)(ms20 - ms20LastCount) / time);
            ms20LastCount = ms20;
            result.TimesRps.Add(value);


            value         = (int)((double)(ms50 - ms50LastCount) / time);
            ms50LastCount = ms50;
            result.TimesRps.Add(value);


            value          = (int)((double)(ms100 - ms100LastCount) / time);
            ms100LastCount = ms100;
            result.TimesRps.Add(value);


            value          = (int)((double)(ms200 - ms200LastCount) / time);
            ms200LastCount = ms200;
            result.TimesRps.Add(value);


            value          = (int)((double)(ms500 - ms500LastCount) / time);
            ms500LastCount = ms500;
            result.TimesRps.Add(value);


            value           = (int)((double)(ms1000 - ms1000LastCount) / time);
            ms1000LastCount = ms1000;
            result.TimesRps.Add(value);


            value           = (int)((double)(ms2000 - ms2000LastCount) / time);
            ms2000LastCount = ms2000;
            result.TimesRps.Add(value);


            value           = (int)((double)(ms5000 - ms5000LastCount) / time);
            ms5000LastCount = ms5000;
            result.TimesRps.Add(value);


            value            = (int)((double)(ms10000 - ms10000LastCount) / time);
            ms10000LastCount = ms10000;
            result.TimesRps.Add(value);


            value            = (int)((double)(msOther - msOtherLastCount) / time);
            msOtherLastCount = msOther;
            result.TimesRps.Add(value);


            mLastRpsTime = now;
            return(result);
        }