public double VerifyMetric(Workload.Models.Workload work, Workload.Models.WorkloadType metric) { double result = 0; if (metric == Workload.Models.WorkloadType.CPU) { result = work.CPUUtilization_Average; } else if (metric == Workload.Models.WorkloadType.NetworkIn) { result = work.NetworkIn_Average; } else if (metric == Workload.Models.WorkloadType.NetworkOut) { result = work.NetworkOut_Average; } else if (metric == Workload.Models.WorkloadType.Memory) { result = work.MemoryUtilization_Average; } else if (metric == Workload.Models.WorkloadType.FinalTarget) { result = work.FinalTarget; } return(result); }
public static List <Workload> ParseCsv(string path) { List <Workload> list = new List <Workload>(); string[] lines = System.IO.File.ReadAllLines(path); for (int i = 1; i < lines.Count(); i++) { string[] columns = lines[i].Split(','); Workload workload = new Workload(); workload.LineID = i; for (int col = 0; col < columns.Count(); col++) { if (col == 0) { workload.CPUUtilization_Average = double.Parse(columns[col]); } else if (col == 1) { workload.NetworkIn_Average = double.Parse(columns[col]); } else if (col == 2) { workload.NetworkOut_Average = double.Parse(columns[col]); } else if (col == 3) { workload.MemoryUtilization_Average = double.Parse(columns[col]); } else if (col == 4) { workload.FinalTarget = double.Parse(columns[col]); } } list.Add(workload); } return(list); }