56 #if CXX0X_UP_SUPPORTED
66 #if CXX0X_UP_SUPPORTED
67 static std::mutex &faults_sync()
74 static std::map<int32_t, Fault> &
faults()
76 static std::map<int32_t, Fault> map;
84 std::cout << std::string(
"Called etiss::fault::Stressor::loadXML(file=") + file + std::string(
")") << std::endl;
86 etiss::log(
etiss::INFO, std::string(
"Called etiss::fault::Stressor::loadXML(file=") + file + std::string(
")"));
96 in.open(file.c_str());
100 std::cout <<
"etiss::fault::Stressor::loadXML(): Failed open file " << file << std::endl;
103 std::string(
" Failed to open Trigger file ") + file);
107 if (!etiss::fault::parseXML(
faults, in, std::cout))
110 std::cout <<
"etiss::fault::Stressor::loadXML: Failed parse file " << file << std::endl;
113 std::string(
"etiss::fault::Stressor::loadXML:") + std::string(
" Failed to parse file ") + file);
121 for (
size_t i = 0; i <
faults.size(); ++i)
126 std::cout <<
"etiss::fault::Stressor::loadXML: Failed to add Fault: " <<
faults[i].name_ << std::endl;
129 std::string(
"etiss::fault::Stressor::loadXML:") + std::string(
" Failed to add Fault "),
140 #if CXX0X_UP_SUPPORTED
141 std::lock_guard<std::mutex> lock(faults_sync());
145 std::cout <<
"etiss::fault::Stressor::addFault called." << std::endl;
151 std::map<int32_t, Fault>::iterator find =
faults().find(f.
id_);
152 if (find !=
faults().end())
155 std::cout <<
"etiss::fault::Stressor::addFault: Trigger already exists:" << f.
toString() << std::endl;
158 std::string(
"etiss::fault::Stressor::addFault:") + std::string(
" Trigger already exists. "), f);
164 faults().insert(std::pair<int32_t, Fault>(f.
id_, f));
167 for (std::vector<Trigger>::const_iterator iter = f.
triggers.begin(); iter != f.
triggers.end(); ++iter)
174 std::cout <<
"etiss::fault::Stressor::addFault: Added trigger: " << iter->toString() << std::endl;
176 etiss::log(
etiss::INFO, std::string(
"etiss::fault::Stressor::addFault:") + std::string(
" Added trigger: "),
184 std::cout <<
"etiss::fault::Stressor::addFault: Error: Injector not found for: " << iter->toString()
188 std::string(
"etiss::fault::Stressor::addFault:") + std::string(
" Injector not found for "),
201 #if CXX0X_UP_SUPPORTED
202 std::lock_guard<std::mutex> lock(faults_sync());
206 std::map<int32_t, Fault>::iterator find =
faults().find(fault_id);
207 if (find !=
faults().end())
210 for (std::vector<etiss::fault::Action>::iterator iter = find->second.actions.begin();
211 iter != find->second.actions.end(); ++iter)
220 if (iter->getInjectorAddress().getInjector())
222 #if CXX0X_UP_SUPPORTED
223 if (iter->getInjectorAddress().getInjector().get() != injector)
225 if (iter->getInjectorAddress().getInjector() != injector)
230 std::string(
"etiss::fault::Stressor::firedTrigger: Action") +
231 std::string(
" injector is not the injector that triggered this event.") +
232 std::string(
" threadsafety must be ensured by user."),
233 find->second, *iter);
237 if (!iter->getInjectorAddress().getInjector()->applyAction(find->second, *iter, err))
240 std::cout <<
"Stressor::firedTrigger: Failed to apply action. Fault: " << fault_id <<
" ["
241 << err <<
"]" << std::endl;
244 find->second, *iter, err);
252 std::cout <<
"Stressor::firedTrigger: Failed to find action target. Fault: " << fault_id
256 find->second, *iter);
265 std::cout <<
"Stressor::firedTrigger: Failed to find triggered Fault: " << fault_id << std::endl;
267 etiss::log(
etiss::ERROR, std::string(
"Stressor::firedTrigger: Failed to find triggered Fault: "), fault_id);
276 #if CXX0X_UP_SUPPORTED
277 std::lock_guard<std::mutex> lock(faults_sync());
contains the fault injector interface class.
general configuration and logging
contains the stressor class that loads and activates faults.
static __inline__ uint64_t
static __inline__ int32_t
@ INJECTION
an action that injects a fault definition (trigger + actions)
std::string toString() const
operator<< can be used.
std::vector< Trigger > triggers
contains the triggers for this fault
void addTrigger(const Trigger &t, int32_t fault_id)
> Triggers to look at in callbacks
static bool loadXML(const std::string &file, const int coreID=0)
extracts faults out of the given xml file.
static bool addFault(const Fault &f)
adds a fault to a static map that can be accessed by static std::map<int32_t,Fault> & faults().
static void clear()
clears the fault map.
static bool firedTrigger(const Trigger &firedTrigger, int32_t fault_id, Injector *injector, uint64_t time_ps)
Checks if the given trigger is valid and calls applyAction.
static std::map< int32_t, Fault > & faults()
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.