From: <bro...@us...> - 2008-03-14 01:14:32
|
Revision: 159 http://gridsim.svn.sourceforge.net/gridsim/?rev=159&view=rev Author: brobergj Date: 2008-03-13 18:06:34 -0700 (Thu, 13 Mar 2008) Log Message: ----------- Bug fixes Modified Paths: -------------- branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowLink.java branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowOutput.java branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowPacket.java branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowRouter.java Modified: branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowLink.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowLink.java 2008-03-14 01:05:46 UTC (rev 158) +++ branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowLink.java 2008-03-14 01:06:34 UTC (rev 159) @@ -131,13 +131,8 @@ return; } - System.out.println(super.get_name() + ".attach(): " + end1.get_name() + - " " + end2.get_name()); - inEnd1_ = GridSim.getEntityId( "Output_" + end1.get_name() ); + inEnd1_ = GridSim.getEntityId( "Input_" + end1.get_name() ); outEnd1_ = GridSim.getEntityId( "Output_" + end1.get_name() ); - - System.out.println(super.get_name() + ".attach(): " + end1.get_id() + " " + end2.get_id()); - // if end1 is a router/gateway with no Input and Output port if (inEnd1_ == -1 || outEnd1_ == -1) @@ -146,10 +141,10 @@ outEnd1_ = end1.get_id(); } - inEnd2_ = GridSim.getEntityId( "Output_" + end2.get_name() ); + inEnd2_ = GridSim.getEntityId( "Input_" + end2.get_name() ); outEnd2_ = GridSim.getEntityId( "Output_" + end2.get_name() ); - // if end2 is a router/gateway with no Input and Output port + // if end1 is a router/gateway with no Input and Output port if (inEnd2_ == -1 || outEnd2_ == -1) { inEnd2_ = end2.get_id(); @@ -181,7 +176,7 @@ return; } - inEnd1_ = GridSim.getEntityId("Output_" + end1); + inEnd1_ = GridSim.getEntityId("Input_" + end1); outEnd1_ = GridSim.getEntityId("Output_" + end1); // if end1 is a router/gateway with no Input and Output port @@ -191,7 +186,7 @@ outEnd1_ = inEnd1_; } - inEnd2_ = GridSim.getEntityId("Output_" + end2); + inEnd2_ = GridSim.getEntityId("Input_" + end2); outEnd2_ = GridSim.getEntityId("Output_" + end2); // if end1 is a router/gateway with no Input and Output port @@ -218,6 +213,9 @@ while ( Sim_system.running() ) { super.sim_get_next(ev); + + 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()); // if the simulation finishes then exit the loop if (ev.get_tag() == GridSimTags.END_OF_SIMULATION) { @@ -335,15 +333,20 @@ private synchronized void enque(Sim_event ev) { System.out.println(super.get_name() + " enque() + at time = " + GridSim.clock()); + int tag = ((Packet)ev.get_data()).getTag(); + // Register passing flow as active on this link + if (tag == GridSimTags.FLOW_SUBMIT || tag == GridSimTags.GRIDLET_SUBMIT || + tag == GridSimTags.GRIDLET_SUBMIT_ACK || tag == GridSimTags.GRIDLET_RETURN || + tag == GridSimTags.JUNK_PKT) { + registerFlow((Packet)ev.get_data()); + } + q_.add( ev.get_data() ); if (q_.size() == 1) { sendInternalEvent(super.delay_ / super.MILLI_SEC); // delay in ms } - // Register passing flow as active on this link - if (((Packet)ev.get_data()).getTag() == GridSimTags.FLOW_SUBMIT) { - registerFlow((Packet)ev.get_data()); - } + } /** @@ -354,8 +357,14 @@ */ private synchronized void deque(Packet np) { + + System.out.println(super.get_name() + ".deque() for packet " + np.getID() +" here"); + System.out.println(super.get_name() + ".deque() packet " + np.toString()); + + int dest = getNextHop(np); if (dest == -1) { + System.out.println(super.get_name() + ".deque() here3"); return; } @@ -363,6 +372,8 @@ int tag = 0; if (dest == outEnd2_ || dest == outEnd1_) { + System.out.println(super.get_name() + ".deque() here1"); + // for junk packets only if (np.getTag() == GridSimTags.JUNK_PKT) { tag = GridSimTags.JUNK_PKT; @@ -374,15 +385,17 @@ } // other side is a GridSim entity else { + System.out.println(super.get_name() + ".deque() here2"); + tag = np.getTag(); } - if (np.getTag() == GridSimTags.FLOW_RETURN) { - System.out.println(super.get_name() + ".deque() Dereg flow # " + np.getID() +" here"); + //if (np.getTag() == GridSimTags.FLOW_RETURN) { + // System.out.println(super.get_name() + ".deque() Dereg flow # " + np.getID() +" here"); // Deregister passing flow as it is now de-active on this link - ((FlowPacket)np).addLatency(this.getDelay()); - deregisterFlow(np); - } + // ((FlowPacket)np).addLatency(this.getDelay()); + // deregisterFlow(np); + //} // sends the packet super.sim_schedule(dest, GridSimTags.SCHEDULE_NOW, tag, np); @@ -447,7 +460,7 @@ // I can notify directly as I know the destId's!!!! System.out.println(super.get_name() + ".registerFlow(): updating flow #" + tempFlow.getID() + " destination " + tempFlow.getDestID()); - super.sim_schedule(GridSim.getEntityId("Output_" + + super.sim_schedule(GridSim.getEntityId("Input_" + GridSim.getEntityName(tempFlow.getDestID())), GridSimTags.SCHEDULE_NOW, GridSimTags.FLOW_UPDATE, new Integer(tempFlow.getID())); } @@ -460,7 +473,7 @@ * @pre $none * @post $none */ - private synchronized void deregisterFlow(Packet np) { + public synchronized void deregisterFlow(Packet np) { FlowPacket fp = null; FlowPacket tempFlow; @@ -483,7 +496,7 @@ // I can notify directly as I know the destId's!!!! System.out.println(super.get_name() + ".deregisterFlow(): updating flow #" + tempFlow.getID() + " destination " + tempFlow.getDestID()); - super.sim_schedule(GridSim.getEntityId("Output_" + + super.sim_schedule(GridSim.getEntityId("Input_" + GridSim.getEntityName(tempFlow.getDestID())), GridSimTags.SCHEDULE_NOW, GridSimTags.FLOW_UPDATE, new Integer(tempFlow.getID())); } Modified: branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowOutput.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowOutput.java 2008-03-14 01:05:46 UTC (rev 158) +++ branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowOutput.java 2008-03-14 01:06:34 UTC (rev 159) @@ -249,7 +249,7 @@ int shutdownID = GridSim.getGridSimShutdownEntityId(); // start generating some junk packets or background traffic - // startBackgroundTraffic(); + startBackgroundTraffic(); // Process incoming events while ( Sim_system.running() ) @@ -288,10 +288,10 @@ break; // activate background traffic - case GridSimTags.FLOW_ACK: - System.out.println((FlowPacket) ev.get_data()); - enque((FlowPacket) ev.get_data(),GridSimTags.SCHEDULE_NOW); - break; + //case GridSimTags.FLOW_ACK: + // System.out.println((FlowPacket) ev.get_data()); + // enque((FlowPacket) ev.get_data(),GridSimTags.SCHEDULE_NOW); + // break; default: defaultSend(ev, gisID, statID, shutdownID); @@ -544,10 +544,10 @@ tag = GridSimTags.EMPTY_PKT; } - np = new FlowPacket(null, pktID_, size, tag, super.get_id(), destId, + np = new FlowPacket(null, rnd.nextInt(10000000), size, tag, super.get_id(), destId, netServiceType, i+1, numPackets); - pktID_++; // increments packet ID + //pktID_++; // increments packet ID enque(np, GridSimTags.SCHEDULE_NOW); } } Modified: branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowPacket.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowPacket.java 2008-03-14 01:05:46 UTC (rev 158) +++ branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowPacket.java 2008-03-14 01:06:34 UTC (rev 159) @@ -177,8 +177,8 @@ sb.append("GridSimTags.JUNK_PKT"); } else if (tag == GridSimTags.FLOW_SUBMIT) { sb.append("GridSimTags.FLOW_SUBMIT"); - } else if (tag == GridSimTags.FLOW_RETURN) { - sb.append("GridSimTags.FLOW_RETURN"); +// } else if (tag == GridSimTags.FLOW_RETURN) { +// sb.append("GridSimTags.FLOW_RETURN"); } else { sb.append(tag); } Modified: branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowRouter.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowRouter.java 2008-03-14 01:05:46 UTC (rev 158) +++ branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowRouter.java 2008-03-14 01:06:34 UTC (rev 159) @@ -279,7 +279,9 @@ protected synchronized void processEvent(Sim_event ev) { - System.out.println("Event was scheduled for " + ev.event_time()); + System.out.println(super.get_name() + ".processEvent(): Event was scheduled for " + ev.event_time()); + System.out.println(super.get_name() + ".processEvent(): ev.get_tag() is " + ev.get_tag()); + System.out.println(super.get_name() + ".processEvent(): ev.get_src() is " + ev.get_src()); switch ( ev.get_tag() ) { @@ -611,7 +613,7 @@ GridSimTags.SCHEDULE_NOW, GridSimTags.ROUTER_AD, ad); } - //super.sim_pause(1); // wait for 5 secs to gather the results + super.sim_pause(2); // wait for 5 secs to gather the results } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |