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); }
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"); }
public override string ToString() { string baseString = WaitTime.ToString(CultureInfo.InvariantCulture) + ", " + SpawnInterval.ToString(CultureInfo.InvariantCulture) + ", " + MaxTime.ToString(CultureInfo.InvariantCulture) + ", " + MaxSpawnItems + ", " + SpawnTypeList.ToText(); return(string.IsNullOrEmpty(ShortName) ? baseString : ShortName + " " + baseString); }
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") } }; })); }
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 }); }
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(); } }
public void SaveToXml(string path = "") { string xmlInput = "<configuration> \n <parallel> serial </parallel>"; xmlInput += AddNewPropertyValue("linearInput", LinearInput); xmlInput += AddNewPropertyValue("license", License); xmlInput += AddNewPropertyValue("entropyDir", InputEntropyDir); xmlInput += AddNewPropertyValue("objDir", InputObjDir); //population sizing xmlInput += AddNewPropertyValue("debug_mode", Debug); xmlInput += AddNewPropertyValue("use_hboa", Hboa); xmlInput += AddNewPropertyValue("initial_popsize", InitPop.ToString()); xmlInput += AddNewPropertyValue("min_popsize", MinPop.ToString()); xmlInput += AddNewPropertyValue("max_popsize", MaxPop.ToString()); xmlInput += AddNewPropertyValue("popsize_scheme", PopScheme); xmlInput += AddNewPropertyValue("pop_scaling_factor", PopFactor.ToString()); xmlInput += AddNewPropertyValue("max_gens", MaxGens.ToString()); //Design Objectives xmlInput += AddNewPropertyValue("test_problem", TestProblem); xmlInput += AddNewPropertyValue("nobj", NObj.ToString()); for (int i = 1; i <= NObj; i++) { xmlInput += AddNewPropertyValue("obj_tag" + i, ObjTags[i - 1].ToString()); xmlInput += AddNewPropertyValue("obj_val" + i, ObjVal[i - 1].ToString()); xmlInput += AddNewPropertyValue("obj_eps" + i, ObjEps[i - 1].ToString()); } xmlInput += AddNewPropertyValue("num_additional_objectives", NAObj.ToString()); for (int i = 1; i <= NAObj; i++) { xmlInput += AddNewPropertyValue("aobj1_" + i, AObj1[i - 1].ToString()); xmlInput += AddNewPropertyValue("aobj" + i + "_2", AObj2[i - 1].ToString()); } xmlInput += AddNewPropertyValue("ncons", NConst.ToString()); for (int i = 1; i <= NConst; i++) { xmlInput += AddNewPropertyValue("con_num" + i, ConNum[i - 1].ToString()); xmlInput += AddNewPropertyValue("con_tot" + i, ConTot[i - 1].ToString()); xmlInput += AddNewPropertyValue("con_ind" + i, ConInd[i - 1].ToString()); } //Real Decision Variables xmlInput += AddNewPropertyValue("nreal", NReal.ToString()); xmlInput += AddNewPropertyValue("real_pseudo_binary", PseudoBinary); xmlInput += AddNewPropertyValue("real_limits", RealLimits); if (RealTag != null) { for (int i = 1; i <= RealTag.Count(); i++) { xmlInput += AddNewPropertyValue("real_tag" + i, RealTag[i - 1].ToString()); xmlInput += AddNewPropertyValue("real_min" + i, RealMin[i - 1].ToString()); xmlInput += AddNewPropertyValue("real_max" + i, RealMax[i - 1].ToString()); } } xmlInput += AddNewPropertyValue("real_cross_prob", RealCrossProb.ToString()); xmlInput += AddNewPropertyValue("real_mut_prob", RealMutProb.ToString()); xmlInput += AddNewPropertyValue("dist_index_sbx", DistIndexSBX.ToString()); xmlInput += AddNewPropertyValue("dist_index_poly", DistIndexPoly.ToString()); //Binary Decision Variables xmlInput += AddNewPropertyValue("nbin", NBin.ToString()); xmlInput += AddNewPropertyValue("bin_limits", BinLimits == true ? " same " : " different "); for (int i = 1; i <= NBin; i++) { xmlInput += AddNewPropertyValue("bin_tag" + i, BinTag[i - 1].ToString()); xmlInput += AddNewPropertyValue("bin_bit" + i, BinBit[i - 1].ToString()); xmlInput += AddNewPropertyValue("bin_min" + i, RealMin[i - 1].ToString()); xmlInput += AddNewPropertyValue("bin_max" + i, RealMax[i - 1].ToString()); } xmlInput += AddNewPropertyValue("bin_cross_prob", BinCrossProb.ToString()); xmlInput += AddNewPropertyValue("bin_cross_type", BinCrossType); xmlInput += AddNewPropertyValue("bin_mut_prob", BinMutProb.ToString()); xmlInput += AddNewPropertyValue("bin_mut_type", BinMutType); //Soft Termination Criteria xmlInput += AddNewPropertyValue("inter_run", InterRun); xmlInput += AddNewPropertyValue("inter_delta", InterDelta.ToString()); xmlInput += AddNewPropertyValue("intra_run", IntraRun); xmlInput += AddNewPropertyValue("inter_delta", IntraDelta.ToString()); //Hard Termination Criteria xmlInput += AddNewPropertyValue("max_nfe", MaxNfe.ToString()); xmlInput += AddNewPropertyValue("max_time", MaxTime.ToString()); xmlInput += AddNewPropertyValue("max_eperf", MaxEperf.ToString()); //Performance Metrics xmlInput += AddNewPropertyValue("conv", Conv); xmlInput += AddNewPropertyValue("div", Div); xmlInput += AddNewPropertyValue("eperf", Eperf); xmlInput += AddNewPropertyValue("edom_eperf", EdomEperf); if (DivGrid != null) { for (int i = 1; i <= DivGrid.Count; i++) { xmlInput += AddNewPropertyValue("div_grid" + i, DivGrid[i - 1].ToString()); } } if (EperfEps != null) { for (int i = 1; i <= EperfEps.Count; i++) { xmlInput += AddNewPropertyValue("eperf_eps" + i, EperfEps[i - 1].ToString()); } } xmlInput += AddNewPropertyValue("eind", Eind); xmlInput += AddNewPropertyValue("eind_error", EindError.ToString()); xmlInput += AddNewPropertyValue("metric_ref", MetricRef); //Local File Output xmlInput += AddNewPropertyValue("out_dir", OutDir); xmlInput += AddNewPropertyValue("out_headers", OutHeaders); xmlInput += AddNewPropertyValue("out_all", OutAll ? OutInterval.ToString() : "0"); xmlInput += AddNewPropertyValue("out_nondom", Nondom ? NondomInterval.ToString() : "0"); xmlInput += AddNewPropertyValue("out_all_final", AllFinal ? "on" : "off"); xmlInput += AddNewPropertyValue("out_nondom_final", NondomFinal ? "on" : "off"); xmlInput += AddNewPropertyValue("out_stats", StatsInterval.ToString()); xmlInput += AddNewPropertyValue("out_rs", RsStats ? "on" : "off"); xmlInput += AddNewPropertyValue("out_timer", TimerInterval.ToString()); xmlInput += AddNewPropertyValue("out_vtk", VtkInterval.ToString()); xmlInput += AddNewPropertyValue("out_vtk_sflag", SmallFlag); //DEMO Parameters xmlInput += AddNewPropertyValue("ndata", NData.ToString()); //End Tag xmlInput += "\n </configuration>"; var doc = XDocument.Parse(xmlInput); xmlDoc = doc; if (path == string.Empty) { doc.Save(path + "configuration.xml"); } else { doc.Save(path); } }
public static string MaxTimeString() { return(MaxTime.ToString("n6") + "ms"); }
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}"); }