From: <bro...@us...> - 2008-03-14 01:14:32
|
Revision: 158 http://gridsim.svn.sourceforge.net/gridsim/?rev=158&view=rev Author: brobergj Date: 2008-03-13 18:05:46 -0700 (Thu, 13 Mar 2008) Log Message: ----------- Bug fixes Modified Paths: -------------- branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowInput.java Modified: branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowInput.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowInput.java 2008-03-13 05:39:26 UTC (rev 157) +++ branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowInput.java 2008-03-14 01:05:46 UTC (rev 158) @@ -232,6 +232,15 @@ // Send ack to source of flow System.out.println(super.get_name() + ".checkForecast(): flow came from " + GridSim.getEntityName(fp.getSrcID()) + " heading to " + GridSim.getEntityName(fp.getDestID())); + + // Deregister flow on all active links + Iterator it = (fp.getLinks_()).iterator(); + while (it.hasNext()) { + FlowLink fl = (FlowLink) it.next(); + fl.deregisterFlow(fp); + } + + /* int oldDestID = fp.getDestID(); int oldSrcID = fp.getSrcID(); @@ -248,7 +257,7 @@ super.sim_schedule(GridSim.getEntityId("Output_" + GridSim.getEntityName(oldDestID)), GridSimTags.SCHEDULE_NOW, GridSimTags.FLOW_ACK, fpAck); - //super.sim_schedule(super.get_id(), GridSimTags.SCHEDULE_NOW, GridSimTags.FLOW_ACK, fpAck); + //super.sim_schedule(super.get_id(), GridSimTags.SCHEDULE_NOW, GridSimTags.FLOW_ACK, fpAck); */ } else { System.out.println(super.get_name() + ".checkForecast(): pkt id # " + pktID + " already removed"); @@ -280,7 +289,8 @@ if ((fp = (FlowPacket) activeFlows_.get(pktID)) != null) { remSizeOld = fp.getRemSize(); bandwidthOld = fp.getBandwidth_(); - System.out.println(super.get_name() + "updateForecast(): rem size is " + remSizeOld + "BW old is " + bandwidthOld); + System.out.println(super.get_name() + "updateForecast(): rem size is " + remSizeOld + + "BW old is " + bandwidthOld + " last update " + fp.getUpdateTime()); Iterator it = (fp.getLinks_()).iterator(); while (it.hasNext()) { @@ -291,9 +301,9 @@ } } - fp.setRemSize((long)(remSizeOld*BITS - (GridSim.clock()-fp.getUpdateTime())*bandwidthOld)); - duration = fp.getRemSize()/fp.getBandwidth_(); - System.out.println(super.get_name() + " new remaining duration add " + duration); + fp.setRemSize((long)((remSizeOld) - ((GridSim.clock()-fp.getUpdateTime())*(bandwidthOld/BITS)))); + duration = (fp.getRemSize()*BITS)/fp.getBandwidth_(); + System.out.println(super.get_name() + " new forecast end time is " + (GridSim.clock() + duration)); FilterFlow filter = new FilterFlow(fp.getID(), GridSimTags.FLOW_HOLD); cancelledFlow = this.sim_cancel(filter, null); @@ -304,6 +314,7 @@ } System.out.println(super.get_name() + " setting updated forecast for packet #" + fp.getID()); + fp.setUpdateTime(GridSim.clock()); super.sim_schedule(super.get_id(), duration, GridSimTags.FLOW_HOLD , new Integer(fp.getID())); } @@ -423,35 +434,30 @@ if (tag == GridSimTags.EMPTY_PKT && np.getData() == null) { return; } - - // convert the packets into IO_data - Object data = np.getData(); - IO_data io = new IO_data( data, np.getSize(), - inPort_.get_src()); + System.out.println(super.get_name() + ".getDataFromLink() Time now " + GridSim.clock() + " bottleneck is " + np.getBandwidth_() + " sum lat is " + np.getLatency() ); // if flow terminates at next entity, add to active flows // & hold for appropriate duration if (pkt.getTag() == GridSimTags.FLOW_SUBMIT || pkt.getTag() == GridSimTags.GRIDLET_SUBMIT || - pkt.getTag() == GridSimTags.GRIDLET_SUBMIT_ACK || pkt.getTag() == GridSimTags.GRIDLET_RETURN) { + pkt.getTag() == GridSimTags.GRIDLET_SUBMIT_ACK || pkt.getTag() == GridSimTags.GRIDLET_RETURN + || pkt.getTag() == GridSimTags.JUNK_PKT) { np.setStartTime(GridSim.clock()); np.setUpdateTime(GridSim.clock()); duration = np.getSize()*SIZE / 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() forecast flow end at " + (GridSim.clock() + System.out.println(super.get_name() + ".getDataFromLink() initial forecast flow end at " + (GridSim.clock() + duration)); - - // if flow is just an ACK of a finished flow do not hold, no action required - } else if (pkt.getTag() == GridSimTags.FLOW_RETURN){ - //duration = 0.0; - return; - // send the data into entity input/output port - // super.sim_schedule(inPort_, duration, tag, - // io.getData() ); + return; } + // convert the packets into IO_data + Object data = np.getData(); + IO_data io = new IO_data( data, np.getSize(), + inPort_.get_dest() ); + // send the data into entity input port super.sim_schedule(inPort_, GridSimTags.SCHEDULE_NOW, tag, io.getData() ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |