Esempio n. 1
0
        private static void WriteNetworkAnalysis(string setDate, string fileNamePrefix, Func <Network, object> selector, params string[] services)
        {
            string[] headers = { "Protocol" };
            DataSet  set     = dao.GetByDate(setDate);

            var fileWriter = new InvertedCSVFile();

            fileWriter.AddList(headers.Union(services).ToList());

            foreach (var latency in latencies)
            {
                foreach (var protocol in protocols)
                {
                    List <string> fileRecord = new List <string>();
                    fileRecord.Add($"{protocol} ({latency} ms)");

                    foreach (var serviceName in services)
                    {
                        var record = dao.GetNetworkRecord(set.Id, protocol, latency, serviceName);
                        fileRecord.Add(selector(record).ToString());
                    }

                    fileWriter.AddList(fileRecord);
                }
            }

            string filename = $"{fileNamePrefix}-{nowString}.csv";

            fileWriter.WriteToFile(filename);

            Console.WriteLine("Written results to " + filename);
        }
Esempio n. 2
0
        private static void WriteRequestAnalysis(string setDate)
        {
            DataSet set = dao.GetByDate(setDate);

            var fileWriter = new InvertedCSVFile();

            List <string> header = new List <string>();

            header.Add("Protocol");
            header.Add("Latency");
            header.AddRange(testNames.ToList());

            fileWriter.AddList(header);

            foreach (var latency in latencies)
            {
                foreach (var protocol in protocols)
                {
                    DoRequestAnalysis(latency, protocol, set.Id, dao, fileWriter, (i, p, l) => dao.GetStats(i, p, l), testNames);
                }
            }

            string filename = $"results-{nowString}.csv";

            fileWriter.WriteToFile(filename);

            Console.WriteLine("Written results to " + filename);
        }
Esempio n. 3
0
        private static void Append(string protocol, int latency, Dictionary <string, StatEntry> stats, InvertedCSVFile file, Func <StatEntry, object> selector, string[] entryHeaders)
        {
            var fileEntryErr = new List <string>();

            fileEntryErr.Add($"{protocol} ({latency} ms)");
            fileEntryErr.Add(latency.ToString());

            foreach (var testName in entryHeaders)
            {
                fileEntryErr.Add(selector(stats[testName]).ToString());
            }

            file.AddList(fileEntryErr);
        }
Esempio n. 4
0
        private static void DoRequestAnalysis(int latency, string protocol, int setId, DataSetDao dao, InvertedCSVFile file, Func <int, string, int, Dictionary <string, StatEntry> > selector, string[] entryHeaders)
        {
            Console.Write($"Analyzing requests for protocol {protocol}/{latency}ms -> ");

            //var stats = dao.GetStats(setId, protocol, latency);
            var stats = selector(setId, protocol, latency);

            Append(protocol, latency, stats, file, t => t.Mean, entryHeaders);
            Append(protocol, latency, stats, file, t => t.StandardDeviation, entryHeaders);
            //Append(protocol, latency, stats, file, t => GetMedian(latency, protocol, setId, dao));

            Console.WriteLine("DONE!");
        }