public static List <CheckpointValue> Load(string file) { List <CheckpointValue> items = new List <CheckpointValue>(); using (StreamReader reader = new StreamReader(file)) { while (!reader.EndOfStream) { var line = reader.ReadLine(); var values = line.Split(','); int pcount = Convert.ToInt32(values[1]); int tcount = Convert.ToInt32(values[2]); int tMem = Convert.ToInt32(values[3]); int ram = Convert.ToInt32(values[4]); int swap = Convert.ToInt32(values[5]); double ctime = Convert.ToDouble(values[6]); int csize = Convert.ToInt32(values[7]); double rtime = Convert.ToDouble(values[8]); double from = 0; double to = 0; if (values.Count() > 9) { from = Convert.ToDouble(values[9]); to = Convert.ToDouble(values[10]); } var item = new CheckpointValue(pcount, tcount, tMem, ram, swap, ctime, csize, rtime, from, to); items.Add(item); } } return(items); }
public CheckpointValue GetMaxCheckpointValue() { int pcount = _checkpointValues.Select(x => x.ProcessCount).Max(); int tcount = _checkpointValues.Select(x => x.TaskCount).Max(); int tMem = _checkpointValues.Select(x => x.TotalMemory).Max(); int ram = _checkpointValues.Select(x => x.MemoryInRam).Max(); int swap = _checkpointValues.Select(x => x.MemorySwapped).Max(); double ctime = _checkpointValues.Select(x => x.CheckPointTime).Max(); int csize = _checkpointValues.Select(x => x.CheckPointSize).Max(); double rtime = _checkpointValues.Select(x => x.RestorationTime).Max(); double from = _checkpointValues.Select(x => x.CopyFromTime).Max(); double to = _checkpointValues.Select(x => x.CopyToTime).Max(); var max = new CheckpointValue(pcount, tcount, tMem, ram, swap, ctime, csize, rtime, from, to); return(max); }
public CheckpointValue GetAverageCheckpointValue() { int pcount = Convert.ToInt32(_checkpointValues.Select(x => x.ProcessCount).Average()); int tcount = Convert.ToInt32(_checkpointValues.Select(x => x.TaskCount).Average()); int tMem = Convert.ToInt32(_checkpointValues.Select(x => x.TotalMemory).Average()); int ram = Convert.ToInt32(_checkpointValues.Select(x => x.MemoryInRam).Average()); int swap = Convert.ToInt32(_checkpointValues.Select(x => x.MemorySwapped).Average()); double ctime = _checkpointValues.Select(x => x.CheckPointTime).Average(); int csize = Convert.ToInt32(_checkpointValues.Select(x => x.CheckPointSize).Average()); double rtime = _checkpointValues.Select(x => x.RestorationTime).Average(); double from = _checkpointValues.Select(x => x.CopyFromTime).Average(); double to = _checkpointValues.Select(x => x.CopyToTime).Average(); var average = new CheckpointValue(pcount, tcount, tMem, ram, swap, ctime, csize, rtime, from, to); return(average); }
public void AddCheckpointValue(CheckpointValue value) { _checkpointValues.Add(value); }