Skip to content

Commit

Permalink
Implement new coverage types related to linear regression and score.
Browse files Browse the repository at this point in the history
  • Loading branch information
tpn committed Jan 19, 2021
1 parent 3940cd9 commit 57272fa
Show file tree
Hide file tree
Showing 17 changed files with 735 additions and 134 deletions.
26 changes: 25 additions & 1 deletion include/PerfectHash.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
73 changes: 47 additions & 26 deletions include/PerfectHashEvents.h

Large diffs are not rendered by default.

35 changes: 34 additions & 1 deletion python/perfecthash/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@
'ProcessID',
'ThreadID',
'CPU',
'ActivityId',
'KeysProcessed',
'NumberOfKeys',
'LastKey',
Expand Down Expand Up @@ -425,6 +426,7 @@
'ProcessID',
'ThreadID',
'CPU',
'ActivityId',
'KeysProcessed',
'NumberOfKeys',
'LastKey',
Expand Down Expand Up @@ -481,6 +483,7 @@
'ProcessID',
'ThreadID',
'CPU',
'ActivityId',
'NumberOfKeys',
'Cycles',
'Microseconds',
Expand All @@ -498,6 +501,7 @@
' etw:Related ActivityId,'
' etw:UserSid,'
' etw:SessionId,'
' KeysFileName,'
' Attempt,'
' ElapsedMilliseconds,'
' CoverageType,'
Expand Down Expand Up @@ -551,7 +555,12 @@
' NumberOfAssignedPerCacheLineCounts_13,'
' NumberOfAssignedPerCacheLineCounts_14,'
' NumberOfAssignedPerCacheLineCounts_15,'
' NumberOfAssignedPerCacheLineCounts_16'
' NumberOfAssignedPerCacheLineCounts_16,'
' Slope,'
' Intercept,'
' CorrelationCoefficient,'
' Score,'
' Rank'
)

FOUND_GRAPH_CSV_HEADER_SHARED = (
Expand All @@ -564,6 +573,7 @@
'RelatedActivityId',
'UserSid',
'SessionId',
'KeysFileName',
'Attempt',
'ElapsedMilliseconds',
'CoverageType',
Expand Down Expand Up @@ -618,6 +628,11 @@
'NumberOfAssignedPerCacheLineCounts_14',
'NumberOfAssignedPerCacheLineCounts_15',
'NumberOfAssignedPerCacheLineCounts_16',
'Slope',
'Intercept',
'CorrelationCoefficient',
'Score',
'Rank',
)

FOUND_GRAPH_CSV_HEADER_SLIM_SHARED = (
Expand All @@ -626,6 +641,8 @@
'ProcessID',
'ThreadID',
'CPU',
'ActivityId',
'KeysFileName',
'Attempt',
'ElapsedMilliseconds',
'CoverageType',
Expand Down Expand Up @@ -680,6 +697,11 @@
'NumberOfAssignedPerCacheLineCounts_14',
'NumberOfAssignedPerCacheLineCounts_15',
'NumberOfAssignedPerCacheLineCounts_16',
'Slope',
'Intercept',
'CorrelationCoefficient',
'Score',
'Rank',
)

# FoundNewBestGraph
Expand Down Expand Up @@ -732,6 +754,7 @@
' etw:Related ActivityId,'
' etw:UserSid,'
' etw:SessionId,'
' KeysFileName,'
' Attempt,'
' NumberOfKeys,'
' NumberOfVertices'
Expand All @@ -747,6 +770,7 @@
'RelatedActivityId',
'UserSid',
'SessionId',
'KeysFileName',
'Attempt',
'NumberOfKeys',
'NumberOfVertices',
Expand All @@ -759,6 +783,8 @@
'ProcessID',
'ThreadID',
'CPU',
'ActivityId',
'KeysFileName',
'Attempt',
'NumberOfKeys',
'NumberOfVertices',
Expand All @@ -778,6 +804,7 @@
' etw:Related ActivityId,'
' etw:UserSid,'
' etw:SessionId,'
' KeysFileName,'
' Attempt,'
' NumberOfKeys,'
' NumberOfVertices,'
Expand All @@ -796,6 +823,7 @@
'RelatedActivityId',
'UserSid',
'SessionId',
'KeysFileName',
'Attempt',
'NumberOfKeys',
'NumberOfVertices',
Expand All @@ -811,6 +839,8 @@
'ProcessID',
'ThreadID',
'CPU',
'ActivityId',
'KeysFileName',
'Attempt',
'NumberOfKeys',
'NumberOfVertices',
Expand Down Expand Up @@ -856,6 +886,7 @@
'ProcessID',
'ThreadID',
'CPU',
'ActivityId',
'BytesRequested',
)

Expand Down Expand Up @@ -898,6 +929,7 @@
'ProcessID',
'ThreadID',
'CPU',
'ActivityId',
'BytesRequested',
'Result',
)
Expand Down Expand Up @@ -2289,6 +2321,7 @@ def process_xperf_perfecthash_csv(path, out=None):
'ProcessID',
'ThreadID',
'CPU',
'ActivityId',
'NumberOfKeys',
'NumberOfVertices',
'NumberOfEmptyVertices',
Expand Down
26 changes: 26 additions & 0 deletions src/PerfectHash/BulkCreateBestCsv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -6501,13 +6525,15 @@ 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, \
EXPAND_AS_WRITE_BULK_CREATE_BEST_ROW_NOT_LAST_COLUMN, \
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 :
26 changes: 26 additions & 0 deletions src/PerfectHash/BulkCreateCsv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -710,13 +734,15 @@ 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, \
EXPAND_AS_WRITE_BULK_CREATE_ROW_NOT_LAST_COLUMN, \
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 :
Loading

0 comments on commit 57272fa

Please sign in to comment.