From: <sul...@us...> - 2008-08-23 06:55:24
|
Revision: 237 http://gridsim.svn.sourceforge.net/gridsim/?rev=237&view=rev Author: sulistio Date: 2008-08-23 06:55:34 +0000 (Sat, 23 Aug 2008) Log Message: ----------- minor changes Modified Paths: -------------- trunk/source/gridsim/net/flow/FlowInput.java trunk/source/gridsim/net/flow/FlowLink.java trunk/source/gridsim/net/flow/FlowOutput.java trunk/source/gridsim/net/flow/FlowPacket.java Modified: trunk/source/gridsim/net/flow/FlowInput.java =================================================================== --- trunk/source/gridsim/net/flow/FlowInput.java 2008-08-23 05:40:09 UTC (rev 236) +++ trunk/source/gridsim/net/flow/FlowInput.java 2008-08-23 06:55:34 UTC (rev 237) @@ -188,9 +188,11 @@ // Update flow duration forecast as a flow's bottleneck bandwidth has changed } else if (ev.get_tag() == GridSimTags.FLOW_UPDATE) { //System.out.println(super.get_name() + ".body(): updateForecast() + at time = " + GridSim.clock()); - updateForecast(ev); + updateForecast(ev); + } + // if this entity is not connected in a network topology - } else if (obj != null && obj instanceof IO_data) { + if (obj != null && obj instanceof IO_data) { //System.out.println(super.get_name() + ".body(): getDataFromEvent() + at time = " + GridSim.clock()); getDataFromEvent(ev); // if this entity belongs to a network topology @@ -232,7 +234,7 @@ // + " heading to " + GridSim.getEntityName(fp.getDestID())); // Deregister flow on all active links - Iterator it = (fp.getLinks_()).iterator(); + Iterator it = (fp.getLinks()).iterator(); while (it.hasNext()) { FlowLink fl = (FlowLink) it.next(); fl.deregisterFlow(fp); @@ -268,22 +270,22 @@ // If flow hasn't already finished and been cleared... if ((fp = (FlowPacket) activeFlows_.get(pktID)) != null) { remSizeOld = fp.getRemSize(); - bandwidthOld = fp.getBandwidth_(); + bandwidthOld = fp.getBandwidth(); //System.out.println(super.get_name() + "updateForecast(): rem size is " + remSizeOld + // "BW old is " + bandwidthOld + " last update " + fp.getUpdateTime()); - Iterator it = (fp.getLinks_()).iterator(); + Iterator it = (fp.getLinks()).iterator(); // Find the source link of this notification and the associated bottleneck bandwidth while (it.hasNext()) { FlowLink fl = (FlowLink) it.next(); if (fl.get_id() == sourceID) { - fp.setBandwidth_(fl.getBaudRate()); + fp.setBandwidth(fl.getBaudRate()); fp.setBottleneckID(sourceID); } } fp.setRemSize((long)((remSizeOld) - ((GridSim.clock()-fp.getUpdateTime())*(bandwidthOld/NetIO.BITS)))); - duration = (fp.getRemSize()*NetIO.BITS)/fp.getBandwidth_(); + duration = (fp.getRemSize()*NetIO.BITS)/fp.getBandwidth(); //System.out.println(super.get_name() + " new forecast end time is " + (GridSim.clock() + duration)); // Find old forecast and delete it! @@ -422,7 +424,7 @@ } //System.out.println(super.get_name() + ".getDataFromLink() Time now " + GridSim.clock() - // + " bottleneck is " + np.getBandwidth_() + " sum lat is " + np.getLatency() ); + // + " bottleneck is " + np.getBandwidth() + " sum lat is " + np.getLatency() ); // if flow terminates at next entity, add to active flows // & hold for appropriate duration @@ -431,7 +433,7 @@ || pkt.getTag() == GridSimTags.JUNK_PKT) { np.setStartTime(GridSim.clock()); np.setUpdateTime(GridSim.clock()); - duration = np.getSize()*NetIO.BITS / np.getBandwidth_(); + duration = np.getSize()*NetIO.BITS / np.getBandwidth(); activeFlows_.put(pkt.getID(), pkt); super.sim_schedule(super.get_id(), duration, GridSimTags.FLOW_HOLD, new Integer(pkt.getID())); //System.out.println(super.get_name() + ".getDataFromLink() initial forecast flow end at " + (GridSim.clock() Modified: trunk/source/gridsim/net/flow/FlowLink.java =================================================================== --- trunk/source/gridsim/net/flow/FlowLink.java 2008-08-23 05:40:09 UTC (rev 236) +++ trunk/source/gridsim/net/flow/FlowLink.java 2008-08-23 06:55:34 UTC (rev 237) @@ -423,7 +423,7 @@ while(flowsIter.hasNext()) { tempFlow = (FlowPacket) activeFlows_.get(flowsIter.next()); // If change in bandwidth affects an existing flow i.e. is < current bottleneck - if (this.getBaudRate() < tempFlow.getBandwidth_() && tempFlow.getID() != np.getID()) { + if (this.getBaudRate() < tempFlow.getBandwidth() && tempFlow.getID() != np.getID()) { // Need to notify flow //System.out.println(super.get_name() + ".registerFlow(): flow #" + np.getID() // + " bottleneck now " + this.getBaudRate() + " at time " + GridSim.clock()); @@ -444,6 +444,8 @@ * @pre $none * @post $none */ + // NOTE: this method is called in FlowInput.java line 238 + // inside the checkForecast() method public synchronized void deregisterFlow(Packet np) { FlowPacket fp = null; FlowPacket tempFlow; @@ -452,7 +454,7 @@ if ((fp = (FlowPacket) activeFlows_.remove(np.getID())) != null) { //System.out.println(super.get_name() + ".deregisterFlow() success flow # " + np.getID() - // + " " + fp.getBandwidth_()); + // + " " + fp.getBandwidth()); // Check if this affects any existing flows Iterator<Integer> flowsIter = activeFlows_.keySet().iterator(); @@ -460,7 +462,7 @@ tempFlow = (FlowPacket) activeFlows_.get(flowsIter.next()); // If change in bandwidth affects an existing flow i.e. is > current bottleneck // AND this link is the particular flow's bottleneck - if (this.getBaudRate() > tempFlow.getBandwidth_() && tempFlow.getID() != np.getID() && + if (this.getBaudRate() > tempFlow.getBandwidth() && tempFlow.getID() != np.getID() && tempFlow.getBottleneckID() == this.get_id()) { // Need to notify flow //System.out.println(super.get_name() + ".deregisterFlow(): flow #" + np.getID() Modified: trunk/source/gridsim/net/flow/FlowOutput.java =================================================================== --- trunk/source/gridsim/net/flow/FlowOutput.java 2008-08-23 05:40:09 UTC (rev 236) +++ trunk/source/gridsim/net/flow/FlowOutput.java 2008-08-23 06:55:34 UTC (rev 237) @@ -46,11 +46,11 @@ private TrafficGenerator gen_; // background traffic generator private ArrayList list_; // list of resources + user entities private boolean hasStarted_; // a flag for background traffic has started - - private Random rnd; // Random number generator to generate unique - // flow ID's + private Random rnd; // Random number generator to generate unique + // flow ID's + /** * Allocates a new FlowOutput object * @param name the name of this object @@ -78,7 +78,7 @@ list_ = null; random_ = null; hasStarted_ = false; - + rnd = new Random(); } @@ -263,9 +263,9 @@ break; } - //System.out.println(super.get_name() + ".body(): ev.get_tag() is " + ev.get_tag()); - //System.out.println(super.get_name() + ".body(): ev.get_src() is " + ev.get_src()); - + //System.out.println(super.get_name() + ".body(): ev.get_tag() is " + ev.get_tag()); + //System.out.println(super.get_name() + ".body(): ev.get_src() is " + ev.get_src()); + // handle different types of incoming events switch ( ev.get_tag() ) { @@ -302,7 +302,7 @@ */ private synchronized void generateBackgroundTraffic() { - + // get the next inter-arrival time for these junk packets long time = gen_.getNextPacketTime(); @@ -361,10 +361,10 @@ System.out.println(super.get_name() + ": Destination id = " + destId + " = " + GridSim.getEntityName(destId) ); *********/ - + convertIntoPacket(size, 1, tag, destId, type); - + } // send to all resources + other entities else if (pattern == TrafficGenerator.SEND_ALL) @@ -437,7 +437,7 @@ if (link_ != null && destId != gisID && destId != statID && destId != shutdownID) { - //System.out.println(super.get_name() + ".defaultSend(): submitToLink() + at time = " + GridSim.clock()); + //System.out.println(super.get_name() + ".defaultSend(): submitToLink() + at time = " + GridSim.clock()); submitToLink(ev); return; } @@ -465,7 +465,7 @@ } /** - * This method takes data from an entity. The data is encapsulated in a single FlowPacket. + * This method takes data from an entity. The data is encapsulated in a single FlowPacket. * After this it calls enque() to queue these flows into its * buffer. * @@ -487,8 +487,8 @@ FlowPacket np = null; np = new FlowPacket(obj,rnd.nextInt(Integer.MAX_VALUE),size,tag,super.get_id(), destId, netServiceType, 1, 1); - - + + //System.out.println("Sending flow packet to link at time = " + GridSim.clock() + " id is " + np.getID()); enque(np, GridSimTags.SCHEDULE_NOW); } @@ -616,15 +616,15 @@ */ private synchronized void enque(Packet pkt, double delay) { - flowList_.add(pkt); + flowList_.add(pkt); if (flowList_.size() == 1) { - //System.out.println(super.get_name() + ".enque() Size is " + pkt.getSize() + " baud " + link_.getBaudRate()); - double total = 0.0; - - //System.out.println(super.get_name() + ".enque() Time now " + GridSim.clock() + " delay is " + total); + //System.out.println(super.get_name() + ".enque() Size is " + pkt.getSize() + " baud " + link_.getBaudRate()); + double total = 0.0; + + //System.out.println(super.get_name() + ".enque() Time now " + GridSim.clock() + " delay is " + total); super.sim_schedule(super.get_id(), total, GridSimTags.SEND_PACKET); - } + } } @@ -658,7 +658,7 @@ // if an entity tries to send a packet to itself if ( np.getDestID() == outPort_.get_dest() ) { - //System.out.println("Sending packet to self!"); + //System.out.println("Sending packet to self!"); // then change the destination name and id String destName = super.get_name(); destName = destName.replaceFirst("Output", "Input"); @@ -699,10 +699,10 @@ if (flowList_.isEmpty() != true) { //double delay = np.getSize() * SIZE / link_.getBaudRate(); - double delay = 0.0; + double delay = 0.0; super.sim_schedule(super.get_id(), delay, GridSimTags.SEND_PACKET); } } - + } // end class Modified: trunk/source/gridsim/net/flow/FlowPacket.java =================================================================== --- trunk/source/gridsim/net/flow/FlowPacket.java 2008-08-23 05:40:09 UTC (rev 236) +++ trunk/source/gridsim/net/flow/FlowPacket.java 2008-08-23 06:55:34 UTC (rev 237) @@ -412,7 +412,7 @@ baudRates_.add( new Double(baudRate) ); if (bandwidth_ < 0 || baudRate < this.bandwidth_) { - this.setBandwidth_(baudRate); + this.setBandwidth(baudRate); this.setBottleneckID(link.get_id()); } } @@ -424,7 +424,7 @@ * @pre $none * @post $none */ - public double getBandwidth_() { + public double getBandwidth() { return bandwidth_; } @@ -435,7 +435,7 @@ * @pre $none * @post $none */ - public synchronized void setBandwidth_(double bandwidth_) { + public synchronized void setBandwidth(double bandwidth_) { this.bandwidth_ = bandwidth_; } @@ -532,7 +532,7 @@ * @pre $none * @post $none */ - public Vector getLinks_() { + public Vector getLinks() { return links_; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |