Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions differ.cc
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,17 @@ double GetSimilarityScore(const CallGraph& call_graph1,
const CallGraph& call_graph2,
const Histogram& histogram, const Counts& counts) {
double similarity = 0;
similarity +=
0.35 * counts[Counts::kFlowGraphEdgeMatchesNonLibrary] /
(std::max(1.0,
0.5 * (counts[Counts::kFlowGraphEdgesPrimaryNonLibrary] +
counts[Counts::kFlowGraphEdgesSecondaryNonLibrary])));
const int edges_primary = counts[Counts::kFlowGraphEdgesPrimaryNonLibrary];
const int edges_secondary =
counts[Counts::kFlowGraphEdgesSecondaryNonLibrary];
if (edges_primary == 0 && edges_secondary == 0) {
// When neither side has any flow graph edges, there is nothing to disagree
// about, and the edge term is a full match.
similarity += 0.35;
} else {
similarity += 0.35 * counts[Counts::kFlowGraphEdgeMatchesNonLibrary] /
(std::max(1.0, 0.5 * (edges_primary + edges_secondary)));
}
similarity +=
0.25 * counts[Counts::kBasicBlockMatchesNonLibrary] /
(std::max(1.0, 0.5 * (counts[Counts::kBasicBlocksPrimaryNonLibrary] +
Expand Down