Ejemplo n.º 1
0
 public void Collect(DatabaseCollection database)
 {
     TotalDatabases       = database.Databases.Count;
     TotalFingers         = database.FingerCount;
     TotalViews           = database.FpCount;
     MatchingPairCount    = database.GetMatchingPairCount();
     NonMatchingPairCount = database.GetNonMatchingPairCount();
 }
Ejemplo n.º 2
0
        public MatcherReport Run()
        {
            MatcherReport report = new MatcherReport();

            report.SetDatabaseCount(TestDatabase.Databases.Count);

            Stopwatch prepareTimer     = new Stopwatch();
            Stopwatch matchingTimer    = new Stopwatch();
            Stopwatch nonmatchingTimer = new Stopwatch();

            for (int databaseIndex = 0; databaseIndex < TestDatabase.Databases.Count; ++databaseIndex)
            {
                TestDatabase database = TestDatabase.Databases[databaseIndex];
                foreach (var template in database.AllIndexes)
                {
                    database[template].Template.MatcherCache = null;
                }
                database.MaxMatchingPerProbe    = MaxMatchingPerProbe;
                database.MaxNonMatchingPerProbe = MaxNonMatchingPerProbe;
                report.ScoreTables[databaseIndex].Initialize(database);
                foreach (DatabaseIndex probe in database.AllIndexes)
                {
                    RunPrepare(database[probe].Template, prepareTimer);
                    CollectMatches(database, database.GetMatchingPairs(probe), report.ScoreTables[databaseIndex], matchingTimer);
                    CollectMatches(database, database.GetNonMatchingPairs(probe), report.ScoreTables[databaseIndex], nonmatchingTimer);

                    if (prepareTimer.Elapsed.TotalSeconds + matchingTimer.Elapsed.TotalSeconds +
                        nonmatchingTimer.Elapsed.TotalSeconds > Timeout)
                    {
                        throw new TimeoutException("Timeout in matcher");
                    }
                }
            }

            report.Time.Prepare     = (float)prepareTimer.Elapsed.TotalSeconds / TestDatabase.FpCount;
            report.Time.Matching    = (float)matchingTimer.Elapsed.TotalSeconds / TestDatabase.GetMatchingPairCount();
            report.Time.NonMatching = (float)nonmatchingTimer.Elapsed.TotalSeconds / TestDatabase.GetNonMatchingPairCount();

            report.ComputeStatistics();

            return(report);
        }