Parse a trace file and schedule node joins/leaves according to trace data. More...
#include <TraceChurn.h>
Public Member Functions | |
void | handleMessage (cMessage *msg) |
void | initializeChurn () |
void | createNode (int nodeId) |
void | deleteNode (int nodeId) |
cGate * | getAppGateById (int nodeId) |
Protected Member Functions | |
void | updateDisplayString () |
TransportAddress * | getTransportAddressById (int nodeId) |
Private Types | |
typedef std::pair < TransportAddress *, cGate * > | nodeMapEntry |
Private Attributes | |
char * | maxTier |
bool | initAddMoreTerminals |
true, if we're still adding more terminals in the init phase | |
cMessage * | nextRead |
UNORDERED_MAP< int, nodeMapEntry * > | nodeMap |
Parse a trace file and schedule node joins/leaves according to trace data.
If trace includes user action, send actions to application
Definition at line 36 of file TraceChurn.h.
typedef std::pair<TransportAddress*, cGate*> TraceChurn::nodeMapEntry [private] |
Definition at line 55 of file TraceChurn.h.
void TraceChurn::createNode | ( | int | nodeId | ) |
Definition at line 53 of file TraceChurn.cc.
{ Enter_Method_Silent(); TransportAddress* ta = underlayConfigurator->createNode(type); PeerInfo* peer = GlobalNodeListAccess().get()->getPeerInfo(*ta); cGate* inGate = simulation.getModule(peer->getModuleID())->getSubmodule(maxTier)->gate("trace_in"); if (!inGate) { throw cRuntimeError("Application has no trace_in gate. Most probably " "that means it is not able to handle trace data."); } nodeMapEntry* e = new nodeMapEntry(ta, inGate); nodeMap[nodeId] = e; }
void TraceChurn::deleteNode | ( | int | nodeId | ) |
Definition at line 68 of file TraceChurn.cc.
{ Enter_Method_Silent(); nodeMapEntry* e; UNORDERED_MAP<int, nodeMapEntry*>::iterator it = nodeMap.find(nodeId); if (it == nodeMap.end()) { throw cRuntimeError("Trying to delete non-existing node"); } e = it->second; underlayConfigurator->preKillNode(NodeType(), e->first); nodeMap.erase(it); delete e->first; delete e; }
cGate * TraceChurn::getAppGateById | ( | int | nodeId | ) |
Definition at line 96 of file TraceChurn.cc.
TransportAddress * TraceChurn::getTransportAddressById | ( | int | nodeId | ) | [protected] |
Definition at line 86 of file TraceChurn.cc.
void TraceChurn::handleMessage | ( | cMessage * | msg | ) | [virtual] |
void TraceChurn::initializeChurn | ( | ) | [virtual] |
Implements ChurnGenerator.
Definition at line 33 of file TraceChurn.cc.
{ Enter_Method_Silent(); // get uppermost tier // Quick hack. Works fine unless numTiers is > 9 (which should never happen) maxTier = new char[6]; strcpy(maxTier, "tier0"); maxTier[4] += par("numTiers").longValue(); // FIXME: There should be a tracefile command to decide when init phase has finished underlayConfigurator->initFinished(); }
void TraceChurn::updateDisplayString | ( | ) | [protected, virtual] |
Implements ChurnGenerator.
Definition at line 106 of file TraceChurn.cc.
{ char buf[80]; sprintf(buf, "trace churn"); getDisplayString().setTagArg("t", 0, buf); }
bool TraceChurn::initAddMoreTerminals [private] |
true, if we're still adding more terminals in the init phase
Definition at line 53 of file TraceChurn.h.
char* TraceChurn::maxTier [private] |
Definition at line 51 of file TraceChurn.h.
Referenced by createNode(), and initializeChurn().
cMessage* TraceChurn::nextRead [private] |
Definition at line 54 of file TraceChurn.h.
UNORDERED_MAP<int, nodeMapEntry*> TraceChurn::nodeMap [private] |
Definition at line 56 of file TraceChurn.h.
Referenced by createNode(), deleteNode(), getAppGateById(), and getTransportAddressById().