From: <sul...@us...> - 2008-09-29 10:32:03
|
Revision: 250 http://gridsim.svn.sourceforge.net/gridsim/?rev=250&view=rev Author: sulistio Date: 2008-09-29 10:31:58 +0000 (Mon, 29 Sep 2008) Log Message: ----------- update documentation and minor changes. Modified Paths: -------------- 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/FnbNetPacket.java trunk/source/gridsim/net/fnb/FnbOutput.java trunk/source/gridsim/net/fnb/FnbSCFQScheduler.java trunk/source/gridsim/net/fnb/RED.java Modified: trunk/source/gridsim/net/fnb/ARED.java =================================================================== --- trunk/source/gridsim/net/fnb/ARED.java 2008-09-29 10:30:45 UTC (rev 249) +++ trunk/source/gridsim/net/fnb/ARED.java 2008-09-29 10:31:58 UTC (rev 250) @@ -103,12 +103,14 @@ /** Update the stats file of this scheduler. */ + /**** public void updateStats() { 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-29 10:30:45 UTC (rev 249) +++ trunk/source/gridsim/net/fnb/FIFO.java 2008-09-29 10:31:58 UTC (rev 250) @@ -354,12 +354,15 @@ return AVG; } - /** Update the stats file of this scheduler. + /** Update the statistics of this scheduler to a file. <br> + * The file name is schedulerName_Buffers.csv.<br> + * The format is "Clock, MAX_P, MIN_TH, MAX_TH, AVG, QUEUE_SIZE". <br> + * Note that for the FIFO, MAX_P, MIN_TH, and MAX_TH values are empty. */ public void updateStats() { - fw_write(GridSim.clock() + ", , , , " + AVG + ", " + this.size() + "\n", - this.getSchedName() + "_Buffers.csv"); + fw_write(GridSim.clock() + ", , , , " + AVG + ", " + super.size() + "\n", + super.getSchedName() + "_Buffers.csv"); } } Modified: trunk/source/gridsim/net/fnb/FnbDroppedPacketInfo.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbDroppedPacketInfo.java 2008-09-29 10:30:45 UTC (rev 249) +++ trunk/source/gridsim/net/fnb/FnbDroppedPacketInfo.java 2008-09-29 10:31:58 UTC (rev 250) @@ -12,64 +12,44 @@ package gridsim.net.fnb; -// fixme - TODO check whether can be used for dropping replicas or datasets -/**This class is used by routers when they inform users of the dropping of a packet. - * 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.2 - */ +/** + * This class is used by a router to inform users of a dropped Gridlet. + * More specifically, the router tells users on which particular gridlet + * has been dropped in the network. + * @author Agustin Caminero + * @since GridSim Toolkit 4.2 + */ public class FnbDroppedPacketInfo { - private int glID; // TODO try to be more general, not just gridlet + private int glID; + private int userID_; - private int userID; - - // private String fileName; - - - - /**Creates a new object of this class. This is used by FnbSCFQScheduler - * @param g the gridlet id - * @param u user id - * */ - public FnbDroppedPacketInfo(int g, int u) + /** + * Creates a new object of this class. + * @param gridletID gridlet id + * @param userID user id + */ + public FnbDroppedPacketInfo(int gridletID, int userID) { - glID = g; - userID = u; + glID = gridletID; + userID_ = userID; } - /** Sets the filename. - * */ - /*public void setFilename(String f) - { - fileName = f; - }*/ - - /** Gets the filename. - * @return the gridlet id. - * */ - /*public String getFilename() - { - return fileName; - }*/ - /** Gets the gridlet id. * @return the gridlet id. * */ - public int getGlID() + public int getGridletID() { return glID; } - /** Gets the user id. * @return the user id. - * */ + */ public int getUserID() { - return userID; + return userID_; } } Modified: trunk/source/gridsim/net/fnb/FnbDroppedUserPacket.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbDroppedUserPacket.java 2008-09-29 10:30:45 UTC (rev 249) +++ trunk/source/gridsim/net/fnb/FnbDroppedUserPacket.java 2008-09-29 10:31:58 UTC (rev 250) @@ -15,44 +15,38 @@ import gridsim.net.*; /** - * This class is for the routers to tell users when one of their packets is dropped. + * This class is used by a router to inform users of a dropped packet. * @author Agustin Caminero, Universidad de Castilla La Mancha (Spain). * @since GridSim Toolkit 4.2 */ public class FnbDroppedUserPacket implements Packet { - int userID; - int pktID; + private int userID; + private int pktID; - /**Create an object of this class. + /** + * Create an object of this class. * @param userID the user id - * @param pktID the packet id */ + * @param pktID the packet id + */ public FnbDroppedUserPacket(int userID, int pktID) { - this.userID= userID; - this.pktID= pktID; + this.userID = userID; + this.pktID = pktID; } - - /** Gets the user id - * @return user id */ - public int getUser() + /** + * Gets the user id + * @return user id + */ + public int getUserID() { return userID; } - - /** Gets the packet id - * @return packet id */ - public int getPkt() - { - return pktID; - } - - /** - * Gets this packet tag - * @return this packet tag + * Gets this packet tag. + * @return -1 since no packet tag has been stored in this class. * @pre $none * @post $none */ @@ -62,19 +56,20 @@ } /** - * Sets an entity ID from the last hop that this packet has traversed. + * Sets an entity ID from the last hop that this packet has traversed.<br> + * Note that this method is not used. * @param last an entity ID from the last hop * @pre last > 0 * @post $none */ public void setLast(int last) { - + // empty or not used } /** * Gets an entity ID from the last hop that this packet has traversed. - * @return an entity ID + * @return -1 since no entity ID has been stored in this class. * @pre $none * @post $none */ @@ -83,24 +78,21 @@ return -1; } - /** - * Sets the network service type of this packet. - * <p> - * By default, the service type is 0 (zero). It is depends on the packet - * scheduler to determine the priority of this service level. + * Sets the network service type of this packet.<br> + * Note that this method is not used. * @param serviceType this packet's service type * @pre serviceType >= 0 * @post $none */ public void setNetServiceType(int serviceType) { - + // not used } /** * Gets the network service type of this packet - * @return the network service type + * @return -1 since no network service type has been stored in this class. * @pre $none * @post $none */ @@ -109,10 +101,9 @@ return -1; } - /** * Returns the ID of the source of this packet. - * @return source id + * @return -1 since no source ID has been stored in this class. * @pre $none * @post $none */ @@ -121,7 +112,6 @@ return -1; } - /** * Returns the ID of this packet * @return packet ID @@ -133,10 +123,9 @@ return pktID; } - /** * Returns the destination id of this packet. - * @return destination id + * @return -1 since no destination ID has been stored in this class. * @pre $none * @post $none */ @@ -146,9 +135,10 @@ } /** - * Sets the size of this packet + * Sets the size of this packet. <br> + * Note that this method is not used. * @param size size of the packet - * @return <tt>true</tt> if it is successful, <tt>false</tt> otherwise + * @return <tt>false</tt> since this method is not used. * @pre size >= 0 * @post $none */ Modified: trunk/source/gridsim/net/fnb/FnbEndToEndPath.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbEndToEndPath.java 2008-09-29 10:30:45 UTC (rev 249) +++ trunk/source/gridsim/net/fnb/FnbEndToEndPath.java 2008-09-29 10:31:58 UTC (rev 250) @@ -13,16 +13,16 @@ package gridsim.net.fnb; /** - * This class keeps some information which are common to all the packets of a gridlet. + * This class keeps information which are common to all network packets. * When a packet is dropped in a router, the router must inform the user/owner - * about this scenario. - * Since many packets from the same gridlet may get dropped, the router only sends - * one event for the whole process, not for each dropped packet. + * about this case. + * Since many packets from the same gridlet may be dropped, the router only + * sends one event for the whole process, not for each packet. * Thus, we put all of the common information (e.g. source and destination IDs) * into this class. * * @since GridSim Toolkit 4.2 - * @author Agustin Caminero + * @author Agustin Caminero, Universidad de Castilla-La Mancha (UCLM) (Spain) */ public class FnbEndToEndPath { @@ -30,120 +30,80 @@ private int srcID; private int classtype; private int totalPkts; // total num of packet that belongs to a group + + // the id of the gridlet/file this packet belongs to, or + // GridSimTags.FNB_PKT_CONTAINS_FILE if the pkt contains a file private int glID; - // the id of the gridlet/file this packet belongs to, or GridSimTags.FNB_PKT_CONTAINS_FILE - // if the pkt contains a file + - /*private String fileName; // the name of the file contained in this pkt. - //We have to use the file name since files may not have a id, if they've not been registered yet.*/ - - //private int fileMyID;// This is a temporary id for the file. This is necesary as files dont have - // id unteil they are registered. - - - /**Creates a new object of this class. Tihs is used in the FnbOutput class. + /**Creates a new object of this class. Tihs is used by + * the {@link gridsim.net.fnb.FnbOutput} class. * @param destID destination id * @param srcID source id - * @param classtype network service level + * @param classType network service level * @param totalPkts total number of packets this connection is made of * @param glID the gridlet/file id * */ - public FnbEndToEndPath(int destID, int srcID, int classtype, int totalPkts, + public FnbEndToEndPath(int destID, int srcID, int classType, int totalPkts, int glID) { this.destID = destID; this.srcID = srcID; - this.classtype = classtype; + this.classtype = classType; this.totalPkts = totalPkts; this.glID = glID; - //this.fileName = null; - //this.fileMyID = -1; } - /**Creates a new object of this class. Tihs is used in the FnbOutput class. + /**Creates a new object of this class. This is used by + * the {@link gridsim.net.fnb.FnbOutput} class. * @param destID destination id * @param srcID source id - * @param classtype network service level + * @param classType network service level * @param totalPkts total number of packets this connection is made of * */ - public FnbEndToEndPath(int destID, int srcID, int classtype, int totalPkts) + public FnbEndToEndPath(int destID, int srcID, int classType, int totalPkts) { this.destID = destID; this.srcID = srcID; - this.classtype = classtype; + this.classtype = classType; this.totalPkts = totalPkts; this.glID = -1; - //this.fileName = null; - //this.fileMyID = -1; } - /** Sets the fileName for a connection, in the case it carries a file. - * @param d the destination id - * */ - /*public void setFileName(String f) - { - fileName = f; - }*/ - - /** Returns the fileName for a connection, in the case it carries a file. - * @param d the destination id - * */ - /*public String getFileName() - { - return fileName; - }*/ - - /** Sets the file my_id. - * @param d the destination id - * */ - /*public void setFileMyID(int d) - { - fileMyID = d; - }*/ - - /** Returns the file my_id. - * @param d the destination id - * */ - /*public int getFileMyID() - { - return fileMyID; - }*/ - - /** Sets the destination id for a connection. - * @param d the destination id + * @param id the destination id * */ - public void setDest(int d) + public void setDest(int id) { - destID = d; + destID = id; } /** Sets the source id for a connection. - * @param s the source id + * @param sourceID the source id * */ - public void setSrc(int s) + public void setSrc(int sourceID) { - srcID = s; + srcID = sourceID; } /** Sets the network service level (or classtype) for a connection. - * @param c the network service level id + * @param classType the network service level id * */ - public void setClasstype(int c) + public void setClasstype(int classType) { - classtype = c; + classtype = classType; } /** Sets the total packets for a connection. - * @param t total packets + * @param total total packets * */ - public void setTotalPkts(int t) + public void setTotalPkts(int total) { - totalPkts = t; + totalPkts = total; } /** Gets the source id of a connection. @@ -183,11 +143,11 @@ /** Sets the gridlet/file id of a connection. - * @param g the gridlet id of the connection + * @param id the gridlet id of the connection * */ - public void setObjectID(int g) + public void setObjectID(int id) { - glID = g; + glID = id; } Modified: trunk/source/gridsim/net/fnb/FnbNetPacket.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbNetPacket.java 2008-09-29 10:30:45 UTC (rev 249) +++ trunk/source/gridsim/net/fnb/FnbNetPacket.java 2008-09-29 10:31:58 UTC (rev 250) @@ -16,19 +16,18 @@ import gridsim.net.*; /** - * Structure of a packet used to encapsulate data passing through the network, - * for the finite network buffers. + * This class contains the structure of a packet + * for the purpose of finite network buffers. + * <p> + * In order to minimise duplications, hence, to reduce memory consumption, + * common attributes to all packets have been stored in the + * {@link gridsim.net.fnb.FnbEndToEndPath} class. + * The common attributes are destination ID, source ID, class type and total + * number of packets. * - * In order to reduce the memory consumption, I moved some stuff which is common to all the packets - * of a transmission to another class, called FnbEndToEndPath. - * The stuff I moved is destID, srcID, classtype and totalPkts. - * I also added a FnbEndToEndPath object, which is common for all the packets of a connection - * (of the same gridlet). - * - * - * @invariant $none + * @see gridsim.net.fnb.FnbEndToEndPath * @since GridSim Toolkit 4.2 - * @author Agustin Caminero + * @author Agustin Caminero, Universidad de Castilla-La Mancha (UCLM) (Spain) */ public class FnbNetPacket implements Packet { @@ -44,7 +43,6 @@ private String desc_; // description of this packet private int pktNum; // packet num in one group private int pktID_; // a unique packet ID issued by an entity - private FnbEndToEndPath conn; /** @@ -65,18 +63,16 @@ this.obj = data ; this.size = size ; this.tag = tag ; - this.last = srcID ; this.pktID_ = pktID; - this.pktNum = 1; - this.desc_ = null; + this.conn = null; } /** * This is used to construct a packet that is one in a series. This happens - * when a large piece of data is required to be brokwn down into smaller + * when a large piece of data is required to be broken down into smaller * chunks so that they can traverse of links that only support a certain * MTU. It also allows setting of a classtype so that network schedulers * maybe provide differntial service to it. @@ -156,7 +152,7 @@ /** * Returns the source ID of this packet. The source ID is where the - * NetPacket was originally created. + * packet was originally created. * * @return the source id. * @pre $none @@ -177,7 +173,7 @@ } /** - * Modifies the data encapsulated in this NetPacket. + * Modifies the data encapsulated in this packet. * @param data the packet's data * @pre $none * @post $none @@ -318,19 +314,20 @@ } /** Establishes the end to end path to another entity - * @param c new FnbEndToEndPath */ - public void setPath(FnbEndToEndPath c) + * @param connection an end-to-end connection path + */ + public void setPath(FnbEndToEndPath connection) { - conn = c; + conn = connection; } /**Returns the gridlet/file to which this packet belongs - * @return the gridlet/file to which this packet belongs*/ + * @return the gridlet/file to which this packet belongs + */ public int getObjectID() { return conn.getObjectID(); } - } // end class Modified: trunk/source/gridsim/net/fnb/FnbOutput.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbOutput.java 2008-09-29 10:30:45 UTC (rev 249) +++ trunk/source/gridsim/net/fnb/FnbOutput.java 2008-09-29 10:31:58 UTC (rev 250) @@ -8,6 +8,12 @@ * Organization: Universidad de Castilla La Mancha (UCLM), Spain. * Copyright (c) 2008, The University of Melbourne, Australia and * Universidad de Castilla La Mancha (UCLM), Spain + * + * Based on Output class, by Manzur Murshed and Rajkumar Buyya + * Things added or modifyed: + * -submitToLink (...) + * - packetsGridletsList_, getPacketsGridletsList(...) + * - processPacketDropped(...), PACKET_DROPPED. */ package gridsim.net.fnb; @@ -33,12 +39,7 @@ * 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: - * -submitToLink (...) - * - packetsGridletsList_, getPacketsGridletsList(...) - * - processPacketDropped(...), PACKET_DROPPED. + * @author Agustin Caminero, Universidad de Castilla-La Mancha (UCLM) (Spain) */ public class FnbOutput extends Sim_entity implements NetIO { @@ -356,8 +357,8 @@ public void processPacketDropped(Sim_event ev) { FnbDroppedUserPacket userPkt = (FnbDroppedUserPacket) ev.get_data(); - int pkt_dropped_id = userPkt.getPkt(); - int user_id = userPkt.getUser(); + int pkt_dropped_id = userPkt.getID(); + int user_id = userPkt.getUserID(); FnbMessage msgDrop = lookForEntity(pkt_dropped_id); Modified: trunk/source/gridsim/net/fnb/FnbSCFQScheduler.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbSCFQScheduler.java 2008-09-29 10:30:45 UTC (rev 249) +++ trunk/source/gridsim/net/fnb/FnbSCFQScheduler.java 2008-09-29 10:31:58 UTC (rev 250) @@ -9,6 +9,25 @@ * Author: Gokul Poduval & Chen-Khong Tham * Copyright (c) 2008, The University of Melbourne, Australia and * Universidad de Castilla La Mancha (UCLM), Spain + * + * Based on SCFQScheduler class, by Gokul Poduval & Chen-Khong Tham, + * National University of Singapore. + * Things added or modifyed: + * - init(...) + * - enque() + * - MIN, INTERVAL, nextInterval + * - MAX_BUFF_SIZE_PK + * - extends GridSim + * - insertPacketIntoQueue(...), checkAndInsertPacketIntoQueue(...) + * - enque(...) does not insert packet into the queue, now this function only + * checks if we have enough room for a new packet. + * - deque() + * - makeRoomForPacket(...) + * - FIFO, RED, DROPPING_ALG, setDroppingAlg(...), getDroppingAlg() + * - Everything regarding RED dropping algorithm + * - DROPPED_PKTS_COUNTER + * - getMaxBufferSize() + * - setMaxBufferSize() */ package gridsim.net.fnb; @@ -48,25 +67,7 @@ * * @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. - * Things added or modifyed: - * - init(...) - * - enque() - * - MIN, INTERVAL, nextInterval - * - MAX_BUFF_SIZE_PK - * - extends GridSim - * - insertPacketIntoQueue(...), checkAndInsertPacketIntoQueue(...) - * - enque(...) does not insert packet into the queue, now this function only - * checks if we have enough room for a new packet. - * - deque() - * - makeRoomForPacket(...) - * - FIFO, RED, DROPPING_ALG, setDroppingAlg(...), getDroppingAlg() - * - Everything regarding RED dropping algorithm - * - DROPPED_PKTS_COUNTER - * - getMaxBufferSize() - * - setMaxBufferSize() + * @author Agustin Caminero, Universidad de Castilla-La Mancha (UCLM) (Spain) */ public abstract class FnbSCFQScheduler extends GridSim implements PacketScheduler { @@ -94,7 +95,7 @@ public double MAX_AVG = 0.0; - + /** * Creates a new SCFQ packet scheduler with the specified name and baud rate * (in bits/s). The name can be useful for debugging purposes, but serves @@ -933,7 +934,7 @@ while (i < droppedGl_user.size()) { glID_uID = (FnbDroppedPacketInfo) droppedGl_user.get(i); - if ((glID_uID.getGlID() == gl) && (glID_uID.getUserID() == user)) + if ((glID_uID.getGridletID() == gl) && (glID_uID.getUserID() == user)) return true; else @@ -941,5 +942,9 @@ } return false; } + + /** Update the statistics of this scheduler to a file. + */ + public abstract void updateStats(); + } // end class - Modified: trunk/source/gridsim/net/fnb/RED.java =================================================================== --- trunk/source/gridsim/net/fnb/RED.java 2008-09-29 10:30:45 UTC (rev 249) +++ trunk/source/gridsim/net/fnb/RED.java 2008-09-29 10:31:58 UTC (rev 250) @@ -555,13 +555,15 @@ return true; } - /** Update the stats file of this scheduler. + /** Update the statistics of this scheduler to a file. <br> + * The file name is schedulerName_Buffers.csv.<br> + * The format is "Clock, MAX_P, MIN_TH, MAX_TH, AVG, QUEUE_SIZE" */ public void updateStats() { fw_write(GridSim.clock() + ", " + MAX_P + ", " + MIN_TH + ", " + - MAX_TH + ", " + AVG + ", " + this.size() + "\n", - this.getSchedName() + "_Buffers.csv"); + MAX_TH + ", " + AVG + ", " + super.size() + "\n", + super.getSchedName() + "_Buffers.csv"); } /** Returns the avg buffer size This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |