Unipisa / Simu5G

Simu5G - 5G NR and LTE/LTE-A user-plane simulation model for OMNeT++ & INET
https://simu5g.org
Other
142 stars 81 forks source link

Question about a parameter in VIM::calculateProcessingTime #139

Closed KeFan-USTC closed 1 year ago

KeFan-USTC commented 1 year ago

The function calculateProcessingTime(int mecAppID, int numOfInstructions) is to simulate processing time for execute a number of instructions. So I want to know how can I set the int numOfInstructions. I notice there is an example in MecAppBase.cc double time = vim->calculateProcessingTime(mecAppId, 150);. The numofInstructions is set as 150. So if the numOfInstructions is set under the number set in the warningAlertApp.json virtualCpu : 1500 is reasonable, or I have to compute a suitable numOfInstructions by a certain way?

giovanninardini commented 1 year ago

Hello,

the virtualCpu field in the warningAlertApp.json file is the share of CPU power requested to execute that MEC app. It is used to perform access control, e.g. to see if a MEC host has enough available resources to instantiate the requested MEC app. If so, the MEC app is allocated that amount of "CPU power". Such field is in millions instructions per second. When you calculate the processing time, the numOfInstructions argument defines how many instructions that part of MEC app code needs to execute before obtaining a result. The value you set there may be not related to the virtualCpu in the json file. The processing time is then obtained as a function of the numOfInstructions value and the allocated "CPU power", as defined above.

KeFan-USTC commented 1 year ago

Hello,

the virtualCpu field in the warningAlertApp.json file is the share of CPU power requested to execute that MEC app. It is used to perform access control, e.g. to see if a MEC host has enough available resources to instantiate the requested MEC app. If so, the MEC app is allocated that amount of "CPU power". Such field is in millions instructions per second. When you calculate the processing time, the numOfInstructions argument defines how many instructions that part of MEC app code needs to execute before obtaining a result. The value you set there may be not related to the virtualCpu in the json file. The processing time is then obtained as a function of the numOfInstructions value and the allocated "CPU power", as defined above.

Thanks for your reply. Thanks to your explaination , I correct some improper understanding before. But I have another question is that why we set "150" in "MecAppBase.cc double time = vim>calculateProcessingTime(mecAppId, 150);" rather than other numbers. As for now, what I am doing in Simu5G/Mec is that I want to send a matrix from UeApp , MecApp processs it and send back a result to ue, so I want to know how to set a reasonable numOfInstructions so as to compute processing time in MecApp and the delay in the total scenario. "" is the parameter numOfInstruction void MECWarningAlertApp::handleMessage(cMessage msg) { /**add1**/ if (!msg->isSelfMessage()) { if(ueSocket.belongsToSocket(msg)) { pktNum++; EV << "receive no."<<pktNum<<"packet"<<endl; if(pktNum == 24){ auto pk = check_and_cast<Packet *>(msg); auto matrixPk = dynamicPtrCast(pk->peekAtFront()); // int dim = sqrt(matrixPk->getByteArraySize()); double time = vim->calculateProcessingTime(mecAppId, **); //random latency time = time + (rand() % 1000 / (float)1000) time; EV<< "test time:" << time; pac = check_and_cast<Packet >(msg)->dup(); scheduleAt(simTime()+time,processedUERequest); //handleUeMessage(msg); delete msg; return; } } } if(strcmp(msg->getName(), "processedUERequest") == 0) { handleUeMessage(pac); } else return;

}

giovanninardini commented 1 year ago

150 is just a number. It is the number of instruction that a programmer would need to write in a real application to implement its functionalities. So if your MEC app is modeling a simple application, then it is likely that the programmer would need to write few instructions. Otherwise, if your MEC app is modeling a complex application, it is likely that a larger number of instructions would be needed.

KeFan-USTC commented 1 year ago

Thanks for your reply!