예제 #1
0
        public void CreateResultsSummaryFile()
        {
            // Get the path to the result files.
            String          results_path = current_path + "\\Results\\";
            StreamWriter    summary_writer;
            String          timeStamp         = DateTime.Now.ToString(new CultureInfo("en-US"));
            List <Workload> workloads_results = ProcessResultFiles(results_path);

            //Write the file header only once.
            if (File.Exists(results_path + "summary.csv"))
            {
                // Append to the file
                summary_writer = new StreamWriter(results_path + "summary.csv", true);
            }
            else
            {
                // Create the file and write the header.
                summary_writer = new StreamWriter(results_path + "summary.csv");
                summary_writer.WriteLine("Workload,Mean IOps,Stdev IOps,Min IOps,Max IOps,Mean MBps,Stdev MBps,Min MBps,Max MBps,Latency (Avg Response),Threads Used, Timestamp");
            }

            for (int order_count = 0; order_count < workload_order.Length; order_count++)
            {
                for (int count = 0; count < workloads_results.Count; count++)
                {
                    Workload temp_workload = workloads_results[count];
                    if (temp_workload.file_name == workload_order[order_count])
                    {
                        String temp_line = String.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}", temp_workload.file_name, temp_workload.meanIOps, temp_workload.stdevIOps,
                                                         temp_workload.minIOps, temp_workload.maxIOps, temp_workload.meanMBps, temp_workload.stdevMBps,
                                                         temp_workload.minMBps, temp_workload.maxMBps, temp_workload.avgResponseTime, temp_workload.threadsUsed, timeStamp);
                        summary_writer.WriteLine(temp_line);
                    }
                }
            }

            summary_writer.Flush();
            summary_writer.Close();

            // Show the user the locatoin of the summary data.
            display_message(String.Format("The summary file can be located at '{0}'.", current_path + "\\Results\\summary.csv"));
        }
