cpn: pruning-aware injection points

As we gain some degrees of freedom in choice of the specific
injection instruction offset, this can be used to minimize
navigational costs. This is a first approach towards pruning-aware
injection points.

To do so, we need to modify the sql query, which gets the pilots,
so we additionally join with the trace table to get begin and
end information for equivalence classes, which are feeded into
the creation of InjectionPoints.

Change-Id: I343b712dfcbed1299121f02eee9ce1b136a7ff15
This commit is contained in:
Lars Rademacher
2013-12-03 01:40:40 +01:00
parent d7a9a2811d
commit ba765c16c2
4 changed files with 97 additions and 36 deletions

View File

@ -5,6 +5,8 @@
#include "util/Logger.hpp"
#include "config/FailConfig.hpp"
#include <vector>
namespace fail {
/**
@ -26,7 +28,7 @@ public:
* Used by server.
* @param inj_instr trace instruction offset to be parsed
*/
virtual void parseFromInjectionInstr(unsigned inj_instr) = 0;
virtual void parseFromInjectionInstr(unsigned instr1, unsigned instr2) = 0;
/**
* Parses (extracts) generic representation from a DatabaseCampaignMessage.
@ -62,19 +64,28 @@ class SmartHops;
class InjectionPointHops : public InjectionPointBase {
private:
SmartHops *m_sa; // !< Hop calculator which generates the hop chain
uint32_t m_curr_inst; // !< Instruction for which currently a hop chain is available
// Boundaries must be signed to ensure, they can be initialized as outside of beginning
// of the trace (instr is -1).
long m_curr_instr1; // !< Lower end of instructions for which currently a hop chain is available
long m_curr_instr2; // !< Upper end of instructions for which currently a hop chain is available
bool m_initialized;
std::vector<InjectionPointMessage> m_results;
void init();
public:
InjectionPointHops();
InjectionPointHops() : InjectionPointBase(), m_sa(NULL), m_curr_instr1(-1),
m_curr_instr2(-1), m_initialized(false) {}
virtual ~InjectionPointHops();
/**
* Parses a hop chain from a injection instruction (trace offset).
* @param inj_instr trace instruction offset to be parsed
* @param instr1 trace instruction offset of beginning of equivalence class
* @param instr2 trace instruction offset of ending of equivalence class
*/
virtual void parseFromInjectionInstr(unsigned inj_instr);
virtual void parseFromInjectionInstr(unsigned instr1, unsigned instr2);
};
typedef InjectionPointHops ConcreteInjectionPoint;
@ -94,9 +105,10 @@ public:
/**
* Parses a trace offset from a injection instruction (trace offset),
* so it effectively just stores the value in the protobuf message.
* @param inj_instr trace instruction offset to be parsed
* @param instr1 trace instruction offset of beginning of equivalence class
* @param instr2 trace instruction offset of ending of equivalence class
*/
virtual void parseFromInjectionInstr(unsigned inj_instr);
virtual void parseFromInjectionInstr(unsigned instr1, unsigned instr2);
};
typedef InjectionPointSteps ConcreteInjectionPoint;