/// <summary> /// 获取时间并停止 /// </summary> public void LogTime(string title = null) { Sw.Stop(); var ms = Sw.ElapsedMilliseconds; Log?.Invoke($"{title}{(title != null ? ": " : "")}{ms}ms", null); }
public int Find(string fName) { inputFile = new BasicFile.ImplementationBuffer(fName); fileManager = new HashFileManager(); HashDataFileIndexes = new IndexData(inputFile.Length); swCreateHashDataFile.Restart(); CreateHashDataFile(); swCreateHashDataFile.Stop(); int counter = 0; foreach (var node in fileManager.GetAll()) { if (node.Count == 1) { counter++; } } PrintDebugStatistics(); return(counter); }
/// <summary> /// 获取时间并停止 /// </summary> public void ConsoleTime(string title = null) { Sw.Stop(); var ms = Sw.ElapsedMilliseconds; Console.WriteLine($"{title}{(title != null ? ": " : "")}{ms}ms"); }
/// <summary> /// 获取时间并重置继续 /// </summary> public long GetTimeRestart() { Sw.Stop(); var ms = Sw.ElapsedMilliseconds; Sw.Restart(); return(ms); }
public long Add() { Sw.Reset(); Sw.Start(); for (int i = 0; i < _size; i++) { _collection.Add(i, i); } Sw.Stop(); return(Sw.ElapsedTicks); }
public long Reach() { var rnd = new Random(); Sw.Reset(); Sw.Start(); for (int i = 0; i < 100; i++) { _collection.ContainsKey(rnd.Next(0, _size)); } Sw.Stop(); return(Sw.ElapsedTicks); }
private void CreateHashDataFile() { int index = 0; while (true) { if (index == -1 || inputFile.IsEOF(index)) { break; } swReadNextString.Restart(); var(h, i) = ReadNextString(index); index = i; swReadNextString.Stop(); swSaveNextHash.Restart(); SaveNextHash(h); swSaveNextHash.Stop(); } fileManager.Close(); }
public void Dispose() { Sw.Stop(); ProfileWriter.WriteProfile(this); }
public void Finalizar() { Sw.Stop(); }
/// <summary> /// 获取时间并停止 /// </summary> public long GetTime() { Sw.Stop(); return(Sw.ElapsedMilliseconds); }