Exemplo n.º 1
0
        public RouteValueDictionary GetRouteValues(string memberName)
        {
            var prefix = String.IsNullOrWhiteSpace(memberName)
                ? null
                : memberName + '.';
            var result = new RouteValueDictionary();

            if (Source != null)
            {
                foreach (var item in Source.GetRouteValues(nameof(Source)))
                {
                    result.Add(prefix + item.Key, item.Value);
                }
            }
            if (MinLevel != null && MinLevel.Value != DefaultMinLevel)
            {
                foreach (var item in MinLevel.GetRouteValues(nameof(MinLevel)))
                {
                    result.Add(prefix + item.Key, item.Value);
                }
            }
            if (!String.IsNullOrWhiteSpace(Logger))
            {
                result.Add(prefix + nameof(Logger), Logger);
            }
            if (!String.IsNullOrWhiteSpace(Thread))
            {
                result.Add(prefix + nameof(Thread), Thread);
            }
            if (MinTime > DefaultMinTime)
            {
                result.Add(prefix + nameof(MinTime), MinTime.ToString(DateFormat));
            }
            if (MaxTime < DefaultMaxTime)
            {
                result.Add(prefix + nameof(MaxTime), MaxTime.ToString(DateFormat));
            }
            if (!String.IsNullOrWhiteSpace(Message))
            {
                result.Add(prefix + nameof(Message), Message);
            }
            if (!String.IsNullOrWhiteSpace(Throwable))
            {
                result.Add(prefix + nameof(Throwable), Throwable);
            }
            if (Quantity != null && Quantity.Value != DefaultQuantity)
            {
                foreach (var item in Quantity.GetRouteValues(nameof(Quantity)))
                {
                    result.Add(prefix + item.Key, item.Value);
                }
            }
            if (Offset > DefaultOffset)
            {
                result.Add(prefix + nameof(Offset), Offset);
            }

            return(result);
        }
Exemplo n.º 2
0
 public void PrintStatistic()
 {
     Console.WriteLine("Benchmark name: " + Name);
     Console.WriteLine("Iterations: " + Iterations);
     Console.WriteLine("Avg time per iteration: " + AvgTime.ToString("0.000") + " ms");
     Console.WriteLine("Min time per iteration: " + MinTime.ToString("0.000") + " ms");
     Console.WriteLine("Max time per iteration: " + MaxTime.ToString("0.000") + " ms");
 }
Exemplo n.º 3
0
 public Dictionary <string, object> ToDictionary()
 {
     return(_lock.Read(() =>
     {
         return new Dictionary <string, object>
         {
             { "hits", HitCount },
             { "total", TotalExecutionTime.ToString("N") },
             { "average", Average.ToString("N") },
             { "exceptions", ExceptionPercentage.ToString("N") },
             { "min", MinTime.ToString("N") },
             { "max", MaxTime.ToString("N") }
         };
     }));
 }
Exemplo n.º 4
0
        /// <summary>
        /// 对象转换为DateTime
        /// </summary>
        /// <param name="val">对象</param>
        /// <param name="format">DateTime格式</param>
        /// <returns>string</returns>
        public static string ObjectToDateTime(this object val, string format)
        {
            if (val == null)
            {
                return(MinTime.ToString(format));
            }

            try
            {
                return(Convert.ToDateTime(val).ToString(format));
            }
            catch
            {
                return(MinTime.ToString(format));
            }
        }
Exemplo n.º 5
0
 public string[] ToStringArray(int digits)
 {
     return(new[]
     {
         AssemblyName,
         MethodName,
         AvgTime.ToString($"F{digits}", CultureInfo.InvariantCulture) /*.Replace(".", ",")*/, //slk . ; in csv , !
         TicksNum.ToString(),
         MinTime.ToString($"F{digits}", CultureInfo.InvariantCulture) /*.Replace(".", ",")*/, //slk . ; in csv , !
         MaxTime.ToString($"F{digits}", CultureInfo.InvariantCulture) /*.Replace(".", ",")*/, //slk . ; in csv , !
         TimeSpent.ToString(),
         AvgKB.ToString(),
         AllocKB.ToString(),
         PatchOwners
     });
 }
Exemplo n.º 6
0
        private void GetRangeBtn_Click(object sender, EventArgs e)
        {
            unsafe
            {
                UInt16 LastErrCode;

                UInt32 MaxTime; UInt32 *pMaxTime = &MaxTime;
                UInt32 MinTime; UInt32 *pMinTime = &MinTime;

                LastErrCode = Watch_Dog_API.WD_GetRange(pMinTime, pMaxTime);
                if (LastErrCode != IMC_ERR_NO_ERROR)
                {
                    MessageBox.Show("Fails to get Watch Dog timer ragne");
                    return;
                }

                TimeMinTxt.Text = MinTime.ToString();
                TimeMaxTxt.Text = MaxTime.ToString();
            }
        }
Exemplo n.º 7
0
        protected override void ProcessRecord()
        {
            BaseParameters = new Dictionary <string, string>
            {
                { "BranchName", BranchName },
                { "RepositoryId", RepositoryId },
                { "RepositoryType", RepositoryType },
                { "ResultFilter", ResultFilter },
                { "MinTime", MinTime?.ToString() }
            };

            var parameters = new ParallelRequestParams(
                "BranchName",
                BranchNames,
                BaseParameters
                );

            var requestTasks = ParallelRequestAsync(VssAuthenticator.AzureDevOpsBuildsHost, "DefaultCollection/One/_apis/build/builds", parameters);

            WriteObject(requestTasks.Result);
        }
Exemplo n.º 8
0
 public string ToCsvRow(int digits)
 {
     return($"{AssemblyName};{MethodName};{AvgTime.ToString($"F{digits}", CultureInfo.InvariantCulture).Replace(".", ",")};{TicksNum};{MinTime.ToString($"F{digits}", CultureInfo.InvariantCulture).Replace(".", ",")};{MaxTime.ToString($"F{digits}", CultureInfo.InvariantCulture).Replace(".", ",")};{TimeSpent};{AvgKB};{AllocKB};{PatchOwners}");
 }