prune-trace: add switch to disable sample weighting
In the sampling step, the --no-weighting switch disables the equivalence-class weighting by using a weight of one instead of the equivalence-class size. This is usually not a good idea, and should only be used for demonstration purposes, or if the fault model requires weight-less sampling. Change-Id: Id903d1924c6ecbcd217815aa5ce9271560130071
This commit is contained in:
@ -32,6 +32,9 @@ bool FESamplingPruner::commandline_init()
|
|||||||
USE_KNOWN_RESULTS = cmd.addOption("", "use-known-results", Arg::None,
|
USE_KNOWN_RESULTS = cmd.addOption("", "use-known-results", Arg::None,
|
||||||
"--use-known-results \tReuse known results from a campaign with the 'basic' pruner "
|
"--use-known-results \tReuse known results from a campaign with the 'basic' pruner "
|
||||||
"(abuses the DB layout to a certain degree, use with caution)");
|
"(abuses the DB layout to a certain degree, use with caution)");
|
||||||
|
NO_WEIGHTING = cmd.addOption("", "no-weighting", Arg::None,
|
||||||
|
"--no-weighting \tDisable weighted sampling (weight = 1 for all ECs) "
|
||||||
|
"(don't do this unless you know what you're doing)");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,6 +51,10 @@ bool FESamplingPruner::prune_all()
|
|||||||
m_use_known_results = true;
|
m_use_known_results = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmd[NO_WEIGHTING]) {
|
||||||
|
m_weighting = false;
|
||||||
|
}
|
||||||
|
|
||||||
// for each variant:
|
// for each variant:
|
||||||
for (std::vector<fail::Database::Variant>::const_iterator it = m_variants.begin();
|
for (std::vector<fail::Database::Variant>::const_iterator it = m_variants.begin();
|
||||||
it != m_variants.end(); ++it) {
|
it != m_variants.end(); ++it) {
|
||||||
@ -105,7 +112,7 @@ bool FESamplingPruner::sampling_prune(const fail::Database::Variant& variant)
|
|||||||
p.instr2 = strtoul(row[0], 0, 10);
|
p.instr2 = strtoul(row[0], 0, 10);
|
||||||
p.instr2_absolute = strtoul(row[1], 0, 10);
|
p.instr2_absolute = strtoul(row[1], 0, 10);
|
||||||
p.data_address = strtoul(row[2], 0, 10);
|
p.data_address = strtoul(row[2], 0, 10);
|
||||||
p.duration = strtoull(row[3], 0, 10);
|
p.duration = m_weighting ? strtoull(row[3], 0, 10) : 1;
|
||||||
pop.add(p);
|
pop.add(p);
|
||||||
++pilotcount;
|
++pilotcount;
|
||||||
}
|
}
|
||||||
@ -132,7 +139,7 @@ bool FESamplingPruner::sampling_prune(const fail::Database::Variant& variant)
|
|||||||
p.id = strtoul(row[0], 0, 10);
|
p.id = strtoul(row[0], 0, 10);
|
||||||
p.instr2 = strtoul(row[1], 0, 10);
|
p.instr2 = strtoul(row[1], 0, 10);
|
||||||
p.data_address = strtoul(row[2], 0, 10);
|
p.data_address = strtoul(row[2], 0, 10);
|
||||||
p.duration = strtoull(row[3], 0, 10);
|
p.duration = m_weighting ? strtoull(row[3], 0, 10) : 1;
|
||||||
pop.add(p);
|
pop.add(p);
|
||||||
++pilotcount;
|
++pilotcount;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,12 +16,13 @@
|
|||||||
class FESamplingPruner : public Pruner {
|
class FESamplingPruner : public Pruner {
|
||||||
fail::CommandLine::option_handle SAMPLESIZE;
|
fail::CommandLine::option_handle SAMPLESIZE;
|
||||||
fail::CommandLine::option_handle USE_KNOWN_RESULTS;
|
fail::CommandLine::option_handle USE_KNOWN_RESULTS;
|
||||||
|
fail::CommandLine::option_handle NO_WEIGHTING;
|
||||||
|
|
||||||
unsigned m_samplesize;
|
unsigned m_samplesize;
|
||||||
bool m_use_known_results;
|
bool m_use_known_results, m_weighting;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FESamplingPruner() : m_samplesize(0), m_use_known_results(false) { }
|
FESamplingPruner() : m_samplesize(0), m_use_known_results(false), m_weighting(true) { }
|
||||||
virtual std::string method_name() { return "FESampling"; }
|
virtual std::string method_name() { return "FESampling"; }
|
||||||
virtual bool commandline_init();
|
virtual bool commandline_init();
|
||||||
virtual bool prune_all();
|
virtual bool prune_all();
|
||||||
|
|||||||
Reference in New Issue
Block a user