65 std::to_string(
type) +
" type_=" + std::to_string(
type_));
66 throw "called function of different trigger type";
75 : type_(META_COUNTER), sub_(new
Trigger(sub)), param1_(count), param2_(0)
80 : type_(VARIABLEVALUE), field_(field), inj_(target_injector), fieldptr_(0), param1_(value)
85 : type_(relative ? TIMERELATIVE : TIME), inj_(target_injector), param1_(time_ps), param2_(0)
132 #if CXX0X_UP_SUPPORTED
160 std::string(
", Injector*)"));
165 if (
sub_->
fired(time_ps, target_injector))
183 std::cout <<
"Trigger::fired: Failed to get field" << std::endl;
197 std::cout <<
"Trigger::fired: Failed to read field: " << errmsg << std::endl;
207 std::cout <<
"Trigger::fired: Failed get injector: " <<
inj_.
getInjectorPath() << std::endl;
250 std::string(
"etiss::fault::Trigger::resolveTime(time=") + std::to_string(time) + std::string(
")"));
354 std::stringstream ss;
359 ss <<
" type=META_COUNTER triggerCount=" << +
param1_ <<
" currentCount=" << +
param2_;
362 ss <<
" type=VARIABLEVALUE field=" <<
field_ <<
" triggerValue=" << +
param1_;
365 ss <<
" type=TIME triggerTime=" << +
param1_;
368 ss <<
" type=TIMERELATIVE triggerTime=" << +
param1_;
385 std::string(
"(node, Trigger*&, Diagnostics)"));
388 if (!parse_attr(node,
"type",
type, diag))
393 if (
type ==
"META_COUNTER")
396 if (!parse<uint64_t>(findSingleNode(node,
"count", diag), count, diag))
401 if ((!parse<etiss::fault::Trigger *>(findSingleNode(node,
"trigger", diag), sub, diag)) || (sub == 0))
403 diag.unexpectedNode(node,
"Failed to parse sub trigger");
411 if (
type ==
"VARIABLEVALUE")
414 if (!parse_hex(findSingleNode(node,
"value", diag), value, diag))
419 if (!parse<std::string>(findSingleNode(node,
"field", diag), field, diag))
425 if (!parse<etiss::fault::InjectorAddress>(findSingleNode(node,
"injector", diag), injector, diag))
429 f =
new Trigger(injector, field, value);
436 if (!parse<uint64_t>(findSingleNode(node,
"time_ps", diag), count, diag))
442 if (!parse<etiss::fault::InjectorAddress>(findSingleNode(node,
"injector", diag), injector, diag))
446 f =
new Trigger(injector, count);
450 if (
type ==
"TIMERELATIVE")
453 if (!parse<uint64_t>(findSingleNode(node,
"time_ps", diag), count, diag))
459 if (!parse<etiss::fault::InjectorAddress>(findSingleNode(node,
"injector", diag), injector, diag))
463 f =
new Trigger(injector, count,
true);
474 std::string(
"(node, Trigger*&, Diagnostics)"));
477 return write<etiss::fault::Trigger>(node, *f, diag);
484 std::string(
"(node, Trigger&, Diagnostics)"));
486 if (!parse<etiss::fault::Trigger *>(node, t, diag))
496 std::string(
"(node, Trigger&, Diagnostics)"));
502 write_attr<std::string>(node,
"type",
"META_COUNTER", diag);
509 write_attr<std::string>(node,
"type",
"VARIABLEVALUE", diag);
515 diag.errors.push_back(
"A fault trigger has no target_injector. failed to "
516 "get path of trigger");
519 write<std::string>(node.
append_child(
"injector"), ptr->getInjectorPath(), diag);
525 write_attr<std::string>(node,
"type",
531 diag.errors.push_back(
"A fault trigger has no target_injector. failed to "
532 "get path of trigger");
535 write<std::string>(node.
append_child(
"injector"), ptr->getInjectorPath(), diag);
540 write_attr<std::string>(node,
"type",
"NOP", diag);
545 diag.errors.push_back(
"etiss::fault::xml::write<etiss::fault::Trigger> "
546 "encountered an unknown type of trigger");
contains the fault injector interface class.
general configuration and logging
contains the Trigger class that defines conditions under which actions of a Fault need to be applied.
static __inline__ uint64_t
const std::string & getInjectorPath() const
bool isResolved() const
> Calls Injector::get (implemented in VirtualStruct) to resolve path_ and get iptr_
const Injector_ptr & getInjector() const
virtual void * fastFieldAccessPtr(const std::string &name, std::string &errormsg)=0
std::string toString() const
operator<< can be used.
const std::string & getTriggerField() const
void ensure(Type type) const
Trigger & getSubTrigger()
const uint64_t & getTriggerFieldValue() const
uint64_t getTriggerCount() const
const Injector_ptr & getInjector() const
bool fired(uint64_t time_ps, etiss::fault::Injector *target_injector)
this function checks if the Trigger has just fired.
const InjectorAddress & getInjectorAddress() const
Trigger()
Type: NOP (no operation)
Trigger & operator=(const Trigger &cpy)
uint64_t getTriggerTime() const
bool isResolved() const
returns if the translation from TIMERELATIVE to TIME trigger has taken place
void resolveTime(uint64_t time)
this function calculates in case of a TIMERELATIVE Trigger a constant TIME trigger
@ TIMERELATIVE
needs to be resolved.
xml_node append_child(xml_node_type type=node_element)
void setCoreName(std::string &str)
std::shared_ptr< Injector > Injector_ptr
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
void log(Verbosity level, std::string msg)
write log message at the given level.