X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2c8e75834bbb63acef15c560c3de978ab3cb6fbf..5b3677b425b9cc6949c1573d59ac772540cbf4b2:/src/surf/gtnets/gtnets_simulator.cc diff --git a/src/surf/gtnets/gtnets_simulator.cc b/src/surf/gtnets/gtnets_simulator.cc index a2955febef..920b915289 100644 --- a/src/surf/gtnets/gtnets_simulator.cc +++ b/src/surf/gtnets/gtnets_simulator.cc @@ -1,5 +1,5 @@ -/* $Id$ */ -/* Copyright (c) 2007 Kayo Fujiwara. All rights reserved. */ +/* Copyright (c) 2007-2011, 2014. The SimGrid Team. + * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -8,8 +8,8 @@ #include "gtnets_topology.h" #include #include -#ifdef DEBUG0 - #undef DEBUG0 +#ifdef XBT_DEBUG + #undef XBT_DEBUG #endif #include "xbt/log.h" #include "xbt/asserts.h" @@ -83,7 +83,6 @@ GTSim::GTSim(int WindowSize){ Queue::Default(*default_red_queue_); delete default_red_queue_; - cout << "Set default window size to " << wsize << endl; TCP::DefaultAdvWin(wsize); TCP::DefaultSegSize(1000); TCP::DefaultTxBuffer(128000); @@ -213,18 +212,18 @@ GTSim::~GTSim(){ } int GTSim::add_router(int id){ - xbt_assert1(!(topo_->add_router(id) < 0), "can't add router %d. already exists", id); + xbt_assert(!(topo_->add_router(id) < 0), "can't add router %d. already exists", id); } //bandwidth: in bytes. //latency: in seconds. int GTSim::add_link(int id, double bandwidth, double latency){ double bw = bandwidth * 8; //Bandwidth in bits (used in GTNETS). - xbt_assert1(!(topo_->add_link(id) < 0),"Can't add link %d. already exists", id); - DEBUG3("Creating a new P2P, linkid %d, bandwidth %gl, latency %gl", id, bandwidth, latency); + xbt_assert(!(topo_->add_link(id) < 0),"Can't add link %d. already exists", id); + XBT_DEBUG("Creating a new P2P, linkid %d, bandwidth %gl, latency %gl", id, bandwidth, latency); gtnets_links_[id] = new Linkp2p(bw, latency); if(jitter_ > 0){ - DEBUG2("Using jitter %f, and seed %u", jitter_, jitter_seed_); + XBT_DEBUG("Using jitter %f, and seed %u", jitter_, jitter_seed_); double min = -1*jitter_*latency; double max = jitter_*latency; uniform_jitter_generator_[id] = new Uniform(min,max); @@ -246,7 +245,7 @@ bool GTSim::link_include(int id){ } int GTSim::add_onehop_route(int src, int dst, int link){ - xbt_assert3(!(topo_->add_onehop_route(src, dst, link) < 0), "Cannot add a route, src: %d, dst: %d, link: %d", src, dst, link); + xbt_assert(!(topo_->add_onehop_route(src, dst, link) < 0), "Cannot add a route, src: %d, dst: %d, link: %d", src, dst, link); return 0; } @@ -261,7 +260,7 @@ void GTSim::add_nodes(){ id = (*it)->id(); gtnets_nodes_[id] = new Node(); gtnets_nodes_[id]->SetIPAddr(address++); - DEBUG2("In GTSim, add_node: %d, with IPAddr %s", id, helper.ToDotted(address-1)); + XBT_DEBUG("In GTSim, add_node: %d, with IPAddr %s", id, helper.ToDotted(address-1)); } } @@ -281,7 +280,7 @@ void GTSim::node_connect(){ gtnets_nodes_[srcid]-> AddDuplexLink(gtnets_nodes_[dstid], *(gtnets_links_[linkid])); - DEBUG3("Setting DuplexLink, src %d, dst %d, linkid %d", srcid, dstid, linkid); + XBT_DEBUG("Setting DuplexLink, src %d, dst %d, linkid %d", srcid, dstid, linkid); } } } @@ -310,8 +309,8 @@ int GTSim::add_route(int src, int dst, int* links, int nlink){ int src_node = topo_->nodeid_from_hostid(src); int dst_node = topo_->nodeid_from_hostid(dst); - xbt_assert1(!(gtnets_nodes_.find(src_node) == gtnets_nodes_.end()), "Node %d not found", src_node); - xbt_assert1(!(gtnets_nodes_.find(dst_node) == gtnets_nodes_.end()), "Node %d not found", dst_node); + xbt_assert(!(gtnets_nodes_.find(src_node) == gtnets_nodes_.end()), "Node %d not found", src_node); + xbt_assert(!(gtnets_nodes_.find(dst_node) == gtnets_nodes_.end()), "Node %d not found", dst_node); Node* tmpsrc = gtnets_nodes_[src_node]; Node* tmpdst = gtnets_nodes_[dst_node]; @@ -320,10 +319,10 @@ int GTSim::add_route(int src, int dst, int* links, int nlink){ cur_node = src_node; for (int i = 0; i < nlink; i++){ - xbt_assert1(!(gtnets_nodes_.find(cur_node) == gtnets_nodes_.end()), "Node %d not found", cur_node); + xbt_assert(!(gtnets_nodes_.find(cur_node) == gtnets_nodes_.end()), "Node %d not found", cur_node); next_node = topo_->peer_node_id(links[i], cur_node); - xbt_assert0(!(next_node < 0), "Peer node not found"); - xbt_assert1(!(gtnets_nodes_.find(next_node) == gtnets_nodes_.end()), "Node %d not found", next_node); + xbt_assert(!(next_node < 0), "Peer node not found"); + xbt_assert(!(gtnets_nodes_.find(next_node) == gtnets_nodes_.end()), "Node %d not found", next_node); //add route Node* tmpcur = gtnets_nodes_[cur_node]; @@ -342,7 +341,7 @@ int GTSim::add_route(int src, int dst, int* links, int nlink){ cur_node = next_node; } - xbt_assert2(!(cur_node != dst_node), "Route inconsistency, last: %d, dst: %d",cur_node, dst_node); + xbt_assert(!(cur_node != dst_node), "Route inconsistency, last: %d, dst: %d",cur_node, dst_node); return 0; } @@ -358,10 +357,10 @@ int GTSim::create_flow(int src, int dst, long datasize, void* metadata){ } int src_node = topo_->nodeid_from_hostid(src); - xbt_assert1(!(src_node < 0), "Src %d not found", src_node); + xbt_assert(!(src_node < 0), "Src %d not found", src_node); int dst_node = topo_->nodeid_from_hostid(dst); - xbt_assert1(!(dst_node < 0), "Dst %d not found", dst_node); + xbt_assert(!(dst_node < 0), "Dst %d not found", dst_node); gtnets_servers_[nflow_] = (TCPServer*) gtnets_nodes_[dst_node]-> AddApplication(TCPServer(TCPReno())); @@ -431,7 +430,7 @@ int GTSim::run(double delta){ } void GTSim::set_jitter(double d){ - xbt_assert1(((0 <= d)&&(d <= 1)), "The jitter value must be within interval [0.0;1.0), got %f", d); + xbt_assert(((0 <= d)&&(d <= 1)), "The jitter value must be within interval [0.0;1.0), got %f", d); jitter_ = d; } @@ -439,7 +438,7 @@ void GTSim::set_jitter_seed(int s){ jitter_seed_ = s; if(jitter_seed_ > 0.0){ - INFO1("Setting the jitter_seed with %d", jitter_seed_ ); + XBT_INFO("Setting the jitter_seed with %d", jitter_seed_ ); Random::GlobalSeed(jitter_seed_ , jitter_seed_ , jitter_seed_ ,jitter_seed_ ,jitter_seed_ ,jitter_seed_); } }