A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
BUGFIX bindinig always with port 80 cause more than two incoming flows on the same...
[simgrid.git]
/
src
/
surf
/
gtnets
/
gtnets_simulator.cc
diff --git
a/src/surf/gtnets/gtnets_simulator.cc
b/src/surf/gtnets/gtnets_simulator.cc
index
eac36f4
..
e915aa6
100644
(file)
--- a/
src/surf/gtnets/gtnets_simulator.cc
+++ b/
src/surf/gtnets/gtnets_simulator.cc
@@
-15,6
+15,7
@@
static vector<void*> meta_flows;
static int* meta_nflow;
static int meta_flg = 0;
static int* meta_nflow;
static int meta_flg = 0;
+
void static tcp_sent_callback(void* action, double completion_time);
// Constructor.
void static tcp_sent_callback(void* action, double completion_time);
// Constructor.
@@
-26,6
+27,7
@@
GTSim::GTSim(){
sim_ = new Simulator();
topo_ = new GTNETS_Topology();
sim_ = new Simulator();
topo_ = new GTNETS_Topology();
+ sim_->verbose=false;
// Set default values.
TCP::DefaultAdvWin(wsize);
TCP::DefaultSegSize(1000);
// Set default values.
TCP::DefaultAdvWin(wsize);
TCP::DefaultSegSize(1000);
@@
-161,7
+163,6
@@
void GTSim::create_gtnets_topology(){
int GTSim::add_route(int src, int dst, int* links, int nlink){
if (is_topology_ == 0){
create_gtnets_topology();
int GTSim::add_route(int src, int dst, int* links, int nlink){
if (is_topology_ == 0){
create_gtnets_topology();
- // topo_->print_topology();
is_topology_ = 1;
}
is_topology_ = 1;
}
@@
-233,7
+234,6
@@
int GTSim::create_flow(int src, int dst, long datasize, void* metadata){
//generate it here.
if (is_topology_ == 0){
create_gtnets_topology();
//generate it here.
if (is_topology_ == 0){
create_gtnets_topology();
- // topo_->print_topology();
is_topology_ = 1;
}
is_topology_ = 1;
}
@@
-248,15
+248,17
@@
int GTSim::create_flow(int src, int dst, long datasize, void* metadata){
return -1;
}
return -1;
}
- gtnets_servers_[nflow_] = (TCPServer*)gtnets_nodes_[dst_node]->
+ gtnets_servers_[nflow_] = (TCPServer*)
gtnets_nodes_[dst_node]->
AddApplication(TCPServer(TCPReno()));
AddApplication(TCPServer(TCPReno()));
- gtnets_servers_[nflow_]->BindAndListen(
80
);
+ gtnets_servers_[nflow_]->BindAndListen(
1000+nflow_
);
gtnets_clients_[nflow_] = (TCPSend*)gtnets_nodes_[src_node]->
AddApplication(TCPSend(metadata, gtnets_nodes_[dst_node]->GetIPAddr(),
gtnets_clients_[nflow_] = (TCPSend*)gtnets_nodes_[src_node]->
AddApplication(TCPSend(metadata, gtnets_nodes_[dst_node]->GetIPAddr(),
-
80
, Constant(datasize), TCPReno()));
+
1000+nflow_
, Constant(datasize), TCPReno()));
gtnets_clients_[nflow_]->SetSendCallBack(tcp_sent_callback);
gtnets_clients_[nflow_]->Start(0);
gtnets_clients_[nflow_]->SetSendCallBack(tcp_sent_callback);
gtnets_clients_[nflow_]->Start(0);
+
+ gtnets_action_to_flow_[metadata] = nflow_;
nflow_++;
return 0;
nflow_++;
return 0;
@@
-266,14
+268,19
@@
Time_t GTSim::get_time_to_next_flow_completion(){
int status;
Time_t t1;
int pfds[2];
int status;
Time_t t1;
int pfds[2];
+ int soon_pid=-1;
meta_flg=0;
meta_flg=0;
+
+ //remain needs to be updated in the future
+ Count_t remain;
pipe(pfds);
t1 = 0;
pipe(pfds);
t1 = 0;
- if (fork() != 0){
+
+ if ( (soon_pid=fork()) != 0){
read(pfds[0], &t1, sizeof(Time_t));
read(pfds[0], &t1, sizeof(Time_t));
- waitpid(
-1
, &status, 0);
+ waitpid(
soon_pid
, &status, 0);
}else{
Time_t t;
t = sim_->RunUntilNextCompletion();
}else{
Time_t t;
t = sim_->RunUntilNextCompletion();
@@
-284,7
+291,13
@@
Time_t GTSim::get_time_to_next_flow_completion(){
return t1;
}
return t1;
}
+double GTSim::gtnets_get_flow_rx(void *metadata){
+ int flow_id = gtnets_action_to_flow_[metadata];
+ return gtnets_servers_[flow_id]->GetTotRx();
+}
+
int GTSim::run_until_next_flow_completion(void ***metadata, int *number_of_flows){
int GTSim::run_until_next_flow_completion(void ***metadata, int *number_of_flows){
+
meta_flows.clear();
meta_nflow = number_of_flows;
meta_flg = 1;
meta_flows.clear();
meta_nflow = number_of_flows;
meta_flg = 1;
@@
-314,3
+327,4
@@
void static tcp_sent_callback(void* action, double completion_time){
}
}
}
}
+