50 void DLMonitor::onPolicyInit(){
52 cXMLElement* cuXml = NULL;
53 if (par(
"cuData").xmlValue() != NULL && par(
"cuData").xmlValue()->hasChildren()){
54 cuXml = par(
"cuData").xmlValue();
56 error(
"cuData parameter not initialized!");
59 cXMLElementList cus = cuXml->getChildrenByTagName(
"CUItem");
60 for (cXMLElementList::iterator it = cus.begin(); it != cus.end(); ++it) {
62 if (!m->getAttribute(
"id")) {
63 EV <<
"Error parsing CU. Its ID is missing!" << endl;
67 std::string cu = m->getAttribute(
"id");
69 EV <<
"Error parsing CU. Its ID is missing!" << endl;
75 cXMLElementList attrs = m->getChildren();
76 for (cXMLElementList::iterator jt = attrs.begin(); jt != attrs.end(); ++jt) {
78 if ( !strcmp(n->getTagName(),
"urgency") ) {
79 inf.
urgency = n->getNodeValue() ? atoi(n->getNodeValue()) : 0;
82 }
else if ( !strcmp(n->getTagName(),
"cherishThreshold") ) {
83 inf.
threshold = n->getNodeValue() ? atoi(n->getNodeValue()) : 0;
93 void DLMonitor::postPDUInsertion(
RMTQueue* queue) {
94 RMTPort* port = rmtAllocator->getQueueToPortMapping(queue);
98 inQ[port].push_back(queue);
102 std::string cu = Q2CU[queue];
104 int urgency = CUs[cu].urgency;
105 outQs[port][urgency].push_back(queue);
106 lastInsertedUrgency[port] = urgency;
111 void DLMonitor::onMessageDrop(
RMTQueue* queue,
const cPacket* pdu) {
112 RMTPort* port = rmtAllocator->getQueueToPortMapping(queue);
116 inQ[port].pop_back();
119 outQs[port][lastInsertedUrgency[port]].pop_back();
124 void DLMonitor::postQueueCreation(
RMTQueue* queue){
125 std::string cu =
"BE";
128 if(it->second.queue == queue->getName()){
156 for(
PQListRIterator it = qs->rbegin(); it != qs->rend() && q == NULL; it++){
157 if(!it->second.empty()){
158 q = it->second.front();
159 it->second.pop_front();
170 double DLMonitor::getInDropProb(
RMTQueue * queue) {
171 RMTPort* port = rmtAllocator->getQueueToPortMapping(queue);
172 if(port == NULL){ error(
"RMTPort for RMTQueue not found."); }
174 return ( (
int)inC[port] < queue->
getMaxLength() )? 0 : 1;
177 double DLMonitor::getOutDropProb(
RMTQueue * queue) {
178 RMTPort* port = rmtAllocator->getQueueToPortMapping(queue);
179 if(port == NULL){ error(
"RMTPort for RMTQueue not found."); }
181 return ( (
int)outC[port] < CUs[Q2CU[queue]].threshold )? 0 : 1;
std::map< int, QueuesList > PriorityQueuesList
queueType getType() const
list< RMTQueue * > QueuesList
PriorityQueuesList::reverse_iterator PQListRIterator
cuRepo::iterator cuRepoiterator