示例#1
0
        /// <summary>Takes current snapshot.</summary>
        /// <remarks>Not thread-safe. Caller should ensure that it's not called from different threads at once.</remarks>
        public ConsensusRulesPerformanceSnapshot TakeSnapshot()
        {
            var newSnapshot = new ConsensusRulesPerformanceSnapshot(this.registeredRules);
            ConsensusRulesPerformanceSnapshot previousSnapshot = this.currentSnapshot;

            this.currentSnapshot = newSnapshot;

            return(previousSnapshot);
        }
示例#2
0
        public ConsensusRulesPerformanceCounter(ConsensusRulesContainer consensusRules)
        {
            this.registeredRules = new List <RuleItem>();

            this.RegisterRulesCollection(consensusRules.HeaderValidationRules.Select(x => x as IConsensusRuleBase), RuleType.Header);
            this.RegisterRulesCollection(consensusRules.IntegrityValidationRules.Select(x => x as IConsensusRuleBase), RuleType.Integrity);
            this.RegisterRulesCollection(consensusRules.PartialValidationRules.Select(x => x as IConsensusRuleBase), RuleType.Partial);
            this.RegisterRulesCollection(consensusRules.FullValidationRules.Select(x => x as IConsensusRuleBase), RuleType.Full);

            this.currentSnapshot = new ConsensusRulesPerformanceSnapshot(this.registeredRules);
        }