diff --git a/include/PerfectHash.h b/include/PerfectHash.h index eb283396..6726a30b 100644 --- a/include/PerfectHash.h +++ b/include/PerfectHash.h @@ -3196,7 +3196,15 @@ IsValidPerfectHashTableCreateParameterId( ENTRY(NumberOfCacheLinesUsedByKeysSubset, Lowest, <) \ ENTRY(NumberOfPagesUsedByKeysSubset, Highest, >) \ ENTRY(NumberOfLargePagesUsedByKeysSubset, Highest, >) \ - LAST_ENTRY(NumberOfCacheLinesUsedByKeysSubset, Highest, >) + ENTRY(NumberOfCacheLinesUsedByKeysSubset, Highest, >) \ + ENTRY(PredictedNumberOfFilledCacheLines, Lowest, <) \ + ENTRY(PredictedNumberOfFilledCacheLines, Highest, >) \ + ENTRY(Slope, Lowest, <) \ + ENTRY(Slope, Highest, >) \ + ENTRY(Score, Lowest , <) \ + ENTRY(Score, Highest , >) \ + ENTRY(Rank, Lowest , <) \ + LAST_ENTRY(Rank, Highest , >) #define BEST_COVERAGE_TYPE_TABLE_ENTRY(ENTRY) \ BEST_COVERAGE_TYPE_TABLE(ENTRY, ENTRY, ENTRY) @@ -3290,6 +3298,22 @@ DoesBestCoverageTypeUseValueArray( ); } +FORCEINLINE +BOOLEAN +DoesBestCoverageTypeUseDouble( + _In_ PERFECT_HASH_TABLE_BEST_COVERAGE_TYPE_ID Type + ) +{ + return ( + Type == BestCoverageTypeLowestSlopeId || + Type == BestCoverageTypeHighestSlopeId || + Type == BestCoverageTypeLowestPredictedNumberOfFilledCacheLinesId || + Type == BestCoverageTypeHighestPredictedNumberOfFilledCacheLinesId || + Type == BestCoverageTypeLowestRankId || + Type == BestCoverageTypeHighestRankId + ); +} + typedef struct _PERFECT_HASH_TABLE_CREATE_PARAMETER { PERFECT_HASH_TABLE_CREATE_PARAMETER_ID Id; ULONG Padding; diff --git a/include/PerfectHashEvents.h b/include/PerfectHashEvents.h index a831800e..308aa063 100644 --- a/include/PerfectHashEvents.h +++ b/include/PerfectHashEvents.h @@ -723,11 +723,11 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT PerfectHashEvents_Context = { // // Event write macros for GraphFoundNewBest // -#define EventWriteGraphFoundNewBest(Activity, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, StopGraphSolving, IsBest, IsEqual, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16) \ +#define EventWriteGraphFoundNewBest(Activity, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, CoverageValueAsDouble, StopGraphSolving, IsBest, IsEqual, IsCoverageValueDouble, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16, Slope, Intercept, CorrelationCoefficient, Score, Rank) \ MCGEN_EVENT_ENABLED(GraphFoundNewBest) \ - ? McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq(&PerfectHashEvents_Context, &GraphFoundNewBest, Activity, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, StopGraphSolving, IsBest, IsEqual, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16) : 0 -#define EventWriteGraphFoundNewBest_AssumeEnabled(KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, StopGraphSolving, IsBest, IsEqual, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16) \ - McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq(&PerfectHashEvents_Context, &GraphFoundNewBest, NULL, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, StopGraphSolving, IsBest, IsEqual, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16) + ? McTemplateK0zixqqgttttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgggxg(&PerfectHashEvents_Context, &GraphFoundNewBest, Activity, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, CoverageValueAsDouble, StopGraphSolving, IsBest, IsEqual, IsCoverageValueDouble, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16, Slope, Intercept, CorrelationCoefficient, Score, Rank) : 0 +#define EventWriteGraphFoundNewBest_AssumeEnabled(KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, CoverageValueAsDouble, StopGraphSolving, IsBest, IsEqual, IsCoverageValueDouble, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16, Slope, Intercept, CorrelationCoefficient, Score, Rank) \ + McTemplateK0zixqqgttttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgggxg(&PerfectHashEvents_Context, &GraphFoundNewBest, NULL, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, CoverageValueAsDouble, StopGraphSolving, IsBest, IsEqual, IsCoverageValueDouble, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16, Slope, Intercept, CorrelationCoefficient, Score, Rank) // // Enablement check macro for GraphFoundEqualBest @@ -737,11 +737,11 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT PerfectHashEvents_Context = { // // Event write macros for GraphFoundEqualBest // -#define EventWriteGraphFoundEqualBest(Activity, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, StopGraphSolving, IsBest, IsEqual, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16) \ +#define EventWriteGraphFoundEqualBest(Activity, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, CoverageValueAsDouble, StopGraphSolving, IsBest, IsEqual, IsCoverageValueDouble, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16, Slope, Intercept, CorrelationCoefficient, Score, Rank) \ MCGEN_EVENT_ENABLED(GraphFoundEqualBest) \ - ? McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq(&PerfectHashEvents_Context, &GraphFoundEqualBest, Activity, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, StopGraphSolving, IsBest, IsEqual, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16) : 0 -#define EventWriteGraphFoundEqualBest_AssumeEnabled(KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, StopGraphSolving, IsBest, IsEqual, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16) \ - McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq(&PerfectHashEvents_Context, &GraphFoundEqualBest, NULL, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, StopGraphSolving, IsBest, IsEqual, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16) + ? McTemplateK0zixqqgttttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgggxg(&PerfectHashEvents_Context, &GraphFoundEqualBest, Activity, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, CoverageValueAsDouble, StopGraphSolving, IsBest, IsEqual, IsCoverageValueDouble, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16, Slope, Intercept, CorrelationCoefficient, Score, Rank) : 0 +#define EventWriteGraphFoundEqualBest_AssumeEnabled(KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, CoverageValueAsDouble, StopGraphSolving, IsBest, IsEqual, IsCoverageValueDouble, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16, Slope, Intercept, CorrelationCoefficient, Score, Rank) \ + McTemplateK0zixqqgttttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgggxg(&PerfectHashEvents_Context, &GraphFoundEqualBest, NULL, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, CoverageValueAsDouble, StopGraphSolving, IsBest, IsEqual, IsCoverageValueDouble, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16, Slope, Intercept, CorrelationCoefficient, Score, Rank) // // Enablement check macro for GraphFound @@ -751,11 +751,11 @@ EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT PerfectHashEvents_Context = { // // Event write macros for GraphFound // -#define EventWriteGraphFound(Activity, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, StopGraphSolving, IsBest, IsEqual, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16) \ +#define EventWriteGraphFound(Activity, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, CoverageValueAsDouble, StopGraphSolving, IsBest, IsEqual, IsCoverageValueDouble, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16, Slope, Intercept, CorrelationCoefficient, Score, Rank) \ MCGEN_EVENT_ENABLED(GraphFound) \ - ? McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq(&PerfectHashEvents_Context, &GraphFound, Activity, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, StopGraphSolving, IsBest, IsEqual, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16) : 0 -#define EventWriteGraphFound_AssumeEnabled(KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, StopGraphSolving, IsBest, IsEqual, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16) \ - McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq(&PerfectHashEvents_Context, &GraphFound, NULL, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, StopGraphSolving, IsBest, IsEqual, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16) + ? McTemplateK0zixqqgttttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgggxg(&PerfectHashEvents_Context, &GraphFound, Activity, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, CoverageValueAsDouble, StopGraphSolving, IsBest, IsEqual, IsCoverageValueDouble, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16, Slope, Intercept, CorrelationCoefficient, Score, Rank) : 0 +#define EventWriteGraphFound_AssumeEnabled(KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, CoverageValueAsDouble, StopGraphSolving, IsBest, IsEqual, IsCoverageValueDouble, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16, Slope, Intercept, CorrelationCoefficient, Score, Rank) \ + McTemplateK0zixqqgttttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgggxg(&PerfectHashEvents_Context, &GraphFound, NULL, KeysFileName, Attempt, ElapsedMilliseconds, CoverageType, CoverageValue, CoverageValueAsDouble, StopGraphSolving, IsBest, IsEqual, IsCoverageValueDouble, EqualCount, TotalNumberOfPages, TotalNumberOfLargePages, TotalNumberOfCacheLines, NumberOfUsedPages, NumberOfUsedLargePages, NumberOfUsedCacheLines, NumberOfEmptyPages, NumberOfEmptyLargePages, NumberOfEmptyCacheLines, FirstPageUsed, FirstLargePageUsed, FirstCacheLineUsed, LastPageUsed, LastLargePageUsed, LastCacheLineUsed, TotalNumberOfAssigned, NumberOfKeysWithVerticesMappingToSamePage, NumberOfKeysWithVerticesMappingToSameLargePage, NumberOfKeysWithVerticesMappingToSameCacheLine, MaxGraphTraversalDepth, TotalGraphTraversals, Seed1, Seed2, Seed3, Seed4, Seed5, Seed6, Seed7, Seed8, NumberOfAssignedPerCacheLineCounts_0, NumberOfAssignedPerCacheLineCounts_1, NumberOfAssignedPerCacheLineCounts_2, NumberOfAssignedPerCacheLineCounts_3, NumberOfAssignedPerCacheLineCounts_4, NumberOfAssignedPerCacheLineCounts_5, NumberOfAssignedPerCacheLineCounts_6, NumberOfAssignedPerCacheLineCounts_7, NumberOfAssignedPerCacheLineCounts_8, NumberOfAssignedPerCacheLineCounts_9, NumberOfAssignedPerCacheLineCounts_10, NumberOfAssignedPerCacheLineCounts_11, NumberOfAssignedPerCacheLineCounts_12, NumberOfAssignedPerCacheLineCounts_13, NumberOfAssignedPerCacheLineCounts_14, NumberOfAssignedPerCacheLineCounts_15, NumberOfAssignedPerCacheLineCounts_16, Slope, Intercept, CorrelationCoefficient, Score, Rank) // // Enablement check macro for GraphAssignStart @@ -1016,11 +1016,11 @@ McTemplateK0ziqqqqq( // //Template from manifest : GraphFoundTemplate // -#ifndef McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq_def -#define McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq_def +#ifndef McTemplateK0zixqqgttttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgggxg_def +#define McTemplateK0zixqqgttttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgggxg_def ETW_INLINE ULONG -McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq( +McTemplateK0zixqqgttttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgggxg( _In_ PMCGEN_TRACE_CONTEXT Context, _In_ PCEVENT_DESCRIPTOR Descriptor, _In_opt_ const GUID* Activity, @@ -1029,11 +1029,11 @@ McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq( _In_ const unsigned __int64 _Arg2, _In_ const unsigned int _Arg3, _In_ const unsigned int _Arg4, - _In_ const signed int _Arg5, + _In_ const double _Arg5, _In_ const signed int _Arg6, _In_ const signed int _Arg7, - _In_ const unsigned int _Arg8, - _In_ const unsigned int _Arg9, + _In_ const signed int _Arg8, + _In_ const signed int _Arg9, _In_ const unsigned int _Arg10, _In_ const unsigned int _Arg11, _In_ const unsigned int _Arg12, @@ -1078,12 +1078,19 @@ McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq( _In_ const unsigned int _Arg51, _In_ const unsigned int _Arg52, _In_ const unsigned int _Arg53, - _In_ const unsigned int _Arg54 + _In_ const unsigned int _Arg54, + _In_ const unsigned int _Arg55, + _In_ const unsigned int _Arg56, + _In_ const double _Arg57, + _In_ const double _Arg58, + _In_ const double _Arg59, + _In_ const unsigned __int64 _Arg60, + _In_ const double _Arg61 ) { -#define McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq_ARGCOUNT 55 +#define McTemplateK0zixqqgttttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgggxg_ARGCOUNT 62 - EVENT_DATA_DESCRIPTOR EventData[McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq_ARGCOUNT + 1]; + EVENT_DATA_DESCRIPTOR EventData[McTemplateK0zixqqgttttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgggxg_ARGCOUNT + 1]; EventDataDescCreate(&EventData[1], (_Arg0 != NULL) ? _Arg0 : L"NULL", @@ -1097,15 +1104,15 @@ McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq( EventDataDescCreate(&EventData[5],&_Arg4, sizeof(const unsigned int) ); - EventDataDescCreate(&EventData[6],&_Arg5, sizeof(const signed int) ); + EventDataDescCreate(&EventData[6],&_Arg5, sizeof(const double) ); EventDataDescCreate(&EventData[7],&_Arg6, sizeof(const signed int) ); EventDataDescCreate(&EventData[8],&_Arg7, sizeof(const signed int) ); - EventDataDescCreate(&EventData[9],&_Arg8, sizeof(const unsigned int) ); + EventDataDescCreate(&EventData[9],&_Arg8, sizeof(const signed int) ); - EventDataDescCreate(&EventData[10],&_Arg9, sizeof(const unsigned int) ); + EventDataDescCreate(&EventData[10],&_Arg9, sizeof(const signed int) ); EventDataDescCreate(&EventData[11],&_Arg10, sizeof(const unsigned int) ); @@ -1197,9 +1204,23 @@ McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq( EventDataDescCreate(&EventData[55],&_Arg54, sizeof(const unsigned int) ); - return McGenEventWrite(Context, Descriptor, Activity, McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq_ARGCOUNT + 1, EventData); + EventDataDescCreate(&EventData[56],&_Arg55, sizeof(const unsigned int) ); + + EventDataDescCreate(&EventData[57],&_Arg56, sizeof(const unsigned int) ); + + EventDataDescCreate(&EventData[58],&_Arg57, sizeof(const double) ); + + EventDataDescCreate(&EventData[59],&_Arg58, sizeof(const double) ); + + EventDataDescCreate(&EventData[60],&_Arg59, sizeof(const double) ); + + EventDataDescCreate(&EventData[61],&_Arg60, sizeof(const unsigned __int64) ); + + EventDataDescCreate(&EventData[62],&_Arg61, sizeof(const double) ); + + return McGenEventWrite(Context, Descriptor, Activity, McTemplateK0zixqqgttttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgggxg_ARGCOUNT + 1, EventData); } -#endif // McTemplateK0zixqqtttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq_def +#endif // McTemplateK0zixqqgttttqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgggxg_def // //Template from manifest : GraphAddHashedKeysTemplate diff --git a/python/perfecthash/analysis.py b/python/perfecthash/analysis.py index 422503f7..005f1cbd 100644 --- a/python/perfecthash/analysis.py +++ b/python/perfecthash/analysis.py @@ -347,6 +347,7 @@ 'ProcessID', 'ThreadID', 'CPU', + 'ActivityId', 'KeysProcessed', 'NumberOfKeys', 'LastKey', @@ -425,6 +426,7 @@ 'ProcessID', 'ThreadID', 'CPU', + 'ActivityId', 'KeysProcessed', 'NumberOfKeys', 'LastKey', @@ -481,6 +483,7 @@ 'ProcessID', 'ThreadID', 'CPU', + 'ActivityId', 'NumberOfKeys', 'Cycles', 'Microseconds', @@ -498,6 +501,7 @@ ' etw:Related ActivityId,' ' etw:UserSid,' ' etw:SessionId,' + ' KeysFileName,' ' Attempt,' ' ElapsedMilliseconds,' ' CoverageType,' @@ -551,7 +555,12 @@ ' NumberOfAssignedPerCacheLineCounts_13,' ' NumberOfAssignedPerCacheLineCounts_14,' ' NumberOfAssignedPerCacheLineCounts_15,' - ' NumberOfAssignedPerCacheLineCounts_16' + ' NumberOfAssignedPerCacheLineCounts_16,' + ' Slope,' + ' Intercept,' + ' CorrelationCoefficient,' + ' Score,' + ' Rank' ) FOUND_GRAPH_CSV_HEADER_SHARED = ( @@ -564,6 +573,7 @@ 'RelatedActivityId', 'UserSid', 'SessionId', + 'KeysFileName', 'Attempt', 'ElapsedMilliseconds', 'CoverageType', @@ -618,6 +628,11 @@ 'NumberOfAssignedPerCacheLineCounts_14', 'NumberOfAssignedPerCacheLineCounts_15', 'NumberOfAssignedPerCacheLineCounts_16', + 'Slope', + 'Intercept', + 'CorrelationCoefficient', + 'Score', + 'Rank', ) FOUND_GRAPH_CSV_HEADER_SLIM_SHARED = ( @@ -626,6 +641,8 @@ 'ProcessID', 'ThreadID', 'CPU', + 'ActivityId', + 'KeysFileName', 'Attempt', 'ElapsedMilliseconds', 'CoverageType', @@ -680,6 +697,11 @@ 'NumberOfAssignedPerCacheLineCounts_14', 'NumberOfAssignedPerCacheLineCounts_15', 'NumberOfAssignedPerCacheLineCounts_16', + 'Slope', + 'Intercept', + 'CorrelationCoefficient', + 'Score', + 'Rank', ) # FoundNewBestGraph @@ -732,6 +754,7 @@ ' etw:Related ActivityId,' ' etw:UserSid,' ' etw:SessionId,' + ' KeysFileName,' ' Attempt,' ' NumberOfKeys,' ' NumberOfVertices' @@ -747,6 +770,7 @@ 'RelatedActivityId', 'UserSid', 'SessionId', + 'KeysFileName', 'Attempt', 'NumberOfKeys', 'NumberOfVertices', @@ -759,6 +783,8 @@ 'ProcessID', 'ThreadID', 'CPU', + 'ActivityId', + 'KeysFileName', 'Attempt', 'NumberOfKeys', 'NumberOfVertices', @@ -778,6 +804,7 @@ ' etw:Related ActivityId,' ' etw:UserSid,' ' etw:SessionId,' + ' KeysFileName,' ' Attempt,' ' NumberOfKeys,' ' NumberOfVertices,' @@ -796,6 +823,7 @@ 'RelatedActivityId', 'UserSid', 'SessionId', + 'KeysFileName', 'Attempt', 'NumberOfKeys', 'NumberOfVertices', @@ -811,6 +839,8 @@ 'ProcessID', 'ThreadID', 'CPU', + 'ActivityId', + 'KeysFileName', 'Attempt', 'NumberOfKeys', 'NumberOfVertices', @@ -856,6 +886,7 @@ 'ProcessID', 'ThreadID', 'CPU', + 'ActivityId', 'BytesRequested', ) @@ -898,6 +929,7 @@ 'ProcessID', 'ThreadID', 'CPU', + 'ActivityId', 'BytesRequested', 'Result', ) @@ -2289,6 +2321,7 @@ def process_xperf_perfecthash_csv(path, out=None): 'ProcessID', 'ThreadID', 'CPU', + 'ActivityId', 'NumberOfKeys', 'NumberOfVertices', 'NumberOfEmptyVertices', diff --git a/src/PerfectHash/BulkCreateBestCsv.h b/src/PerfectHash/BulkCreateBestCsv.h index 57477ff4..13b61964 100644 --- a/src/PerfectHash/BulkCreateBestCsv.h +++ b/src/PerfectHash/BulkCreateBestCsv.h @@ -682,6 +682,30 @@ Module Name: Coverage->NumberOfAssignedPerCacheLineCounts[16], \ OUTPUT_INT) \ \ + ENTRY(Slope, \ + Coverage->Slope, \ + OUTPUT_DOUBLE) \ + \ + ENTRY(Intercept, \ + Coverage->Intercept, \ + OUTPUT_DOUBLE) \ + \ + ENTRY(CorrelationCoefficient, \ + Coverage->CorrelationCoefficient, \ + OUTPUT_DOUBLE) \ + \ + ENTRY(PredictedNumberOfFilledCacheLines, \ + Coverage->PredictedNumberOfFilledCacheLines, \ + OUTPUT_DOUBLE) \ + \ + ENTRY(Score, \ + Coverage->Score, \ + OUTPUT_INT) \ + \ + ENTRY(Rank, \ + Coverage->Rank, \ + OUTPUT_DOUBLE) \ + \ ENTRY(BestGraph1_Attempt, \ Context->BestGraphInfo[0].Attempt, \ OUTPUT_INT) \ @@ -6501,6 +6525,7 @@ Module Name: #define WRITE_BULK_CREATE_BEST_CSV_ROW() do { \ + _dtoa_Allocator = Context->Allocator; \ BULK_CREATE_BEST_CSV_PRE_ROW(); \ BULK_CREATE_BEST_CSV_ROW_TABLE( \ EXPAND_AS_WRITE_BULK_CREATE_BEST_ROW_NOT_LAST_COLUMN, \ @@ -6508,6 +6533,7 @@ Module Name: EXPAND_AS_WRITE_BULK_CREATE_BEST_ROW_LAST_COLUMN \ ); \ BULK_CREATE_BEST_CSV_POST_ROW(); \ + _dtoa_Allocator = NULL; \ } while (0) // vim:set ts=8 sw=4 sts=4 tw=80 expandtab : diff --git a/src/PerfectHash/BulkCreateCsv.h b/src/PerfectHash/BulkCreateCsv.h index cb3449aa..57ab657c 100644 --- a/src/PerfectHash/BulkCreateCsv.h +++ b/src/PerfectHash/BulkCreateCsv.h @@ -633,6 +633,30 @@ Module Name: Coverage->NumberOfAssignedPerCacheLineCounts[16], \ OUTPUT_INT) \ \ + ENTRY(Slope, \ + Coverage->Slope, \ + OUTPUT_DOUBLE) \ + \ + ENTRY(Intercept, \ + Coverage->Intercept, \ + OUTPUT_DOUBLE) \ + \ + ENTRY(CorrelationCoefficient, \ + Coverage->CorrelationCoefficient, \ + OUTPUT_DOUBLE) \ + \ + ENTRY(PredictedNumberOfFilledCacheLines, \ + Coverage->PredictedNumberOfFilledCacheLines, \ + OUTPUT_DOUBLE) \ + \ + ENTRY(Score, \ + Coverage->Score, \ + OUTPUT_INT) \ + \ + ENTRY(Rank, \ + Coverage->Rank, \ + OUTPUT_DOUBLE) \ + \ ENTRY(KeysMinValue, \ Keys->Stats.MinValue, \ OUTPUT_INT) \ @@ -710,6 +734,7 @@ Module Name: #define WRITE_BULK_CREATE_CSV_ROW() do { \ + _dtoa_Allocator = Context->Allocator; \ BULK_CREATE_CSV_PRE_ROW(); \ BULK_CREATE_CSV_ROW_TABLE( \ EXPAND_AS_WRITE_BULK_CREATE_ROW_NOT_LAST_COLUMN, \ @@ -717,6 +742,7 @@ Module Name: EXPAND_AS_WRITE_BULK_CREATE_ROW_LAST_COLUMN \ ); \ BULK_CREATE_CSV_POST_ROW(); \ + _dtoa_Allocator = NULL; \ } while (0) // vim:set ts=8 sw=4 sts=4 tw=80 expandtab : diff --git a/src/PerfectHash/Graph.c b/src/PerfectHash/Graph.c index c2e7ee45..05120a99 100644 --- a/src/PerfectHash/Graph.c +++ b/src/PerfectHash/Graph.c @@ -1530,7 +1530,27 @@ Return Value: } // - // Enumeration of the assigned array complete; verify invariants. + // Enumeration of the assigned array complete. Perform a linear regression + // against the NumberOfAssignedPerCacheLineCounts array, then score it. + // + + LinearRegressionNumberOfAssignedPerCacheLineCounts( + (PULONG)&Coverage->NumberOfAssignedPerCacheLineCounts, + &Coverage->Slope, + &Coverage->Intercept, + &Coverage->CorrelationCoefficient, + &Coverage->PredictedNumberOfFilledCacheLines + ); + + ScoreNumberOfAssignedPerCacheLineCounts( + (PULONG)&Coverage->NumberOfAssignedPerCacheLineCounts, + Coverage->TotalNumberOfAssigned, + &Coverage->Score, + &Coverage->Rank + ); + + // + // Everything has been completed; verify invariants, then return. // VerifyMemoryCoverageInvariants(Graph, Coverage); @@ -1737,7 +1757,27 @@ Return Value: } // - // Enumeration of the assigned array complete; verify invariants. + // Enumeration of the assigned array complete. Perform a linear regression + // against the NumberOfAssignedPerCacheLineCounts array, then score it. + // + + LinearRegressionNumberOfAssignedPerCacheLineCounts( + (PULONG)&Coverage->NumberOfAssignedPerCacheLineCounts, + &Coverage->Slope, + &Coverage->Intercept, + &Coverage->CorrelationCoefficient, + &Coverage->PredictedNumberOfFilledCacheLines + ); + + ScoreNumberOfAssignedPerCacheLineCounts( + (PULONG)&Coverage->NumberOfAssignedPerCacheLineCounts, + Coverage->TotalNumberOfAssigned, + &Coverage->Score, + &Coverage->Rank + ); + + // + // Everything has been completed; verify invariants, then return. // VerifyMemoryCoverageInvariants(Graph, Coverage); @@ -2013,9 +2053,11 @@ VerifyMemoryCoverageInvariants( ElapsedMilliseconds, \ (ULONG)CoverageType, \ CoverageValue, \ + CoverageValueAsDouble, \ (StopGraphSolving != FALSE), \ (FoundBestGraph != FALSE), \ (FoundEqualBestGraph != FALSE), \ + (IsCoverageValueDouble != FALSE), \ EqualCount, \ Coverage->TotalNumberOfPages, \ Coverage->TotalNumberOfLargePages, \ @@ -2062,7 +2104,12 @@ VerifyMemoryCoverageInvariants( Coverage->NumberOfAssignedPerCacheLineCounts[13], \ Coverage->NumberOfAssignedPerCacheLineCounts[14], \ Coverage->NumberOfAssignedPerCacheLineCounts[15], \ - Coverage->NumberOfAssignedPerCacheLineCounts[16] \ + Coverage->NumberOfAssignedPerCacheLineCounts[16], \ + Coverage->Slope, \ + Coverage->Intercept, \ + Coverage->CorrelationCoefficient, \ + Coverage->Score, \ + Coverage->Rank \ ) GRAPH_REGISTER_SOLVED GraphRegisterSolved; @@ -2107,11 +2154,14 @@ Return Value: BOOLEAN FoundBestGraph = FALSE; BOOLEAN StopGraphSolving = FALSE; BOOLEAN FoundEqualBestGraph = FALSE; + BOOLEAN IsCoverageValueDouble; + BOOLEAN IsSlopeCoverageType; ULONG Index; ULONG EqualCount = 0; ULONG BestGraphIndex = 0; ULONG CoverageValue = 0; ULONG CoverageLimit = 0; + DOUBLE CoverageValueAsDouble = 0.0; LONG EqualBestGraphIndex = 0; LONGLONG Attempt; PGRAPH BestGraph; @@ -2134,6 +2184,7 @@ Return Value: CoverageType = Context->BestCoverageType; Attempt = Coverage->Attempt; ElapsedMilliseconds = GetTickCount64() - Context->StartMilliseconds; + IsCoverageValueDouble = DoesBestCoverageTypeUseDouble(CoverageType); // // Indicate continue graph solving unless we find a best graph. @@ -2178,6 +2229,81 @@ Return Value: PreviousBestGraph = Context->BestGraph; PreviousBestCoverage = &PreviousBestGraph->AssignedMemoryCoverage; + // + // Define helper macros for reducing the amount of duplicate code we'd + // otherwise have to copy-and-paste when we detect a best or equal-best + // graph. + // + +#define FOUND_BEST_GRAPH() \ + Context->BestGraph = Graph; \ + *NewGraphPointer = PreviousBestGraph; \ + BestGraphIndex = Context->NewBestGraphCount++; \ + Result = PH_S_USE_NEW_GRAPH_FOR_SOLVING + +#define FOUND_EQUAL_BEST_GRAPH() \ + Context->EqualBestGraphCount++; \ + FoundEqualBestGraph = TRUE; \ + EqualBestGraphIndex = Context->NewBestGraphCount - 1 + + // + // If our coverage type is slope, we also want to factor in the intercept + // and correlation coefficient; if we're presented with two equal slope + // values, we want to consult the intercept and correlation coefficient as + // well to try and break the tie. + // + + IsSlopeCoverageType = ( + CoverageType == BestCoverageTypeLowestSlopeId || + CoverageType == BestCoverageTypeHighestSlopeId + ); + + if (IsSlopeCoverageType) { + DOUBLE Slope; + DOUBLE Intercept; + DOUBLE CorrCoeff; + DOUBLE PrevSlope; + DOUBLE PrevIntercept; + DOUBLE PrevCorrCoeff; + + Slope = Coverage->Slope; + Intercept = Coverage->Intercept; + CorrCoeff = Coverage->CorrelationCoefficient; + PrevSlope = PreviousBestCoverage->Slope; + PrevIntercept = PreviousBestCoverage->Intercept; + PrevCorrCoeff = PreviousBestCoverage->CorrelationCoefficient; + + CoverageValueAsDouble = Slope; + + // + // Helper macro to reduce duplicate code for lowest/highest slope + // comparisons. + // + +#define IS_BEST_SLOPE(Comparator) \ + if (Slope Comparator PrevSlope) { \ + FOUND_BEST_GRAPH(); \ + } else if (Slope == PrevSlope) { \ + if (Intercept Comparator PrevIntercept) { \ + FOUND_BEST_GRAPH(); \ + } else if (Intercept == PrevIntercept) { \ + if (CorrCoeff > PrevCorrCoeff) { \ + FOUND_BEST_GRAPH(); \ + } else if (CorrCoeff == PrevCorrCoeff) { \ + FOUND_EQUAL_BEST_GRAPH(); \ + } \ + } \ + } + + if (CoverageType == BestCoverageTypeLowestSlopeId) { + IS_BEST_SLOPE(<); + } else { + IS_BEST_SLOPE(>); + } + + goto End; + } + // // Determine if this graph has the "best" memory coverage and update the // best graph accordingly if so. @@ -2185,16 +2311,11 @@ Return Value: #define EXPAND_AS_DETERMINE_IF_BEST_GRAPH(Name, Comparison, Comparator) \ case BestCoverageType##Comparison##Name##Id: \ - CoverageValue = Coverage->##Name; \ + CoverageValue = (ULONG)Coverage->##Name; \ if (Coverage->##Name Comparator PreviousBestCoverage->##Name) { \ - Context->BestGraph = Graph; \ - *NewGraphPointer = PreviousBestGraph; \ - BestGraphIndex = Context->NewBestGraphCount++; \ - Result = PH_S_USE_NEW_GRAPH_FOR_SOLVING; \ + FOUND_BEST_GRAPH(); \ } else if (Coverage->##Name == PreviousBestCoverage->##Name) { \ - Context->EqualBestGraphCount++; \ - FoundEqualBestGraph = TRUE; \ - EqualBestGraphIndex = Context->NewBestGraphCount - 1; \ + FOUND_EQUAL_BEST_GRAPH(); \ } \ break; @@ -2292,7 +2413,8 @@ Return Value: #define EXPAND_AS_SAVE_BEST_GRAPH_VALUE(Name, Comparison, Comparator) \ case BestCoverageType##Comparison##Name##Id: \ - BestGraphInfo->Value = Coverage->##Name; \ + BestGraphInfo->Value = (ULONG)Coverage->##Name; \ + BestGraphInfo->ValueAsDouble = (DOUBLE)Coverage->##Name; \ break; switch (CoverageType) { @@ -2375,12 +2497,29 @@ Return Value: // seen happen regularly in practice). // + // + // N.B. This doesn't apply to the coverage types like Slope which use + // DOUBLEs instead of ULONGs, so, skip comparator check in these + // cases. + // + + if (IsCoverageValueDouble) { + goto SkipComparatorCheck; + } + + // + // Suppress SAL warnings; not sure why it complains here. + // + + _No_competing_thread_begin_ Coverage = &BestGraph->AssignedMemoryCoverage; + _No_competing_thread_end_ #define EXPAND_AS_DETERMINE_IF_LOWEST(Name, Comparison, Comparator) \ case BestCoverageType##Comparison##Name##Id: \ IsLowestComparator = (0 Comparator 1); \ - CoverageValue = Coverage->##Name; \ + CoverageValue = (ULONG)Coverage->##Name; \ + CoverageValueAsDouble = (DOUBLE)Coverage->##Name; \ break; switch (CoverageType) { @@ -2468,6 +2607,12 @@ Return Value: } } + // + // Intentional follow-on to SkipComparatorCheck. + // + +SkipComparatorCheck: + // // Communicate back to the context that solving can stop if indicated. // diff --git a/src/PerfectHash/Graph.h b/src/PerfectHash/Graph.h index 425b3548..00c7e1ef 100644 --- a/src/PerfectHash/Graph.h +++ b/src/PerfectHash/Graph.h @@ -242,7 +242,9 @@ typedef struct _ASSIGNED_MEMORY_COVERAGE { // elements, not 16. // - ULONG NumberOfAssignedPerCacheLineCounts[NUM_ASSIGNED_PER_CACHE_LINE + 1]; +#define TOTAL_NUM_ASSIGNED_PER_CACHE_LINE NUM_ASSIGNED_PER_CACHE_LINE + 1 + + ULONG NumberOfAssignedPerCacheLineCounts[TOTAL_NUM_ASSIGNED_PER_CACHE_LINE]; union { ULONG MaxAssignedPerCacheLineCount; ULONG MaxAssignedPerCacheLineCountForKeysSubset; @@ -275,6 +277,22 @@ typedef struct _ASSIGNED_MEMORY_COVERAGE { LONGLONG Attempt; + // + // Linear regression performed against NumberOfAssignedPerCacheLineCounts. + // + + DOUBLE Slope; + DOUBLE Intercept; + DOUBLE CorrelationCoefficient; + DOUBLE PredictedNumberOfFilledCacheLines; + + // + // Score and rank for the NumberOfAssignedPerCacheLineCounts array. + // + + ULONGLONG Score; + DOUBLE Rank; + } ASSIGNED_MEMORY_COVERAGE; typedef ASSIGNED_MEMORY_COVERAGE *PASSIGNED_MEMORY_COVERAGE; typedef const ASSIGNED_MEMORY_COVERAGE *PCASSIGNED_MEMORY_COVERAGE; diff --git a/src/PerfectHash/Math.c b/src/PerfectHash/Math.c new file mode 100644 index 00000000..04391114 --- /dev/null +++ b/src/PerfectHash/Math.c @@ -0,0 +1,253 @@ +/*++ + +Copyright (c) 2021 Trent Nelson + +Module Name: + + Math.c + +Abstract: + + This module contains implementations of math-specific routines for the + perfect hash library. Routines are provided to calculate the predicted + number of attempts required to solve a graph (based on a solutions-found + ratio supplied), and perform linear regression. + +--*/ + +#include "stdafx.h" + +HRESULT +CalculatePredictedAttempts( + _In_ DOUBLE SolutionsFoundRatio, + _Out_ PULONG PredictedAttempts + ) +/*++ + +Routine Description: + + Given a solutions-found ratio, calculate the predicted number of attempts + required to solve the graph. As the solutions-found ratio is a probability + following the geometric distribution, we can predict the number of attempts + required to solve a graph by the formula: + + p * (q ** (r - 1)) + + Where p is the probability of success, q is (1 - p), and r is the attempt. + A cumulative probability is calcualted by multiplying this result by the + attempt number, and returning the attempt once the delta between this value + and the prior loop's value is greater than 0.0. + +Arguments: + + SolutionsFoundRatio - Supplies the solutions found ratio. Must be a value + less than 1.0 and greater than 0.0. + + PredictedAttempts - Supplies a pointer to a variable that receives the + predicted number of attempts if the routine was successful. + +Return Value: + + S_OK - Success. + + E_POINTER - PredictedAttempts was NULL. + + PH_E_INVALID_SOLUTIONS_FOUND_RATIO - Solutions found ratio was invalid + (i.e. greater than 1.0 or less than 0.0). + +--*/ +{ + ULONG Attempt; + DOUBLE Delta; + DOUBLE Success; + DOUBLE Failure; + DOUBLE Cumulative; + DOUBLE Probability; + DOUBLE LastCumulative; + + if (!ARGUMENT_PRESENT(PredictedAttempts)) { + return E_POINTER; + } + + if (SolutionsFoundRatio >= 1.0 || SolutionsFoundRatio <= 0.0) { + return PH_E_INVALID_SOLUTIONS_FOUND_RATIO; + } + + LastCumulative = 0.0; + Success = SolutionsFoundRatio; + Failure = 1 - SolutionsFoundRatio; + + for (Attempt = 1; ; Attempt++) { + Probability = Success * pow(Failure, (DOUBLE)(Attempt - 1)); + Cumulative = (DOUBLE)Attempt * Probability; + Delta = LastCumulative - Cumulative; + if (Delta > 0.0) { + break; + } + LastCumulative = Cumulative; + } + + // + // Update the caller's pointer and return success. + // + + *PredictedAttempts = Attempt; + return S_OK; +} + +VOID +LinearRegressionNumberOfAssignedPerCacheLineCounts( + _In_reads_(TOTAL_NUM_ASSIGNED_PER_CACHE_LINE) PULONG YCounts, + _Out_ PDOUBLE SlopePointer, + _Out_ PDOUBLE InterceptPointer, + _Out_ PDOUBLE CorrelationCoefficientPointer, + _Out_ PDOUBLE PredictedNumberOfFilledCacheLinesPointer + ) +/*++ + +Routine Description: + + Given an array of 17 cache line counts, perform a linear regression and + return the slope, intercept, correlation coefficient, and predicted number + of filled cache lines (i.e. y for `y = mx + b` where x == 16). + +Arguments: + + YCounts - Supplies the array of cache line counts. + + SlopePointer - Receives the slope. + + InterceptPointer - Receives the intercept. + + CorrelationCoefficientPointer - Receives the correlation coefficient. + +Return Value: + + None. + +--*/ +{ + BYTE Index; + DOUBLE X; + DOUBLE Y; + DOUBLE Y2; + DOUBLE SumY; + DOUBLE SumY2; + DOUBLE SumXY; + DOUBLE Slope; + DOUBLE Intercept; + DOUBLE Predicted; + DOUBLE CorrelationCoefficient; + CONST DOUBLE N = TOTAL_NUM_ASSIGNED_PER_CACHE_LINE; + CONST DOUBLE SumX = 136.0; + CONST DOUBLE SumX2 = 1496.0; + CONST DOUBLE SumXSquared = 18496.0; + CONST DOUBLE Denominator = ((N * SumX2) - SumXSquared); + CONST BYTE Total = TOTAL_NUM_ASSIGNED_PER_CACHE_LINE; + CONST BYTE XCounts[TOTAL_NUM_ASSIGNED_PER_CACHE_LINE] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 + }; + + SumY = 0.0; + SumXY = 0.0; + SumY2 = 0.0; + + for (Index = 1; Index < Total; Index++) { + X = (DOUBLE)XCounts[Index]; + + Y = (DOUBLE)YCounts[Index]; + SumY += Y; + + Y2 = sqr(Y); + SumY2 += Y2; + + SumXY += X * Y; + } + + Slope = ((N * SumXY) - (SumX * SumY)) / Denominator; + Intercept = ((SumY * SumX2) - (SumX * SumXY)) / Denominator; + CorrelationCoefficient = ( + (SumXY - ((SumX * SumY) / N)) / sqrt( + (SumX2 - sqr(SumX) / N) * + (SumY2 - sqr(SumY) / N) + ) + ); + + Predicted = (Slope * 16.0) + Intercept; + + *SlopePointer = Slope; + *InterceptPointer = Intercept; + *CorrelationCoefficientPointer = CorrelationCoefficient; + *PredictedNumberOfFilledCacheLinesPointer = Predicted; + + return; +} + +VOID +ScoreNumberOfAssignedPerCacheLineCounts( + _In_reads_(TOTAL_NUM_ASSIGNED_PER_CACHE_LINE) PULONG YCounts, + _In_ ULONG TotalNumberOfAssigned, + _Out_ PULONGLONG Score, + _Out_ PDOUBLE Rank + ) +/*++ + +Routine Description: + + Given an array of 17 cache line counts, construct a score that is obtained + by multiplying each array element by its relevant position squared in the + array, then summing the results. E.g. the number of assigned in the 3 + bucket is multiplied by 9, 5 is multiplied by 25, etc. + + The rank is (or at least should be) a decimal value between (0,1] that + attempts to capture the score relative to the maximum possible score. + +Arguments: + + YCounts - Supplies the array of cache line counts. + + Score - Supplies a pointer to a variable that receives the score. + + Rank - Supplies a pointer to a variable that receives the rank. + +Return Value: + + None. + +--*/ +{ + BYTE Index; + ULONGLONG X; + ULONGLONG Y; + ULONGLONG Sum; + DOUBLE MaxScore; + CONST BYTE Total = TOTAL_NUM_ASSIGNED_PER_CACHE_LINE; + CONST SHORT XMultipliers[TOTAL_NUM_ASSIGNED_PER_CACHE_LINE] = { + 0, 1, 4, 9, 16, 25, 36, 49, 64, 81, + 100, 121, 144, 169, 196, 225, 256 + }; + + Sum = 0; + + // + // We start at 1 to ignore the count of cache lines with no assigned + // elements. + // + + for (Index = 1; Index < Total; Index++) { + X = (ULONGLONG)XMultipliers[Index]; + Y = (ULONGLONG)YCounts[Index]; + + Sum += (Y * X); + } + + MaxScore = ((DOUBLE)TotalNumberOfAssigned / 16.0) * (DOUBLE)256; + + *Score = Sum; + *Rank = Sum / MaxScore; + + return; +} + + +// vim:set ts=8 sw=4 sts=4 tw=80 expandtab : diff --git a/src/PerfectHash/Math.h b/src/PerfectHash/Math.h new file mode 100644 index 00000000..bb0f55a5 --- /dev/null +++ b/src/PerfectHash/Math.h @@ -0,0 +1,92 @@ +/*++ + +Copyright (c) 2021 Trent Nelson + +Module Name: + + Math.h + +Abstract: + + This is the header file for math functionality of the perfect hash library. + + In the beginning, the most complex math we did was multiplication, and life + was good. Then we started wanting to calculate probabilities and perform + linear regressions, and thus, we needed routines like pow() and sqrt(). + + Unfortunately, because we don't link against a standard C runtime, we don't + have these common math routines readily available. So, we included some + open source implementations of said functions (see _pow.c), and introduced + this file as the header to contain the necessary function declarations, + plus house the function decls of math routines specific to the perfect hash + library. + +--*/ + +#pragma once + +#include "stdafx.h" + +// +// Function decls and helper short-name for standard C runtime functions +// provided by _pow.c. +// + +DOUBLE __ieee754_pow(DOUBLE x, DOUBLE y); +DOUBLE __ieee754_sqrt(DOUBLE x); + +#define pow __ieee754_pow +#define sqrt __ieee754_sqrt + +// +// _dtoa() and _freedtoa(), provided by _dtoa.c. +// + +extern PALLOCATOR _dtoa_Allocator; + +char * +_dtoa(double dd, int mode, int ndigits, + int *decpt, int *sign, char **rve); + +void +_freedtoa(char *s); + +// +// Helper inlines. +// + +FORCEINLINE +DOUBLE +sqr(DOUBLE x) +{ + return x * x; +} + +// +// Function decls specific to the perfect hash library. +// + +HRESULT +CalculatePredictedAttempts( + _In_ DOUBLE SolutionsFoundRatio, + _Out_ PULONG PredictedAttempts + ); + +VOID +LinearRegressionNumberOfAssignedPerCacheLineCounts( + _In_reads_(TOTAL_NUM_ASSIGNED_PER_CACHE_LINE) PULONG YCounts, + _Out_ PDOUBLE SlopePointer, + _Out_ PDOUBLE InterceptPointer, + _Out_ PDOUBLE CorrelationCoefficientPointer, + _Out_ PDOUBLE PredictedNumberOfFilledCacheLinesPointer + ); + +VOID +ScoreNumberOfAssignedPerCacheLineCounts( + _In_reads_(TOTAL_NUM_ASSIGNED_PER_CACHE_LINE) PULONG YCounts, + _In_ ULONG TotalNumberOfAssigned, + _Out_ PULONGLONG Score, + _Out_ PDOUBLE Rank + ); + +// vim:set ts=8 sw=4 sts=4 tw=80 expandtab : diff --git a/src/PerfectHash/PerfectHash.vcxproj b/src/PerfectHash/PerfectHash.vcxproj index 9dc85482..24deadf5 100644 --- a/src/PerfectHash/PerfectHash.vcxproj +++ b/src/PerfectHash/PerfectHash.vcxproj @@ -143,6 +143,7 @@ + @@ -225,6 +226,7 @@ + @@ -270,6 +272,7 @@ + diff --git a/src/PerfectHash/PerfectHash.vcxproj.filters b/src/PerfectHash/PerfectHash.vcxproj.filters index 2d80d237..cad17ada 100644 --- a/src/PerfectHash/PerfectHash.vcxproj.filters +++ b/src/PerfectHash/PerfectHash.vcxproj.filters @@ -304,6 +304,12 @@ Source Files + + Source Files + + + Source Files + @@ -594,6 +600,9 @@ Private Header Files + + Private Header Files + diff --git a/src/PerfectHash/PerfectHashContext.h b/src/PerfectHash/PerfectHashContext.h index 9e026a66..81167a15 100644 --- a/src/PerfectHash/PerfectHashContext.h +++ b/src/PerfectHash/PerfectHashContext.h @@ -185,7 +185,7 @@ typedef struct _BEST_GRAPH_INFO { // the best graph (e.g. HighestMaxGraphTraversalDepth). // - ULONG Value; + ULONGLONG Value; // // Number of times a best graph was found that was equal to this existing @@ -195,6 +195,18 @@ typedef struct _BEST_GRAPH_INFO { ULONG EqualCount; + // + // Pad out to an 8-byte boundary. + // + + ULONG Padding; + + // + // Coverage value as a double, if applicable. + // + + DOUBLE ValueAsDouble; + // // Seed values used for this best graph. // diff --git a/src/PerfectHash/PerfectHashErrorsTEMP.BIN b/src/PerfectHash/PerfectHashErrorsTEMP.BIN index a286129a..74da3590 100644 Binary files a/src/PerfectHash/PerfectHashErrorsTEMP.BIN and b/src/PerfectHash/PerfectHashErrorsTEMP.BIN differ diff --git a/src/PerfectHash/PerfectHashEvents.man b/src/PerfectHash/PerfectHashEvents.man index 6658b30a..5f4fdfd5 100644 --- a/src/PerfectHash/PerfectHashEvents.man +++ b/src/PerfectHash/PerfectHashEvents.man @@ -44,9 +44,11 @@ + + @@ -94,6 +96,11 @@ + + + + +