emory-compare: print percentage matched
This commit is contained in:
parent
bb08fb233d
commit
32123d6cb5
@ -166,11 +166,18 @@ int main (int argc, char const **argv)
|
|||||||
|
|
||||||
std::clog << "Finding common\n";
|
std::clog << "Finding common\n";
|
||||||
auto const &found = common (target, source);
|
auto const &found = common (target, source);
|
||||||
std::size_t total = 0;
|
std::size_t matching = 0;
|
||||||
for (auto const &i: found) {
|
for (auto const &i: found) {
|
||||||
std::cout << i << '\n';
|
std::cout << i << '\n';
|
||||||
total += i.offset.second - i.offset.first;
|
matching += i.offset.second - i.offset.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Found " << found.size () << " chunks of " << total << " bytes\n";
|
std::size_t const total = std::accumulate (
|
||||||
|
target.elements.begin (),
|
||||||
|
target.elements.end (),
|
||||||
|
0u,
|
||||||
|
[] (auto const &a, auto const &b) { return a + b.offset.second - b.offset.first; }
|
||||||
|
);
|
||||||
|
|
||||||
|
std::cout << "Found " << found.size () << " chunks of " << matching << " bytes for a factor of " << float (matching) / total << "\n";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user