代码拉取完成,页面将自动刷新
同步操作将从 Hic/popnet_modified 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "mess_queue.h"
#include "sim_foundation.h"
#include <string>
#include <iostream>
#include <strstream>
#include <unistd.h>
//#include"global.h"
//changed at 2020-5-23
ofstream logfile("popnet.log");
bool operator<(const mess_event & a, const mess_event & b) {
return a.event_start() < b.event_start();
}
bool operator>(const mess_event&a,const mess_event&b)
{
return a.event_start()>b.event_start();
}
mess_queue * mess_queue::m_pointer_ = nullptr;
mess_queue::mess_queue(time_type start_time):
current_time_(0),
last_time_(0),
mess_counter_(0),
m_q_(),
total_finished_(0)
{
current_time_ = start_time;
m_pointer_ = this;
//changed at 2020-5-8
//add_message(mess_event(0, ROUTER_));
//add_message(mess_event(TIME_0, ROUTER_));
}
string mess_queue:: mess_error_ =
string("This message type is not supported.\n");
//commented at 2020-3
//主循环,不断循环处理消息
void mess_queue::simulator() {
//changed at 2020-5-23
//static uint64_t wireMsgCnt=0,creditMsgCnt=0;
//time_type report_t = 0;
time_type report_t=TIME_0;
long total_incoming = 0;
setInitEvent();
//修改此循环
//when mess queue is not empty and simulation deadline has not reach
while(m_q_.size() > 0 && (current_time_ <= (configuration
::ap().sim_length()))) {
//changed at 2021-10-26
//mess_event current_message = * get_message();
mess_event current_message=get_message();
//changed at 2020-5-23
//输出日志
//logfile<<current_message;
if(current_message.event_type()==WIRE_||current_message.event_type()==CREDIT_){
logfile<<"\tFrom Router "<<current_message.src()
<<" to Router "<<current_message.des()
<<" Port "<<current_message.pc()
<<" Virtual Channel "<<current_message.vc()<<endl;
}
remove_top_message();
//保证当前时间小于或等于事件开始时间
Sassert(static_cast<bool>(current_time_ <= ((current_message.
event_start()) + S_ELPS_)));
//if(current_time_>current_message.event_start()+S_ELPS_)continue;
current_time_ = current_message.event_start();
if(current_time_ > report_t) {
cout<<"Current time: "<<current_time_<<" Incoming packets: "
<<total_incoming<<" Finished packets: "<<total_finished_<<endl;
//changed at 2020-5-23
//cout<<"Wire Message Count: "<<wireMsgCnt<<" Credit Message Count: "<<creditMsgCnt<<endl;
sim_foundation::wsf().simulation_results();
//changed at 2022-4-13
//自定义报告周期
//report_t += REPORT_PERIOD_;
report_t+=configuration::ap().getReportPeriod();
}
switch(current_message.event_type()) {
case EVG_ ://读取轨迹文件的下一条记录
//TODO: 改为读取外部输入
sim_foundation::wsf().receive_EVG_message(current_message);
total_incoming ++;
break;
case ROUTER_ :
sim_foundation::wsf().receive_ROUTER_message(current_message);
break;
case WIRE_ :
sim_foundation::wsf().receive_WIRE_message(current_message);
//changed at 2020-5-23
//wireMsgCnt++;
break;
case CREDIT_ :
sim_foundation::wsf().receive_CREDIT_message(current_message);
//changed at 2020-5-23
//creditMsgCnt++;
break;
case RECONFIGURATION:
sim_foundation::wsf().receive_RECONFIGURATION_message(current_message);
break;
default:
throw pro_error(mess_error_);
break;
}
}
}
void mess_queue::setInitEvent()
{
switch(configuration::ap().routing_alg()){
case RECONFIGURABLE_GRAPH_TOPO:
add_message(mess_event(TIME_0-S_ELPS_/2,RECONFIGURATION));
case GRAPH_TOPO:
for(auto&p:routing_periods){
add_message(mess_event(TIME_0,ROUTER_,p));
}
break;
default:
add_message(mess_event(TIME_0, ROUTER_));
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。