示例#1
0
 protected void UpdateSampleValues(LogSample sample, int timestamp)
 {
     Sample.UpdateTime(timestamp);
     foreach (var group in sample.Groups.Values)
     {
         ((LogSampleGroup)group).Update(timestamp, true);
     }
 }
示例#2
0
 protected void InitializeSample(LogSample sample, int timestamp)
 {
     Sample.UpdateTime(timestamp);
     foreach (var group in sample.Groups.Values)
     {
         ((LogSampleGroup)group).Update(timestamp, false);
     }
 }
示例#3
0
        public LogSampleProvider(LogFileReader reader, IEnumerable <string> groups, int startTime, int endTime)
        {
            Reader    = reader;
            _groups   = groups.ToList();
            StartTime = startTime;
            EndTime   = endTime;

            // Make base sample.
            TimeLine = reader.Groups.SelectMany(x => x.Timeline.Keys).Distinct().OrderBy(x => x).ToList();

            // If this time doesn't exist; search the closest related.
            if (!TimeLine.Contains(startTime))
            {
                startTime = TimeLine.Select(x => x - startTime).OrderBy(x => x).Take(1).FirstOrDefault() + startTime;
            }

            Sample = new LogSample(this, startTime, groups.Select(reader.GetGroup));



            InitializeSample(Sample, startTime);
        }