Exemplo n.º 1
0
        /// <summary>
        /// Implements HistogramController interface
        /// </summary>
        public override string GetInfoForCharacterRange(HistogramCharacterIndex start, HistogramCharacterIndex end, Histogram histogram)
        {
            var rangeStart = GetStartTimeForBucket(start);
            var rangeEnd   = GetStartTimeForBucket(end);

            var cumStats = "";

            if (start != HistogramCharacterIndex.Invalid && end != HistogramCharacterIndex.Invalid && start < end)
            {
                float cumStart = 0;
                for (int i = 0; i < (int)start; i++)
                {
                    cumStart += histogram[i];
                }

                float cum    = cumStart;
                float cumMax = cumStart;
                HistogramCharacterIndex cumMaxIdx = start;

                for (HistogramCharacterIndex i = start; i < end; i++)
                {
                    var val = histogram[(int)i];
                    cum += val;
                    if (cum > cumMax)
                    {
                        cumMax    = cum;
                        cumMaxIdx = i + 1;
                    }
                }
                cumStats = string.Format(" CumStart:{0,9:n3}M Cum:{1,9:n3}M  CumMax:{2,9:n3}M at {3,11:n3}ms",
                                         cumStart / 1000000, cum / 1000000, cumMax / 1000000, GetStartTimeForBucket(cumMaxIdx));
            }

            return(string.Format("TimeRange = {0,11:n3} - {1,11:n3} Duration {2,9:n3}ms{3}", rangeStart, rangeEnd, rangeEnd - rangeStart, cumStats));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Implements HistogramController interface
 /// </summary>
 public override string GetDisplayString(Histogram histogram)
 {
     return(HistogramString(histogram, histogram.Count, Scale));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Get the human-readable names for all scenarios contained in a range of histogram characters.
        /// </summary>
        /// <param name="start">The (inclusive) start index of the range.</param>
        /// <param name="end">The (exclusive) end index of the range.</param>
        /// <param name="histogram">The histogram.</param>
        /// <returns>A comma-separated list of scenario names contained in that range.</returns>
        public override string GetInfoForCharacterRange(HistogramCharacterIndex start, HistogramCharacterIndex end, Histogram histogram)
        {
            var sb = new StringBuilder();

            for (var bucket = start; bucket < end; bucket++)
            {
                if (bucket == start)
                {
                    sb.Append("Scenarios: ");
                }
                foreach (int scenario in m_scenariosFromCharacter[(int)bucket])
                {
                    sb.AppendFormat("{0}, ", GetNameForScenario(scenario));
                }
            }
            if (2 <= sb.Length)
            {
                sb.Remove(sb.Length - 2, 2);
            }
            return(sb.ToString());
        }
Exemplo n.º 4
0
 /// <summary>
 /// Add a sample to a histogram controlled by this HistogramController.
 /// </summary>
 /// <param name="histogram">The histogram to add the sample to.</param>
 /// <param name="sample">The sample to add.</param>
 public override void AddSample(Histogram histogram, StackSourceSample sample)
 {
     histogram.AddMetric(sample.Metric, sample.Scenario);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Convert a histogram into its display string.
 /// </summary>
 /// <param name="histogram">The histogram to convert to a string.</param>
 /// <returns>A string suitable for GUI display.</returns>
 public abstract string GetDisplayString(Histogram histogram);
Exemplo n.º 6
0
 /// <summary>
 /// Gets human-readable information about a range of histogram characters.
 /// </summary>
 /// <param name="start">The start character index (inclusive).</param>
 /// <param name="end">The end character index (exclusive).</param>
 /// <param name="histogram">The histogram.</param>
 /// <returns>A string containing information about the contents of that character range.</returns>
 public abstract string GetInfoForCharacterRange(HistogramCharacterIndex start, HistogramCharacterIndex end, Histogram histogram);
Exemplo n.º 7
0
 // Abstract methods
 /// <summary>
 /// Add a sample to the histogram for a node.
 /// </summary>
 /// <param name="histogram">The histogram to add this sample to. Must be controlled by this HistogramController.</param>
 /// <param name="sample">The sample to add.</param>
 /// <remarks>
 /// Overriding classes are responsible for extracting the metric, scaling the metric,
 /// determining the appropriate bucket or buckets, and adding the metric to the histogram using <see cref="Histogram.AddMetric"/>.
 /// </remarks>
 public abstract void AddSample(Histogram histogram, StackSourceSample sample);