コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public void AddCheckpointValue(CheckpointValue value)
 {
     _checkpointValues.Add(value);
 }