예제 #2
0
        private List <Workload> ProcessResultFiles(String results_path)
        {
            List <Workload> temp_workloads_data = new List <Workload>();

            string[] result_files = Directory.GetFiles(results_path, "inst*.csv");
            for (int order_count = 0; order_count < workload_order.Length; order_count++)
            {
                for (int count = 0; count < result_files.Length; count++)
                {
                    // Get the .csv file path.
                    String file_path = result_files[count];

                    // Get the file name from the file path.
                    String file_name = Path.GetFileNameWithoutExtension(file_path);

                    // Check to see if we have the right workload to run.
                    String temp_file_name = "inst" + workload_order[order_count];
                    if (file_name != temp_file_name)
                    {
                        continue;
                    }

                    int                   worker_num       = 0;
                    int                   maxWorkerNum     = 1;
                    bool                  is_first_entry   = true;
                    double                intervalSumIOps  = 0;
                    double                intervalSumMBps  = 0;
                    List <double>         IOps             = new List <double>();
                    List <double>         MBps             = new List <double>();
                    List <double>         avgResponseTime  = new List <double>();
                    DescriptiveStatistics statsIOps        = new DescriptiveStatistics(IOps, true);
                    DescriptiveStatistics statsMBps        = new DescriptiveStatistics(MBps, true);
                    DescriptiveStatistics statsAvgRespTime = new DescriptiveStatistics(avgResponseTime, true);


                    Workload temp_workload = new Workload();
                    temp_workload.orderNum  = order_count;
                    temp_workload.file_name = workload_order[order_count];

                    // Process the IOmeter generated result files one line at time.
                    StreamReader workload_file_reader = new StreamReader(file_path);
                    while (!workload_file_reader.EndOfStream)
                    {
                        String   temp_line       = workload_file_reader.ReadLine();
                        string[] temp_line_parts = temp_line.Split(',');

                        // Check to see if we are at a data row.
                        if (temp_line_parts.Length < 3)
                        {
                            continue;
                        }

                        // Calculate Workers
                        if (temp_line_parts[(int)Workload.ColumnHeader.TargetType] == "WORKER" && temp_line_parts[(int)Workload.ColumnHeader.TargetName].Contains("Worker"))
                        {
                            // Get the current IOps and MBps measurements.
                            double temp_IOps    = Convert.ToDouble(temp_line_parts[(int)Workload.ColumnHeader.IOps]);
                            double temp_MBps    = Convert.ToDouble(temp_line_parts[(int)Workload.ColumnHeader.MBps]);
                            double temp_latency = Convert.ToDouble(temp_line_parts[(int)Workload.ColumnHeader.AvgRespTime]);

                            // Store the running sum for the current interval.
                            intervalSumIOps += temp_IOps;
                            intervalSumMBps += temp_MBps;

                            // Check to see if we need to skip the first row worker number.
                            if (worker_num == 0 && is_first_entry)
                            {
                                is_first_entry = false;
                            }
                            else
                            {
                                worker_num = Convert.ToInt32(temp_line_parts[(int)Workload.ColumnHeader.TargetName].Split(' ')[1]);
                            }

                            // Check to see if the next value is the start of the next interval.
                            if (worker_num == 1)
                            {
                                // Store the completed interval sum.
                                IOps.Add(intervalSumIOps);
                                MBps.Add(intervalSumMBps);

                                // Reset sum for next interval.
                                intervalSumIOps = 0;
                                intervalSumMBps = 0;
                            }

                            // Find the number of threads used per workload
                            if (maxWorkerNum < worker_num)
                            {
                                maxWorkerNum = worker_num;
                            }

                            // Store the average response time.
                            avgResponseTime.Add(temp_latency);
                        }
                    }

                    workload_file_reader.Close();

                    // Remove IOmeter generated result files.
                    CleanUpIOmeterFile(file_path);
                    CleanUpIOmeterFile(file_path.Replace(temp_file_name, workload_order[order_count]));

                    statsIOps        = new DescriptiveStatistics(IOps, true);
                    statsMBps        = new DescriptiveStatistics(MBps, true);
                    statsAvgRespTime = new DescriptiveStatistics(avgResponseTime, true);

                    // Calculate Average IOps.
                    if (!Double.IsNaN(statsIOps.Mean))
                    {
                        temp_workload.meanIOps = statsIOps.Mean;
                    }

                    // Calculate IOps Standard Deviation.
                    if (!Double.IsNaN(statsIOps.StandardDeviation))
                    {
                        temp_workload.stdevIOps = statsIOps.StandardDeviation;
                    }

                    // Calculate max and min MBps.
                    if (!Double.IsNaN(statsIOps.Minimum))
                    {
                        temp_workload.minIOps = statsIOps.Minimum;
                    }
                    if (!Double.IsNaN(statsIOps.Maximum))
                    {
                        temp_workload.maxIOps = statsIOps.Maximum;
                    }

                    // Calculate Average MBps.
                    if (!Double.IsNaN(statsMBps.Mean))
                    {
                        temp_workload.meanMBps = statsMBps.Mean;
                    }

                    // Calculate MBps Standard Deviation.
                    if (!Double.IsNaN(statsMBps.StandardDeviation))
                    {
                        temp_workload.stdevMBps = statsMBps.StandardDeviation;
                    }

                    // Calculate max and min IOps.
                    if (!Double.IsNaN(statsMBps.Minimum))
                    {
                        temp_workload.minMBps = statsMBps.Minimum;
                    }
                    if (!Double.IsNaN(statsMBps.Maximum))
                    {
                        temp_workload.maxMBps = statsMBps.Maximum;
                    }

                    // Calculate the Average Response Time (Latency).
                    if (!Double.IsNaN(statsAvgRespTime.Mean))
                    {
                        temp_workload.avgResponseTime = statsAvgRespTime.Mean;
                    }

                    // Set the number of threads used
                    temp_workload.threadsUsed = maxWorkerNum;

                    // Store the filled out workload.
                    temp_workloads_data.Add(temp_workload);
                }
            }

            return(temp_workloads_data);
        }
