public static (string nanosecTotal, string milisecTotal, bool isHihgPrecisionEnabled) StopMeasurement(int numIterations = 1) { StopTime = DateTime.Now; TotalTime.Stop(); TimeSpan elapsed = StopTime.Subtract(StartTime); numTicks = TotalTime.ElapsedTicks; TotalTime.Reset(); return(((numTicks * nanosecPerTick) / numIterations).ToString(), elapsed.TotalSeconds.ToString("0.000000"), Stopwatch.IsHighResolution); }
private bool Validata(out string msg) { if (SearchItems.SearchItems.Count <= 0) { msg = "检索范围为空"; return(false); } if ((FeatureType & E_SEARCH_FEATURE_TYPE.E_SEARCH_FEATURE_TYPE_PASSLINE) > 0) { if (PassLineSet == new List <PassLine>() && RegionSet == new List <BreakRegion>()) { msg = "尚未绘制越界线或闯入闯出框"; return(false); } } if ((FeatureType & E_SEARCH_FEATURE_TYPE.E_SEARCH_FEATURE_TYPE_GLOBAL) > 0) { if (ObjRect == new System.Drawing.Rectangle()) { msg = "尚未绘制全局特征框"; return(false); } } if ((FeatureType & E_SEARCH_FEATURE_TYPE.E_SEARCH_FEATURE_TYPE_PARTICAL) > 0) { if (ObjDetailRect == new System.Drawing.Rectangle()) { msg = "尚未绘制局部特征框"; return(false); } } foreach (var item in SearchItems.SearchItems) { if (!item.IsHistoryTask && StopTime.Subtract(StartTime).TotalMinutes > 12 * 60 + 1) { msg = "实时视频检索不能超过 12 小时"; return(false); } } if (StartTime.CompareTo(StopTime) > 0) { msg = "结束时间不能小于开始时间"; return(false); } msg = ""; return(true); }
public void StopBenchmark() { Running = false; StopTime = DateTime.Now; Duration = StopTime.Subtract(StartTime); }