Пример #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);
        }
Пример #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);
        }
Пример #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);
        }