Esempio n. 1
0
        ///
        public TimedRatings(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            Times = (List <DateTime>)info.GetValue("Times", typeof(List <DateTime>));

            EarliestTime = Times.Min();
            LatestTime   = Times.Max();
        }
Esempio n. 2
0
 internal static void ToString_Terse()
 {
     Tools.Asserter.Is("0", Times.Never.ToString());
     Tools.Asserter.Is("1", Times.Once.ToString());
     Tools.Asserter.Is("2", Times.Exactly(2).ToString());
     Tools.Asserter.Is("[0-1]", Times.Max(1).ToString());
     Tools.Asserter.Is("[1-*]", Times.Min(1).ToString());
     Tools.Asserter.Is("[1-2]", Times.Between(1, 2).ToString());
 }
Esempio n. 3
0
 public override string ToString()
 {
     if (Times.Count > 0)
     {
         Times.Sort();
         var median = Times.Sum() / (Times.Count / 2);
         return($":: {TimeTakenMs,-15:N0} {SuccessResponses,-10} {ErrorResponses,-10} {Times.Min(),-10:N4}{Times.Max(),-10:N2}{Times.Average(),-10:N4}{median,-10:N4}");
     }
     return($";; no response.");
 }
        /// <summary>
        /// Outputs the profiler information as an HTML table
        /// </summary>
        /// <returns>Table containing profiler information</returns>
        public virtual string ToHTML()
        {
            CompileData();
            StringBuilder Builder = new StringBuilder();

            if (Level == 0)
            {
                Builder.Append("<table><tr><th>Called From</th><th>Function Name</th><th>Total Time</th><th>Max Time</th><th>Min Time</th><th>Average Time</th><th>Times Called</th></tr>");
            }
            Builder.AppendFormat(CultureInfo.InvariantCulture, "<tr><td>{0}</td><td>", CalledFrom);
            if (Level == 0)
            {
                Builder.AppendFormat(CultureInfo.InvariantCulture, "{0}</td><td>{1}ms</td><td>{2}ms</td><td>{3}ms</td><td>{4}ms</td><td>{5}</td></tr>", Function, 0, 0, 0, 0, Times.Count);
            }
            else
            {
                Builder.AppendFormat(CultureInfo.InvariantCulture, "{0}</td><td>{1}ms</td><td>{2}ms</td><td>{3}ms</td><td>{4}ms</td><td>{5}</td></tr>", Function, Times.Sum(), Times.Max(), Times.Min(), string.Format(CultureInfo.InvariantCulture, "{0:0.##}", Times.Average()), Times.Count);
            }
            foreach (Profiler Child in Children)
            {
                Builder.AppendLineFormat(Child.ToHTML());
            }
            if (Level == 0)
            {
                Builder.Append("</table>");
            }
            return(Builder.ToString());
        }
Esempio n. 5
0
 internal static void Min_Works(int value)
 {
     Tools.Asserter.Is(false, Times.Min(value).IsInRange(value - 1));
     Tools.Asserter.Is(true, Times.Min(value).IsInRange(value));
     Tools.Asserter.Is(true, Times.Min(value).IsInRange(value + 1));
 }
        /// <summary>
        /// Outputs the profiler information as an HTML table
        /// </summary>
        /// <returns>Table containing profiler information</returns>
        public override string ToHTML()
        {
            CompileData();
            StringBuilder Builder = new StringBuilder();

            Builder.AppendFormat(CultureInfo.InvariantCulture, "<tr><td>{0}</td><td>", CalledFrom);
            Builder.AppendFormat(CultureInfo.InvariantCulture, "{0}</td><td>{1}ms</td><td>{2}ms</td><td>{3}ms</td><td>{4}ms</td><td>{5}</td></tr>", Query, Times.Sum(), Times.Max(), Times.Min(), string.Format(CultureInfo.InvariantCulture, "{0:0.##}", Times.Average()), Times.Count);
            foreach (Profiler Child in Children)
            {
                Builder.AppendLineFormat(Child.ToHTML());
            }
            return(Builder.ToString());
        }
Esempio n. 7
0
 internal static void ToExpectedCalls_MatchesTimes(Times times)
 {
     Tools.Asserter.Is(Times.Min(1).ToString(), Behavior.None().ToExpectedCalls());
     Tools.Asserter.Is(times.ToString(), Behavior.None(times).ToExpectedCalls());
 }