Пример #1
0
        /// <summary>
        /// Creates the the algorithm entry object and starts measuring the statistics.
        /// </summary>
        /// <param name="algorithmType">Type of the algorithm.</param>
        /// <param name="transaction">The transaction.</param>
        /// <returns>New created algorithm object.</returns>
        public static AlgorithmEntry CreateAndStartAlgorithm(AlgorithmType algorithmType, TransactionEntry transaction)
        {
            AlgorithmEntry entry = new AlgorithmEntry(algorithmType, transaction);

            entry.stopwatch.Start();

            return(entry);
        }
Пример #2
0
        /// <inheritdoc />
        public void StartAlgorithm(Snapshot snapshot, AlgorithmType algorithmType)
        {
            AlgorithmKey key = new AlgorithmKey(algorithmType, snapshot);

            if (!algorithms.ContainsKey(key))
            {
                TransactionEntry transaction;
                if (!transactions.TryGetValue(snapshot, out transaction))
                {
                    transaction = null;
                }

                AlgorithmEntry entry = AlgorithmEntry.CreateAndStartAlgorithm(algorithmType, transaction);
                algorithms.Add(key, entry);

                if (numberOfActiveAlgorithms == 0)
                {
                    algorithmStopwatch.Start();
                }
                numberOfActiveAlgorithms++;
            }
        }
Пример #3
0
 /// <summary>
 /// Adds an algorithm entry to the statistics
 /// </summary>
 /// <param name="entry">The entry.</param>
 public void AlgorithmStopped(AlgorithmEntry entry)
 {
     NumberOfRuns++;
     TotalTime += entry.AlgorithmTime;
 }