예제 #3
0
        private List<Workload> ProcessResultFiles(String results_path)
        {
            List<Workload> temp_workloads_data = new List<Workload>();

            string[] result_files = Directory.GetFiles(results_path, "inst*.csv");
            for (int order_count = 0; order_count < workload_order.Length; order_count++)
            {
                for (int count = 0; count < result_files.Length; count++)
                {
                    // Get the .csv file path.
                    String file_path = result_files[count];

                    // Get the file name from the file path.
                    String file_name = Path.GetFileNameWithoutExtension(file_path);

                    // Check to see if we have the right workload to run.
                    String temp_file_name = "inst" + workload_order[order_count];
                    if (file_name != temp_file_name)
                        continue;

                    int worker_num = 0;
                    int maxWorkerNum = 1;
                    bool is_first_entry = true;
                    double intervalSumIOps = 0;
                    double intervalSumMBps = 0;
                    List<double> IOps = new List<double>();
                    List<double> MBps = new List<double>();
                    List<double> avgResponseTime = new List<double>();
                    DescriptiveStatistics statsIOps = new DescriptiveStatistics(IOps, true);
                    DescriptiveStatistics statsMBps = new DescriptiveStatistics(MBps, true);
                    DescriptiveStatistics statsAvgRespTime = new DescriptiveStatistics(avgResponseTime, true);

                    Workload temp_workload = new Workload();
                    temp_workload.orderNum = order_count;
                    temp_workload.file_name = workload_order[order_count];

                    // Process the IOmeter generated result files one line at time.
                    StreamReader workload_file_reader = new StreamReader(file_path);
                    while (!workload_file_reader.EndOfStream)
                    {
                        String temp_line = workload_file_reader.ReadLine();
                        string[] temp_line_parts = temp_line.Split(',');

                        // Check to see if we are at a data row.
                        if (temp_line_parts.Length < 3)
                            continue;

                        // Calculate Workers
                        if (temp_line_parts[(int)Workload.ColumnHeader.TargetType] == "WORKER" && temp_line_parts[(int)Workload.ColumnHeader.TargetName].Contains("Worker"))
                        {
                            // Get the current IOps and MBps measurements.
                            double temp_IOps = Convert.ToDouble(temp_line_parts[(int)Workload.ColumnHeader.IOps]);
                            double temp_MBps = Convert.ToDouble(temp_line_parts[(int)Workload.ColumnHeader.MBps]);
                            double temp_latency = Convert.ToDouble(temp_line_parts[(int)Workload.ColumnHeader.AvgRespTime]);

                            // Store the running sum for the current interval.
                            intervalSumIOps += temp_IOps;
                            intervalSumMBps += temp_MBps;

                            // Check to see if we need to skip the first row worker number.
                            if (worker_num == 0 && is_first_entry)
                                is_first_entry = false;
                            else
                                worker_num = Convert.ToInt32(temp_line_parts[(int)Workload.ColumnHeader.TargetName].Split(' ')[1]);

                            // Check to see if the next value is the start of the next interval.
                            if (worker_num == 1)
                            {
                                // Store the completed interval sum.
                                IOps.Add(intervalSumIOps);
                                MBps.Add(intervalSumMBps);

                                // Reset sum for next interval.
                                intervalSumIOps = 0;
                                intervalSumMBps = 0;
                            }

                            // Find the number of threads used per workload
                            if(maxWorkerNum < worker_num)
                            {
                                maxWorkerNum = worker_num;
                            }

                            // Store the average response time.
                            avgResponseTime.Add(temp_latency);
                        }
                    }

                    workload_file_reader.Close();

                    // Remove IOmeter generated result files.
                    CleanUpIOmeterFile(file_path);
                    CleanUpIOmeterFile(file_path.Replace(temp_file_name, workload_order[order_count]));

                    statsIOps = new DescriptiveStatistics(IOps, true);
                    statsMBps = new DescriptiveStatistics(MBps, true);
                    statsAvgRespTime = new DescriptiveStatistics(avgResponseTime, true);

                    // Calculate Average IOps.
                    if (!Double.IsNaN(statsIOps.Mean))
                        temp_workload.meanIOps = statsIOps.Mean;

                    // Calculate IOps Standard Deviation.
                    if (!Double.IsNaN(statsIOps.StandardDeviation))
                        temp_workload.stdevIOps = statsIOps.StandardDeviation;

                    // Calculate max and min MBps.
                    if (!Double.IsNaN(statsIOps.Minimum))
                        temp_workload.minIOps = statsIOps.Minimum;
                    if (!Double.IsNaN(statsIOps.Maximum))
                        temp_workload.maxIOps = statsIOps.Maximum;

                    // Calculate Average MBps.
                    if (!Double.IsNaN(statsMBps.Mean))
                        temp_workload.meanMBps = statsMBps.Mean;

                    // Calculate MBps Standard Deviation.
                    if (!Double.IsNaN(statsMBps.StandardDeviation))
                        temp_workload.stdevMBps = statsMBps.StandardDeviation;

                    // Calculate max and min IOps.
                    if (!Double.IsNaN(statsMBps.Minimum))
                        temp_workload.minMBps = statsMBps.Minimum;
                    if (!Double.IsNaN(statsMBps.Maximum))
                        temp_workload.maxMBps = statsMBps.Maximum;

                    // Calculate the Average Response Time (Latency).
                    if (!Double.IsNaN(statsAvgRespTime.Mean))
                        temp_workload.avgResponseTime = statsAvgRespTime.Mean;

                    // Set the number of threads used
                    temp_workload.threadsUsed = maxWorkerNum;

                    // Store the filled out workload.
                    temp_workloads_data.Add(temp_workload);
                }
            }

            return temp_workloads_data;
        }