|
Bugzilla – Full Text Bug Listing |
| Summary: | Outputing statistical result | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | gazalimohammedamin |
| Component: | wave module | Assignee: | Daniel L. <nikkipui> |
| Status: | RESOLVED INVALID | ||
| Severity: | enhancement | CC: | ns-bugs, tommaso.pecorella |
| Priority: | P5 | ||
| Version: | ns-3.17 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
|
Description
gazalimohammedamin
2014-09-05 05:34:42 UTC
Hi, from the bug description I can't reproduce the problem. What is the exact trace not being called ? Please provide (if possible) a script showing the bug. i attached part of the code which i am concern in the scratch file. there is no bug since the simulation is running and compiling fine. However there is no output have been generated for the interreception time of packets. the trace function (L3RPTrace) and the output (void ComputeStatistics() ) function are called but no output i got..
it means there is a problem inside the function. i think it is related to the if condition in trace function (
if ((uint16_t) c2cHeader.GetHtype() == Node::C2C_GEOBCAST)
HOW I CAN TRACK THE PROBLEM AND WHERE?
THANKS A LOT AND BELOW IS THE CODE
void ComputeStatistics()
{
std::vector<uint64_t>::iterator vi;
int k =0;
uint64_t tmp_RxTime;
uint64_t sum_RxTime = 0;
//file_log2<<" RX_ID "<<" "<<" TX_ID "<<" "<<" average IRT "<<" "<<" variance IRT "<<" "<<" std_dev IRT "<<" "<<std::endl;
std::cout<<" CALLED33 Trace "<<std::endl; SIMULATION PRINT CALLED33 AND THEN NOTHING MORE
if (globalIrtMap == NULL) {
return;
std::cout<<" CALLED44 Trace "<<std::endl;
}
for (std::map<uint64_t, std::map<uint64_t, std::vector<uint64_t>*>*>::iterator i =globalIrtMap->begin(); i!= globalIrtMap->end(); ++i)
{
std::cout<<" CALLED55 Trace "<<std::endl;
std::map<uint64_t, std::vector<uint64_t>*>* irtMap = (*i).second;
for (std::map<uint64_t, std::vector<uint64_t>*>::iterator j = irtMap->begin(); j!= irtMap->end(); ++j)
{
std::vector<uint64_t>* rxTime = (*j).second;
for (vi = rxTime->begin()+1; vi < rxTime->end(); ++vi)
{
tmp_RxTime = *vi - *(vi-1);
rxTime->insert(vi-1, tmp_RxTime);
//I want to keep this in a vector to use it for variance calculation
std::cout<<"Inter-ReceptionTime to calculate the variance"<<tmp_RxTime<<std::endl;
sum_RxTime += tmp_RxTime;
}
//*1* To compute the average irt*****************************************************************************
uint64_t av_RxTime = sum_RxTime / (rxTime->size()-1);
std::cout<<" Average_Inter-ReceptionTime for each dedicated bi-directional communication "<<av_RxTime<<std::endl;
//*2* To compute the variance of irt**************************************************************************
uint64_t sample_variance = 0;
for (k = 1; k < rxTime->size()-1; ++k)
{
//variance[k-1]= rxTime->at(k) - rxTime->at(k-1);
sample_variance += ( ((rxTime->at(k) - rxTime->at(k-1)) - av_RxTime)*((rxTime->at(k) - rxTime->at(k-1)) - av_RxTime) / rxTime->size()-2) ;
}
//*3* To compute the variance of irt**************************************************************************
uint64_t stdDeviation = sqrt (sample_variance);
//*4* To plot the statistics of irt**************************************************************************
file_log2<<" RX_ID "<<(*i).first<<" TX_ID "<<(*j).first<<" average IRT "<<av_RxTime<<" variance IRT "<<sample_variance<<" std_dev IRT "<<stdDeviation<<std::endl;
}
}
}
;;;;
;;;;
;;;;
void
L3RPTrace(std::string context,
const c2cCommonHeader &c2cHeader, Ptr<const Packet> packet,
uint32_t interface)
{
std::cout<<" CALLED1 Trace "<<std::endl; THIS IS CALLED AND PRINTED
Ptr<Packet> p = packet->Copy();
std::cout<<" CALLED11 Trace "<<std::endl; THIS IS CALLED AND PRINTED
// case GeoBroadcast
if ((uint16_t) c2cHeader.GetHtype() == Node::C2C_GEOBCAST)
{
GeoABcastHeader bheader;
p->PeekHeader(bheader);
uint64_t sourceID = bheader.GetSourPosVector().gnAddr;
//uint64_t Tx_Time = (float) (bheader.GetSourPosVector().Ts);
uint64_t RX_Time = Simulator::Now().GetMilliSeconds();
uint64_t RxID; // TO BE DONE !!
std::map<uint64_t, std::map<uint64_t, std::vector<uint64_t>*>*>::iterator irtMapIter;
std::cout<<" CALLED2 Trace "<<std::endl;
if (globalIrtMap == NULL) { // we should never enter here but just in case
std::map<uint64_t, std::map<uint64_t, std::vector<uint64_t>*>*> rglobalIrtMap;
globalIrtMap=&rglobalIrtMap;
std::cout<<" CALLED3 Trace "<<std::endl;
}
irtMapIter = globalIrtMap->find(RxID); // should test if not NULL !!
if (irtMapIter == globalIrtMap->end()) { // no entry found
std::map<uint64_t, std::vector<uint64_t>*> rirtMap;
std::map<uint64_t, std::vector<uint64_t>*>* irtMap = &rirtMap;
std::vector<uint64_t> r_rxTime;
std::vector<uint64_t > *rxTime = &r_rxTime;
rxTime->push_back(RX_Time);
irtMap->insert(make_pair(sourceID,rxTime));
globalIrtMap->insert(make_pair(RxID,irtMap));
std::cout<<" CALLED4 Trace "<<std::endl;
}
else {
std::map<uint64_t, std::vector<uint64_t>*>* irtMap = (*irtMapIter).second; // !! we must check it exists (not NULL)
std::map<uint64_t, std::vector<uint64_t>*>::iterator it;
if (irtMap == NULL) { // we should never enter here but just in case
std::map<uint64_t, std::vector<uint64_t>*> rirtMap;
irtMap = &rirtMap;
std::cout<<" CALLED5 Trace "<<std::endl;
}
it = irtMap->find(sourceID);
//check if ID already exist in map
if (it == irtMap->end()) { // no entry found
std::vector<uint64_t> r_rxTime;
std::vector<uint64_t > *rxTime = &r_rxTime;
rxTime->push_back(RX_Time);
irtMap->insert(make_pair(sourceID,rxTime));
globalIrtMap->insert(make_pair(RxID,irtMap));
std::cout<<" CALLED6 Trace "<<std::endl;
}
else {
std::vector<uint64_t>* rxTime = (*it).second;
if (rxTime == NULL) { // we should never enter here but just in case
std::vector<uint64_t> r_rxTime;
rxTime = &r_rxTime;
std::cout<<" CALLED7 Trace "<<std::endl;
}
rxTime->push_back(RX_Time);
irtMap->insert(make_pair(sourceID,rxTime));
globalIrtMap->insert(make_pair(RxID,irtMap));
std::cout<<" CALLED8 Trace "<<std::endl;
}
}
std::cout<<" CALLED9 Trace "<<std::endl;
}
std::cout<<" CALLED10 Trace "<<std::endl; THIS IS CALLED AND PRINTED
}
....
.....
....
Config::Connect("/NodeList/*/$ns3::c2cL3Protocol/LocalDeliver",MakeCallback(&L3RPTrace));
Simulator::Run();
ComputeStatistics();
file_log2.close();
Simulator::Destroy();
return 0;
The problem has nothing to do with the wave module. The problem seems to be related to the c2cL3Protocol, which is part of the iTETRIS package (never merged with ns-3). The iTETRIS system was developed for an older ns-3 release, and at the moment it is easy to investigate further without considerable effort. The best suggestion is to direct further questions to ns-3 users forums (https://groups.google.com/forum/#!forum/ns-3-users) and to use a debugger to be sure that the "LocalDeliver" callback is, indeed, called. |