Exemplo n.º 1
0
        /// <summary>
        /// 获取时间并停止
        /// </summary>
        public void LogTime(string title = null)
        {
            Sw.Stop();
            var ms = Sw.ElapsedMilliseconds;

            Log?.Invoke($"{title}{(title != null ? ": " : "")}{ms}ms", null);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取时间并停止
        /// </summary>
        public void ConsoleTime(string title = null)
        {
            Sw.Stop();
            var ms = Sw.ElapsedMilliseconds;

            Console.WriteLine($"{title}{(title != null ? ": " : "")}{ms}ms");
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取时间并重置继续
        /// </summary>
        public long GetTimeRestart()
        {
            Sw.Stop();
            var ms = Sw.ElapsedMilliseconds;

            Sw.Restart();

            return(ms);
        }
Exemplo n.º 5
0
        public long Add()
        {
            Sw.Reset();
            Sw.Start();
            for (int i = 0; i < _size; i++)
            {
                _collection.Add(i, i);
            }

            Sw.Stop();

            return(Sw.ElapsedTicks);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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();
        }
Exemplo n.º 8
0
 public void Dispose()
 {
     Sw.Stop();
     ProfileWriter.WriteProfile(this);
 }
Exemplo n.º 9
0
 public void Finalizar()
 {
     Sw.Stop();
 }
Exemplo n.º 10
0
 /// <summary>
 /// 获取时间并停止
 /// </summary>
 public long GetTime()
 {
     Sw.Stop();
     return(Sw.ElapsedMilliseconds);
 }