util: rename SumTree::get -> remove, add r/o get

SumTree::get now non-intrusively picks an element and returns a
reference to it, SumTree::remove removes and returns a copy.  The
former is needed for sampling with replacement.

Change-Id: Iefef2fdf0b7df6ea7a9949f2588528ec9e86bb7a
This commit is contained in:
Horst Schirmeier
2015-01-14 23:37:18 +01:00
parent b0c58bab78
commit 2f70e05db6
3 changed files with 54 additions and 12 deletions

View File

@ -161,7 +161,7 @@ bool FESamplingPruner::sampling_prune(const fail::Database::Variant& variant)
for (uint64_t i = 0; i < samplerows; ++i) {
uint64_t pos = my_rand(pop.get_size() - 1);
Pilot p = pop.get(pos);
Pilot p = pop.remove(pos);
ss << "(0," << variant.id << "," << p.instr2 << "," << p.instr2
<< "," << p.instr2_absolute << "," << p.data_address
<< ",1," << m_method_id << ")";
@ -203,7 +203,7 @@ bool FESamplingPruner::sampling_prune(const fail::Database::Variant& variant)
for (uint64_t i = 0; i < samplerows; ++i) {
uint64_t pos = my_rand(pop.get_size() - 1);
Pilot p = pop.get(pos);
Pilot p = pop.remove(pos);
ss << "(" << variant.id << "," << p.instr2
<< "," << p.data_address << "," << m_method_id
<< "," << p.id << ")";