コード例 #1
0
ファイル: Form1.cs プロジェクト: OldBucFan/Harfile
 private List <HarFile.Stat> calcAverages(List <HarFile.Stat> statlist, string type)
 // create the averages from accumulated totals
 {
     foreach (HarFile.Stat stat in statlist)
     {
         stat.avgBlocked  = stat.avgBlocked / stat.count;
         stat.avgConnect  = stat.avgConnect / stat.count;
         stat.avgDNS      = stat.avgDNS / stat.count;
         stat.avgDownload = stat.avgDownload / stat.count;
         stat.avgLoad     = stat.avgLoad / stat.count;
         stat.avgSend     = stat.avgSend / stat.count;
         stat.avgSSL      = stat.avgSSL / stat.count;
         stat.avgWait     = stat.avgWait / stat.count;
         double varNum = 0;
         foreach (HarFile.SimpleEntry entry in stat.entries)
         {
             varNum += Math.Pow(stat.avgLoad - entry.time, 2);
         }
         double sd = Math.Sqrt(varNum / stat.entries.Count);
         foreach (HarFile.SimpleEntry entry in stat.entries)
         {
             if (entry.time > stat.avgLoad + (3 * sd)) //outlier
             {
                 HarFile.Outlier ol = new HarFile.Outlier();
                 ol.avgTime      = stat.avgLoad;
                 ol.responseSize = entry.responseSize;
                 ol.sd           = (float)sd;
                 ol.sdCount      = (int)Math.Round((entry.time - stat.avgLoad) / sd);
                 ol.time         = entry.time;
                 ol.timestamp    = entry.timestamp;
                 ol.type         = type;
                 ol.url          = entry.url;
                 outliers.Add(ol);
             }
         }
     }
     return(statlist);
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: OldBucFan/Harfile
        // create the averages from accumulated totals
        private List<HarFile.Stat> calcAverages(List<HarFile.Stat> statlist, string type)
        {
            foreach (HarFile.Stat stat in statlist)
            {
                stat.avgBlocked = stat.avgBlocked / stat.count;
                stat.avgConnect = stat.avgConnect / stat.count;
                stat.avgDNS = stat.avgDNS / stat.count;
                stat.avgDownload = stat.avgDownload / stat.count;
                stat.avgLoad = stat.avgLoad / stat.count;
                stat.avgSend = stat.avgSend / stat.count;
                stat.avgSSL = stat.avgSSL / stat.count;
                stat.avgWait = stat.avgWait / stat.count;
                double varNum = 0;
                foreach (HarFile.SimpleEntry entry in stat.entries)
                {
                    varNum += Math.Pow(stat.avgLoad - entry.time, 2);
                }
                double sd = Math.Sqrt(varNum / stat.entries.Count);
                foreach (HarFile.SimpleEntry entry in stat.entries)
                {
                    if (entry.time > stat.avgLoad + (3 * sd)) //outlier
                    {
                        HarFile.Outlier ol = new HarFile.Outlier();
                        ol.avgTime = stat.avgLoad;
                        ol.responseSize = entry.responseSize;
                        ol.sd = (float) sd;
                        ol.sdCount = (int) Math.Round((entry.time - stat.avgLoad) / sd);
                        ol.time = entry.time;
                        ol.timestamp = entry.timestamp;
                        ol.type = type;
                        ol.url = entry.url;
                        outliers.Add(ol);
                    }
                }

            }
            return statlist;
        }