/// <summary> /// Add data from another stat, for aggregation. /// </summary> /// <param name="stat2">The added stat data.</param> public virtual void Add(TaskStats stat2) { numRuns += stat2.NumRuns; elapsed += stat2.Elapsed; maxTotMem += stat2.MaxTotMem; maxUsedMem += stat2.MaxUsedMem; count += stat2.Count; if (round != stat2.round) { round = -1; // no meaning if aggregating tasks of different round. } if (countsByTime != null && stat2.countsByTime != null) { if (countsByTimeStepMSec != stat2.countsByTimeStepMSec) { throw new InvalidOperationException("different by-time msec step"); } if (countsByTime.Length != stat2.countsByTime.Length) { throw new InvalidOperationException("different by-time msec count"); } for (int i = 0; i < stat2.countsByTime.Length; i++) { countsByTime[i] += stat2.countsByTime[i]; } } }
public virtual object Clone() { TaskStats c = (TaskStats)base.MemberwiseClone(); if (c.countsByTime != null) { c.countsByTime = (int[])c.countsByTime.Clone(); } return(c); }
/// <summary> /// mark the end of a task /// </summary> public virtual void MarkTaskEnd(TaskStats stats, int count) { lock (this) { int numParallelTasks = nextTaskRunNum - 1 - stats.TaskRunNum; // note: if the stats were cleared, might be that this stats object is // no longer in points, but this is just ok. stats.MarkEnd(numParallelTasks, count); } }
/// <summary> /// Mark that a task is starting. /// Create a task stats for it and store it as a point. /// </summary> /// <param name="task">The starting task.</param> /// <param name="round">The new task stats created for the starting task.</param> /// <returns></returns> public virtual TaskStats MarkTaskStart(PerfTask task, int round) { lock (this) { TaskStats stats = new TaskStats(task, NextTaskRunNum(), round); this.currentStats = stats; points.Add(stats); return(stats); } }
/// <summary> /// mark the end of a task /// </summary> public virtual void MarkTaskEnd(TaskStats stats, int count) { UninterruptableMonitor.Enter(this); try { int numParallelTasks = nextTaskRunNum - 1 - stats.TaskRunNum; // note: if the stats were cleared, might be that this stats object is // no longer in points, but this is just ok. stats.MarkEnd(numParallelTasks, count); } finally { UninterruptableMonitor.Exit(this); } }
/// <summary> /// Mark that a task is starting. /// Create a task stats for it and store it as a point. /// </summary> /// <param name="task">The starting task.</param> /// <param name="round">The new task stats created for the starting task.</param> /// <returns></returns> public virtual TaskStats MarkTaskStart(PerfTask task, int round) { UninterruptableMonitor.Enter(this); try { TaskStats stats = new TaskStats(task, NextTaskRunNum(), round); this.currentStats = stats; points.Add(stats); return(stats); } finally { UninterruptableMonitor.Exit(this); } }