From: <sul...@us...> - 2008-09-21 11:46:40
|
Revision: 243 http://gridsim.svn.sourceforge.net/gridsim/?rev=243&view=rev Author: sulistio Date: 2008-09-21 11:46:26 +0000 (Sun, 21 Sep 2008) Log Message: ----------- fix some javadoc issues Modified Paths: -------------- trunk/source/gridsim/GridSim.java trunk/source/gridsim/GridSimCore.java trunk/source/gridsim/datagrid/File.java trunk/source/gridsim/datagrid/FileAttribute.java trunk/source/gridsim/net/fnb/ARED.java trunk/source/gridsim/net/fnb/FIFO.java trunk/source/gridsim/net/fnb/FnbDroppedPacketInfo.java trunk/source/gridsim/net/fnb/FnbDroppedUserPacket.java trunk/source/gridsim/net/fnb/FnbEndToEndPath.java trunk/source/gridsim/net/fnb/FnbInput.java trunk/source/gridsim/net/fnb/FnbMessage.java trunk/source/gridsim/net/fnb/FnbMessageDropFile.java trunk/source/gridsim/net/fnb/FnbMessageDropGridlet.java trunk/source/gridsim/net/fnb/FnbNetworkReader.java trunk/source/gridsim/net/fnb/FnbOutput.java trunk/source/gridsim/net/fnb/FnbRIPRouter.java trunk/source/gridsim/net/fnb/FnbRouter.java trunk/source/gridsim/net/fnb/FnbSCFQScheduler.java trunk/source/gridsim/net/fnb/FnbWhiteList.java trunk/source/gridsim/net/fnb/Fnb_FileName_FileMyID.java trunk/source/gridsim/net/fnb/RED.java trunk/source/gridsim/net/fnb/source_pktNum.java Modified: trunk/source/gridsim/GridSim.java =================================================================== --- trunk/source/gridsim/GridSim.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/GridSim.java 2008-09-21 11:46:26 UTC (rev 243) @@ -2512,16 +2512,16 @@ /** * Initializes the {@link gridsim.GridSimCore#NETWORK_TYPE} to be used in * the simulation. By default, the {@link gridsim.GridSimCore#NETWORK_TYPE} - * is set to {@link gridsim.GridSimTags.NET_PACKET_LEVEL}. + * is set to {@link gridsim.GridSimTags#NET_PACKET_LEVEL}. * * @param networkType network type * @return <tt>true</tt> if the network type has been initialized successfully * or <tt>false</tt> otherwise. * * @see gridsim.GridSimCore#NETWORK_TYPE - * @see gridsim.GridSimTags.NET_PACKET_LEVEL - * @see gridsim.GridSimTags.NET_FLOW_LEVEL - * @see gridsim.GridSimTags.NET_BUFFER_PACKET_LEVEL + * @see gridsim.GridSimTags#NET_PACKET_LEVEL + * @see gridsim.GridSimTags#NET_FLOW_LEVEL + * @see gridsim.GridSimTags#NET_BUFFER_PACKET_LEVEL */ public static boolean initNetworkType(int networkType) { @@ -2552,9 +2552,9 @@ /** Returns the network type used in this simulation. * @return the network type * @see gridsim.GridSimCore#NETWORK_TYPE - * @see gridsim.GridSimTags.NET_PACKET_LEVEL - * @see gridsim.GridSimTags.NET_FLOW_LEVEL - * @see gridsim.GridSimTags.NET_BUFFER_PACKET_LEVEL + * @see gridsim.GridSimTags#NET_PACKET_LEVEL + * @see gridsim.GridSimTags#NET_FLOW_LEVEL + * @see gridsim.GridSimTags#NET_BUFFER_PACKET_LEVEL */ public static int getNetworkType() { return GridSimCore.NETWORK_TYPE; Modified: trunk/source/gridsim/GridSimCore.java =================================================================== --- trunk/source/gridsim/GridSimCore.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/GridSimCore.java 2008-09-21 11:46:26 UTC (rev 243) @@ -14,7 +14,7 @@ import gridsim.util.*; import java.util.Collection; import gridsim.net.flow.*; -//import gridsim.net.fnb.*; +import gridsim.net.fnb.*; /** * Since GridSim version 3.0, this is the overall class of GridSim package, @@ -197,9 +197,9 @@ * {@link gridsim.GridSim#initNetworkType(int)} method <b>before</b> the * simulation starts. * @see gridsim.GridSim#initNetworkType(int) - * @see gridsim.GridSimTags.NET_PACKET_LEVEL - * @see gridsim.GridSimTags.NET_FLOW_LEVEL - * @see gridsim.GridSimTags.NET_BUFFER_PACKET_LEVEL + * @see gridsim.GridSimTags#NET_PACKET_LEVEL + * @see gridsim.GridSimTags#NET_FLOW_LEVEL + * @see gridsim.GridSimTags#NET_BUFFER_PACKET_LEVEL */ protected static int NETWORK_TYPE = GridSimTags.NET_PACKET_LEVEL; @@ -337,9 +337,9 @@ } // Use Finite network buffer else if (GridSimCore.NETWORK_TYPE == GridSimTags.NET_BUFFER_PACKET_LEVEL) - { // TODO: - //in = new FnbInput("Input_" + name, baudRate); - //out_ = new FnbOutput("Output_" + name, baudRate); + { + in = new FnbInput("Input_" + name, baudRate); + out_ = new FnbOutput("Output_" + name, baudRate); } Sim_system.link_ports(name, "input", "Input_" + name, "input_buffer"); Modified: trunk/source/gridsim/datagrid/File.java =================================================================== --- trunk/source/gridsim/datagrid/File.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/datagrid/File.java 2008-09-21 11:46:26 UTC (rev 243) @@ -180,7 +180,6 @@ /** * Sets the file name * @param name the file name - * @return <tt>true</tt> if successful, <tt>false</tt> otherwise */ public void setName(String name) { attr_.setName(name); Modified: trunk/source/gridsim/datagrid/FileAttribute.java =================================================================== --- trunk/source/gridsim/datagrid/FileAttribute.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/datagrid/FileAttribute.java 2008-09-21 11:46:26 UTC (rev 243) @@ -390,7 +390,6 @@ /** * Sets the file name * @param name the file name - * @return <tt>true</tt> if successful, <tt>false</tt> otherwise */ public void setName(String name) { this.name_ = name; Modified: trunk/source/gridsim/net/fnb/ARED.java =================================================================== --- trunk/source/gridsim/net/fnb/ARED.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/ARED.java 2008-09-21 11:46:26 UTC (rev 243) @@ -105,9 +105,9 @@ */ public void updateStats() { - fw_write(GridSim.clock() + "\t" + getMaxP() + "\t" + getMinTh() + "\t" + - getMaxTh() + "\t" + getAvg() + "\t" + this.size() + "\n", - this.getSchedName() + "_Buffers"); + fw_write(GridSim.clock() + ", " + getMaxP() + ", " + getMinTh() + ", " + + getMaxTh() + ", " + getAvg() + ", " + this.size() + "\n", + this.getSchedName() + "_Buffers.csv"); } Modified: trunk/source/gridsim/net/fnb/FIFO.java =================================================================== --- trunk/source/gridsim/net/fnb/FIFO.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/FIFO.java 2008-09-21 11:46:26 UTC (rev 243) @@ -358,8 +358,8 @@ */ public void updateStats() { - fw_write(GridSim.clock() + "\t\t\t\t" + AVG + "\t" + this.size() + "\n", - this.getSchedName() + "_Buffers"); + fw_write(GridSim.clock() + ", , , , " + AVG + ", " + this.size() + "\n", + this.getSchedName() + "_Buffers.csv"); } } Modified: trunk/source/gridsim/net/fnb/FnbDroppedPacketInfo.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbDroppedPacketInfo.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/FnbDroppedPacketInfo.java 2008-09-21 11:46:26 UTC (rev 243) @@ -18,7 +18,7 @@ * Thus, routers tell users which gridlet got the dropped packet. This is done * to minimize the network overhead caused by this informations. * @author Agustin Caminero - * @since GridSim Toolkit 4.1 + * @since GridSim Toolkit 4.2 */ public class FnbDroppedPacketInfo { Modified: trunk/source/gridsim/net/fnb/FnbDroppedUserPacket.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbDroppedUserPacket.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/FnbDroppedUserPacket.java 2008-09-21 11:46:26 UTC (rev 243) @@ -17,8 +17,8 @@ /** * This class is for the routers to tell users when one of their packets is dropped. * @author Agustin Caminero, Universidad de Castilla La Mancha (Spain). - * @since GridSim Toolkit 4.1 - * */ + * @since GridSim Toolkit 4.2 + */ public class FnbDroppedUserPacket implements Packet { int userID; Modified: trunk/source/gridsim/net/fnb/FnbEndToEndPath.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbEndToEndPath.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/FnbEndToEndPath.java 2008-09-21 11:46:26 UTC (rev 243) @@ -21,7 +21,7 @@ * Thus, we put all of the common information (e.g. source and destination IDs) * into this class. * - * @since GridSim Toolkit 4.1 + * @since GridSim Toolkit 4.2 * @author Agustin Caminero */ public class FnbEndToEndPath Modified: trunk/source/gridsim/net/fnb/FnbInput.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbInput.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/FnbInput.java 2008-09-21 11:46:26 UTC (rev 243) @@ -34,7 +34,7 @@ * * @author Agustin Caminero, Universidad de Castilla La Mancha (Spain). * Based on Input class, by Manzur Murshed and Rajkumar Buyya. - * @since GridSim Toolkit 4.1 + * @since GridSim Toolkit 4.2 * * Things added or modifyed: * - getDataFromLink(...) @@ -130,34 +130,34 @@ } /** - * This is an empty method and only applicable to - * {@link gridsim.net.Output} class. - * @param gen a background traffic generator - * @param userName a collection of user entity name (in String object). - * @return <tt>false</tt> since this method is not used by this class. - * @pre gen != null - * @pre userName != null - * @post $none - * @see gridsim.net.Output - */ - public boolean setBackgroundTraffic(TrafficGenerator gen, - Collection userName) - { - return false; - } + * This is an empty method and only applicable to + * {@link gridsim.net.Output} class. + * @param gen a background traffic generator + * @param userName a collection of user entity name (in String object). + * @return <tt>false</tt> since this method is not used by this class. + * @pre gen != null + * @pre userName != null + * @post $none + * @see gridsim.net.Output + */ + public boolean setBackgroundTraffic(TrafficGenerator gen, + Collection userName) + { + return false; + } - /** - * This is an empty method and only applicable to - * {@link gridsim.net.Output} class. - * @param gen a background traffic generator - * @return <tt>false</tt> since this method is not used by this class. - * @pre gen != null - * @post $none - * @see gridsim.net.Output - */ - public boolean setBackgroundTraffic(TrafficGenerator gen) - { - return false; + /** + * This is an empty method and only applicable to + * {@link gridsim.net.Output} class. + * @param gen a background traffic generator + * @return <tt>false</tt> since this method is not used by this class. + * @pre gen != null + * @post $none + * @see gridsim.net.Output + */ + public boolean setBackgroundTraffic(TrafficGenerator gen) + { + return false; } /** @@ -482,42 +482,42 @@ /** - * Prints out the given message into stdout. - * In addition, writes it into a file. - * @param msg a message - * @param file file where we want to write - */ - private static void fw_write(String msg, String file) + * Prints out the given message into stdout. + * In addition, writes it into a file. + * @param msg a message + * @param file file where we want to write + */ + private static void fw_write(String msg, String file) + { + //System.out.print(msg); + FileWriter fwriter = null; + + try { - //System.out.print(msg); - FileWriter fwriter = null; + fwriter = new FileWriter(file, true); + } catch (Exception ex) + { + ex.printStackTrace(); + System.out.println("Unwanted errors while opening file " + file); + } - try - { - fwriter = new FileWriter(file, true); - } catch (Exception ex) - { - ex.printStackTrace(); - System.out.println("Unwanted errors while opening file " + file); - } + try + { + fwriter.write(msg); + } catch (Exception ex) + { + ex.printStackTrace(); + System.out.println("Unwanted errors while writing on file " + file); + } - try - { - fwriter.write(msg); - } catch (Exception ex) - { - ex.printStackTrace(); - System.out.println("Unwanted errors while writing on file " + file); - } - - try - { - fwriter.close(); - } catch (Exception ex) - { - ex.printStackTrace(); - System.out.println("Unwanted errors while closing file " + file); - } + try + { + fwriter.close(); + } catch (Exception ex) + { + ex.printStackTrace(); + System.out.println("Unwanted errors while closing file " + file); + } } Modified: trunk/source/gridsim/net/fnb/FnbMessage.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbMessage.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/FnbMessage.java 2008-09-21 11:46:26 UTC (rev 243) @@ -12,6 +12,11 @@ package gridsim.net.fnb; +/** + * + * @author Agustin Caminero + * @since GridSim Toolkit 4.2 + */ public interface FnbMessage { public void setEntityID(int i); Modified: trunk/source/gridsim/net/fnb/FnbMessageDropFile.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbMessageDropFile.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/FnbMessageDropFile.java 2008-09-21 11:46:26 UTC (rev 243) @@ -14,6 +14,11 @@ import gridsim.net.fnb.*; +/** + * + * @author Agustin Caminero + * @since GridSim Toolkit 4.2 + */ public class FnbMessageDropFile implements FnbMessage { int fileID; Modified: trunk/source/gridsim/net/fnb/FnbMessageDropGridlet.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbMessageDropGridlet.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/FnbMessageDropGridlet.java 2008-09-21 11:46:26 UTC (rev 243) @@ -14,6 +14,11 @@ import gridsim.net.fnb.*; +/** + * + * @author Agustin Caminero + * @since GridSim Toolkit 4.2 + */ public class FnbMessageDropGridlet implements FnbMessage { int gridletID; Modified: trunk/source/gridsim/net/fnb/FnbNetworkReader.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbNetworkReader.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/FnbNetworkReader.java 2008-09-21 11:46:26 UTC (rev 243) @@ -47,6 +47,7 @@ * - createNetworkSCFQ(...) * - Use finiteBufferSCFQScheduler instead of SCFQScheduler * + * @since GridSim Toolkit 4.2 * @author Agustin Caminero, Universidad de Castilla La Mancha (Spain). * Based on NetworkReader class, by Uros Cibej and Anthony Sulistio. */ @@ -67,7 +68,7 @@ * @param stats whether we want to store stats or not * @return the list of finiteBufferRouters of the network or <tt>null</tt> if an error * occurs - * @see gridsim.net.finiteBufferSCFQScheduler + * @see gridsim.net.fnb.FnbSCFQScheduler */ public static LinkedList createSCFQ(String filename, double[] weight, int max_buf_size, int drop_alg, @@ -139,10 +140,11 @@ * Creates a number of routers from a given buffered reader * @param buf a Buffered Reader object * @param rate a flag denotes the type of FnbRouter will be using + * @param stats true if we want to store statistics * @return a list of FnbRouter objects or <tt>null</tt> if an error occurs */ private static LinkedList createRouter(BufferedReader buf, - boolean rate) throws Exception + boolean rate, boolean stats) throws Exception { String line = null; StringTokenizer str = null; @@ -218,7 +220,7 @@ } else { - router = new FnbRIPRouter(name, log, my_id); + router = new FnbRIPRouter(name, log, my_id, stats); } routerList.add(router); // add the router into the list } @@ -231,11 +233,13 @@ * @param buf a Buffered Reader object * @param weight a linear array of the weights to be assigned to * different classes of traffic. + * @param max_buf_size the maximum size for network buffers * @param drop_alg the algorithm used to drop packets at routers * @param min_th minimum threshold for RED * @param max_th maximum threshold for RED * @param max_p maximum drop probability for RED * @param queue_weight queue weight for RED + * @param stats true if we want to store statistics * @return a list of FnbRouter objects or <tt>null</tt> if an error occurs */ private static LinkedList createNetworkSCFQ(BufferedReader buf, @@ -251,7 +255,7 @@ } // create the FnbRouter objects first - LinkedList routerList = createRouter(buf, false); + LinkedList routerList = createRouter(buf, false, stats); int GB = 1000000000; // 1 GB in bits String line; @@ -354,4 +358,3 @@ } // end class - Modified: trunk/source/gridsim/net/fnb/FnbOutput.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbOutput.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/FnbOutput.java 2008-09-21 11:46:26 UTC (rev 243) @@ -32,6 +32,7 @@ * communication delay. Simultaneous outputs can be modeled by using multiple * instances of this class * + * @since GridSim Toolkit 4.2 * @author Agustin Caminero, Universidad de Castilla La Mancha (Spain). * Based on Output class, by Manzur Murshed and Rajkumar Buyya * Things added or modifyed: @@ -90,7 +91,7 @@ filesname_fileMyIDs_ = new ArrayList(); - System.out.println(super.get_name()); + //System.out.println(super.get_name()); } /** @@ -1034,10 +1035,12 @@ else msgDrop = new FnbMessageDropGridlet(flPktGl.getGridletID()); + /***** System.out.println(super.get_name() + ": lookForEntity: entiyID: " + flPktGl.getGridletID() + ". isFile " + flPktGl.getIsFile() + ". filename " + getFilename(msgDrop.getEntityID())); - + *****/ + return msgDrop; } } Modified: trunk/source/gridsim/net/fnb/FnbRIPRouter.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbRIPRouter.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/FnbRIPRouter.java 2008-09-21 11:46:26 UTC (rev 243) @@ -33,6 +33,7 @@ * reliable protocol to use. * * @invariant $none + * @since GridSim Toolkit 4.2 * @author Agustin Caminero, University of Castilla La Mancha, Spain. * Based on class RIPRouter, by Gokul Poduval & Chen-Khong Tham, * National University of Singapore. @@ -75,19 +76,18 @@ /** * Creates a new RIPRouter object. By default, <b>no recording or logging</b> * is done for packets' activities. If you want to log operations of this - * entity, please use {@link #FnbRIPRouter(String, boolean)}. + * entity, please use {@link #FnbRIPRouter(String, boolean, int)}. * * @param name Name of this router * @param my_id the my_id of this router. For a router named "router0", its my_id will be 0 * @throws NullPointerException This happens when name is empty or null - * @see #FnbRIPRouter(String, boolean) + * @see #FnbRIPRouter(String, boolean, int) * @pre name != null * @post $none */ public FnbRIPRouter(String name, int my_id) throws NullPointerException { this(name, false, my_id); - storeStats = false; } /** @@ -116,13 +116,13 @@ /** * Creates a new RIPRouter object. By default, <b>no recording or logging</b> * is done for packets' activities. If you want to log operations of this - * entity, please use {@link #FnbRIPRouter(String, boolean)}. + * entity, please use {@link #FnbRIPRouter(String, boolean, int)}. * * @param name Name of this router * @param my_id for a router named "Router0", its my_id will be 0 - * @param stats true if we want to recor statistics + * @param stats true if we want to record statistics * @throws NullPointerException This happens when name is empty or null - * @see #FnbRIPRouter(String, boolean) + * @see #FnbRIPRouter(String, boolean, int) * @pre name != null * @post $none */ @@ -465,8 +465,8 @@ // keep stats from all the routers droppedPktsCounter = sched.getCounterDroppedPkts(); - fw_write(GridSim.clock() + "\t" + droppedPktsCounter + "\n", - sched.getSchedName() + "_DroppedPkts"); + fw_write(GridSim.clock() + ", " + droppedPktsCounter + "\n", + sched.getSchedName() + "_DroppedPkts.csv"); sched.resetCounterDroppedPkts(); @@ -958,4 +958,3 @@ } // end class - Modified: trunk/source/gridsim/net/fnb/FnbRouter.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbRouter.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/FnbRouter.java 2008-09-21 11:46:26 UTC (rev 243) @@ -51,6 +51,7 @@ * </ul> * * @invariant $none + * @since GridSim Toolkit 4.2 * @author Agustin Caminero, University of Castilla La Mancha, Spain. * Based on class Router, by Gokul Poduval & Chen-Khong Tham, * National University of Singapore. @@ -316,9 +317,9 @@ * <p> * The services or tags available for this resource are: * <ul> - * <li> {@link gridsim.my_GridSimTags#PKT_FORWARD} - * <li> {@link gridsim.my_GridSimTags#JUNK_PKT} - * <li> {@link gridsim.my_GridSimTags#ROUTER_AD} + * <li> {@link gridsim.GridSimTags#PKT_FORWARD} + * <li> {@link gridsim.GridSimTags#JUNK_PKT} + * <li> {@link gridsim.GridSimTags#ROUTER_AD} * </ul> * * @param ev a Sim_event object Modified: trunk/source/gridsim/net/fnb/FnbSCFQScheduler.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbSCFQScheduler.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/FnbSCFQScheduler.java 2008-09-21 11:46:26 UTC (rev 243) @@ -47,6 +47,7 @@ * judging from their respective weights. * * @invariant $none + * @since GridSim Toolkit 4.2 * @author Agustin Caminero, Universidad de Castilla La Mancha (Spain). * Based on SCFQScheduler class, by Gokul Poduval & Chen-Khong Tham, * National University of Singapore. @@ -303,14 +304,14 @@ if (storeStats) { - fw_write("Interval\tBufferSize\tAvgBufferSize\tMaxBufferSize\n", - getSchedName() + "_MaxBufferSize"); + fw_write("Interval, BufferSize, AvgBufferSize, MaxBufferSize\n", + getSchedName() + "_MaxBufferSize.csv", false); - fw_write("Interval\tDroppedPackets\n", - this.getSchedName() + "_DroppedPkts"); + fw_write("Interval, DroppedPackets\n", + this.getSchedName() + "_DroppedPkts.csv", false); - fw_write("Clock\t\t\tMAX_P\tMIN_TH\tMAX_TH\tAVG\tQUEUE_SIZE\n", - this.getSchedName() + "_Buffers"); + fw_write("Clock, MAX_P, MIN_TH, MAX_TH, AVG, QUEUE_SIZE\n", + this.getSchedName() + "_Buffers.csv", false); } @@ -443,10 +444,9 @@ { maxBufferSize = bufferSize; - fw_write(GridSim.clock() + "\t" + bufferSize + "\t" + getAvg() + "\t" + - maxBufferSize + "\n", - this.getSchedName() + "_MaxBufferSize"); - + fw_write(GridSim.clock() + ", " + bufferSize + ", " + + getAvg() + ", " + maxBufferSize + "\n", + this.getSchedName() + "_MaxBufferSize.csv"); } } @@ -638,14 +638,26 @@ * @param msg a message * @param file file where we want to write */ - private static void fw_write(String msg, String file) + private void fw_write(String msg, String file) { + fw_write(msg, file, true); + } + + /** + * Prints out the given message into stdout. + * In addition, writes it into a file. + * @param msg a message + * @param file file where we want to write + * @param append append the message at the end of the file or not + */ + private void fw_write(String msg, String file, boolean append) + { //System.out.print(msg); FileWriter fwriter = null; try { - fwriter = new FileWriter(file, true); + fwriter = new FileWriter(file, append); } catch (Exception ex) { ex.printStackTrace(); @@ -760,24 +772,25 @@ super.send(src_outputPort, GridSimTags.SCHEDULE_NOW, GridSimTags.FNB_PACKET_DROPPED, new FnbDroppedUserPacket(entity, pktID)); - /*System.out.println("\n" + super.get_name() + - ":(make) A packet has been dropped, and an ACK has been sent.\n" + - " src.output: " + src_outputPort_str + - ". dst: " + dst_str + - "\n Time: " + - GridSim.clock() + ". PktID: " + pkt.getID() +". Gl: " + glID);*/ + /****** + System.out.println("\n" + super.get_name() + + ":(make) A packet has been dropped, and an ACK has been sent.\n" + + " src.output: " + src_outputPort_str + + ". dst: " + dst_str + "\n Time: " + + GridSim.clock() + ". PktID: " + pkt.getID() +". Gl: " + glID); + ******/ } else { - /*System.out.println("\n" + super.get_name() + - ":(make) A packet has been dropped.\n" + - " src.output: " + src_outputPort_str + - ". dst: " + dst_str + - "\n Time: " + - GridSim.clock() + ". PktID: " + pkt.getID() + - ". Gl: " + - glID);*/ + /***** + System.out.println("\n" + super.get_name() + + ":(make) A packet has been dropped.\n" + + " src.output: " + src_outputPort_str + + ". dst: " + dst_str + + "\n Time: " + GridSim.clock() + ". PktID: " + pkt.getID() + + ". Gl: " + glID); + *****/ } @@ -870,8 +883,8 @@ if ((ev.get_tag() == GridSimTags.END_OF_SIMULATION) || (ev.get_tag() == GridSimTags.COUNT_DROPPED_PKTS)) { - fw_write(GridSim.clock() + "\t" + DROPPED_PKTS_COUNTER + "\n", - this.getSchedName() + "_DroppedPkts"); + fw_write(GridSim.clock() + ", " + DROPPED_PKTS_COUNTER + "\n", + this.getSchedName() + "_DroppedPkts.csv"); DROPPED_PKTS_COUNTER = 0; // System.out.println(super.get_name() + ": max_avg: " + MAX_AVG); Modified: trunk/source/gridsim/net/fnb/FnbWhiteList.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbWhiteList.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/FnbWhiteList.java 2008-09-21 11:46:26 UTC (rev 243) @@ -15,7 +15,11 @@ import java.util.*; import gridsim.*; - +/** + * + * @author Agustin Caminero + * @since GridSim Toolkit 4.2 + */ public class FnbWhiteList { private ArrayList list_; Modified: trunk/source/gridsim/net/fnb/Fnb_FileName_FileMyID.java =================================================================== --- trunk/source/gridsim/net/fnb/Fnb_FileName_FileMyID.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/Fnb_FileName_FileMyID.java 2008-09-21 11:46:26 UTC (rev 243) @@ -12,6 +12,11 @@ package gridsim.net.fnb; +/** + * + * @author Agustin Caminero + * @since GridSim Toolkit 4.2 + */ public class Fnb_FileName_FileMyID { // Since files don't have an id until they are registered, we need an id for them. Modified: trunk/source/gridsim/net/fnb/RED.java =================================================================== --- trunk/source/gridsim/net/fnb/RED.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/RED.java 2008-09-21 11:46:26 UTC (rev 243) @@ -36,7 +36,7 @@ * Buffer Management Policies in Networks for Grids" </i> * * @author Agustin Caminero - * @since GridSim Toolkit 4.1 + * @since GridSim Toolkit 4.2 * */ public class RED extends FnbSCFQScheduler { @@ -274,8 +274,8 @@ "\n HENCE, SIMULATION FINISHED AT SIM. TIME " + GridSim.clock()); - fw_write("MaxBufferSizeDuringSim\t" + getMaxBufferSize() + "\n", - this.get_name() + "_MaxBufferSize"); + fw_write("MaxBufferSizeDuringSim, " + getMaxBufferSize() + "\n", + this.get_name() + "_MaxBufferSize.csv"); System.exit(1); // super.shutdownUserEntity(); @@ -287,9 +287,9 @@ // If u want more info on the progress of sims, uncomment this. - System.out.println(super.get_name() + ": packet dropped. Src: " + + /*System.out.println(super.get_name() + ": packet dropped. Src: " + src_outputPort_str + ", Dst: " + dst_str + - ". Pkt num: " + ((FnbNetPacket) pnp).getPacketNum()); + ". Pkt num: " + ((FnbNetPacket) pnp).getPacketNum());*/ // If the packet is not a control packet, we will have to remove the packet, and // also, we will have to tell the user involved in the transmission about the dropping. @@ -381,20 +381,20 @@ FnbDroppedPacketInfo gu = new FnbDroppedPacketInfo(glID, entity); insertGlID_userID(gu); + /**************** System.out.println("\n" + super.get_name() + - ": A packet has been dropped, and an ACK has been sent.\n" + - " src.output: " + src_outputPort_str + - ". dst_inputPort: " + dst_str + - "\n Time: " + - GridSim.clock() + ". PktID: " + pnp.getID() + - ". Gl: " + glID + - ". destination_packetsDroppedEvent: " + - destination_packetsDroppedEvent); - - + ": A packet has been dropped, and an ACK has been sent.\n" + + " src.output: " + src_outputPort_str + + ", dst_inputPort: " + dst_str + + "\n Time: " + + GridSim.clock() + ". PktID: " + pnp.getID() + + ". Gl: " + glID + + ". destination_packetsDroppedEvent: " + + destination_packetsDroppedEvent); + ***********/ } - else{ + /*else{ System.out.println("\n" + super.get_name() + ": A packet has been dropped.\n" + " src.output: " + src_outputPort_str + @@ -404,7 +404,7 @@ glID + ". destination_packetsDroppedEvent: " + destination_packetsDroppedEvent); - } + }*/ pnp = null; // remove the packet. } @@ -559,9 +559,9 @@ */ public void updateStats() { - fw_write(GridSim.clock() + "\t" + MAX_P + "\t" + MIN_TH + "\t" + - MAX_TH + "\t" + AVG + "\t" + this.size() + "\n", - this.getSchedName() + "_Buffers"); + fw_write(GridSim.clock() + ", " + MAX_P + ", " + MIN_TH + ", " + + MAX_TH + ", " + AVG + ", " + this.size() + "\n", + this.getSchedName() + "_Buffers.csv"); } /** Returns the avg buffer size @@ -627,4 +627,3 @@ } - Modified: trunk/source/gridsim/net/fnb/source_pktNum.java =================================================================== --- trunk/source/gridsim/net/fnb/source_pktNum.java 2008-09-09 08:14:06 UTC (rev 242) +++ trunk/source/gridsim/net/fnb/source_pktNum.java 2008-09-21 11:46:26 UTC (rev 243) @@ -15,7 +15,7 @@ /**This class is used in the FnbInput class, to make sure that * all the packets of a gridlet arrive at the user/resource. * @author Agustin Caminero - * @since GridSim Toolkit 4.1 + * @since GridSim Toolkit 4.2 */ public class source_pktNum This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |