Esempio n. 1
0
        /// <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];
                }
            }
        }
Esempio n. 2
0
        public virtual object Clone()
        {
            TaskStats c = (TaskStats)base.MemberwiseClone();

            if (c.countsByTime != null)
            {
                c.countsByTime = (int[])c.countsByTime.Clone();
            }
            return(c);
        }
Esempio n. 3
0
 /// <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);
     }
 }
Esempio n. 4
0
 /// <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);
     }
 }
Esempio n. 5
0
 /// <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);
     }
 }
Esempio n. 6
0
 /// <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);
     }
 }