You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(24) |
Sep
(14) |
Oct
(13) |
Nov
(5) |
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(2) |
Feb
(53) |
Mar
(29) |
Apr
(5) |
May
(11) |
Jun
(3) |
Jul
(7) |
Aug
(48) |
Sep
(10) |
Oct
(8) |
Nov
(1) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
(5) |
Oct
(2) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sul...@us...> - 2008-10-11 03:26:30
|
Revision: 253 http://gridsim.svn.sourceforge.net/gridsim/?rev=253&view=rev Author: sulistio Date: 2008-10-11 03:26:18 +0000 (Sat, 11 Oct 2008) Log Message: ----------- My work: clean up the code and add javadoc comments. Agustin work: rename FnbDroppedUserPacket to FnbDroppedUserObject, and fix bugs in the fnb algorithms. Modified Paths: -------------- trunk/source/gridsim/net/fnb/ARED.java trunk/source/gridsim/net/fnb/FIFO.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/FnbRIPRouter.java trunk/source/gridsim/net/fnb/FnbSCFQScheduler.java trunk/source/gridsim/net/fnb/RED.java Removed Paths: ------------- trunk/source/gridsim/net/fnb/FnbDroppedUserPacket.java Modified: trunk/source/gridsim/net/fnb/ARED.java =================================================================== --- trunk/source/gridsim/net/fnb/ARED.java 2008-10-11 03:22:27 UTC (rev 252) +++ trunk/source/gridsim/net/fnb/ARED.java 2008-10-11 03:26:18 UTC (rev 253) @@ -17,7 +17,7 @@ import gridsim.net.Link; /** - * This class implements the Adaptative Random Early Detection policy for + * This class implements the Adaptative Random Early Detection (ARED) policy for * the management of network buffers at routers. * Its basic functionality is as follows: * <ul> @@ -29,8 +29,8 @@ * user involved in the transmission about the dropping. * </ul> * - * For more details refer to A. Caminero, A. Sulistio, B. Caminero, C. Carrion, - * and R. Buyya, + * For more details, please refer to A. Caminero, A. Sulistio, B. Caminero, + * C. Carrion, and R. Buyya, * <a href="http://www.gridbus.org/papers/BufferManagementNetGrids-ANSS41.pdf"> * Simulation of Buffer Management Policies in Networks for Grids</a>, * Proceedings of the 41th Annual Simulation Symposium (ANSS-41, IEEE CS Press, @@ -63,7 +63,7 @@ * @param max_buf_size maximum buffer size for routers * @param queue_weight this parameter reflects how important is the last * measurement of the buffer size on the calculation of the average buffer size - * @param stats whether we want to store stats or not + * @param stats whether we want to record some stats or not * @throws Exception This happens when the baud rate <= 0 * @pre baudRate > 0 * @post $none @@ -76,9 +76,9 @@ } /** - * This function updates the value of max_p, which is the maximum dropping - * probability for a packet. - * It also updates ALPHA, as it depends on max_p. + * This function updates the value of <tt>max_p</tt>, which is the maximum + * dropping probability for a packet. + * It also updates <tt>ALPHA</tt>, as it depends on <tt>max_p</tt>. */ public void updateAREDParameters() { @@ -101,21 +101,8 @@ } - /** 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"); - } - ****/ - - /** - * This methods sets some parameters for the RED and ARED algorithms, - * such as the thresholds. + * Sets the this class and {@link gridsim.net.fnb.RED} thresholds. */ public void setThresholds() { @@ -126,12 +113,10 @@ double term = -1 / C; double term2 = Math.exp(term); + super.setQueueWeight(1 - term2); - setQueueWeight(1 - term2); - double DELAY_TARGET = 0.005; // 5 milliseconds double var = DELAY_TARGET * C / 2; - if (5 > var) { minTh = 5; @@ -142,17 +127,15 @@ } - setMinTh(minTh); - setMaxTh(3 * minTh); - + super.setMinTh(minTh); + super.setMaxTh(3 * minTh); } /**This function initializes the parameters of the buffers policies - * */ - public void initialize() + */ + protected void initialize() { super.initialize(); - setThresholds(); if ((getMaxP() / 4) < 0.01) @@ -161,7 +144,6 @@ ALPHA = 0.01; BETA = 0.9; - } @@ -174,13 +156,11 @@ */ public boolean setBaudRate(double rate) { - if (rate <= 0.0) { return false; } super.setBaudRateSCFQ(rate); - initialize(); return true; Modified: trunk/source/gridsim/net/fnb/FIFO.java =================================================================== --- trunk/source/gridsim/net/fnb/FIFO.java 2008-10-11 03:22:27 UTC (rev 252) +++ trunk/source/gridsim/net/fnb/FIFO.java 2008-10-11 03:26:18 UTC (rev 253) @@ -33,8 +33,8 @@ * user involved in the transmission about the dropping. * </ul> * - * For more details refer to A. Caminero, A. Sulistio, B. Caminero, C. Carrion, - * and R. Buyya, + * For more details, please refer to A. Caminero, A. Sulistio, B. Caminero, + * C. Carrion, and R. Buyya, * <a href="http://www.gridbus.org/papers/BufferManagementNetGrids-ANSS41.pdf"> * Simulation of Buffer Management Policies in Networks for Grids</a>, * Proceedings of the 41th Annual Simulation Symposium (ANSS-41, IEEE CS Press, @@ -45,19 +45,16 @@ * */ public class FIFO extends FnbSCFQScheduler { - private double QUEUE_WEIGHT; // the queue weigth private double AVG; private double Q_TIME; private double S; + private double MAX_AVG = 0.0; - /** */ - public double MAX_AVG = 0.0; - /** * Creates a new FIFO policy with the specified name and baud rate - * (in bits/s). The name can be useful for debugging purposes, but serves + * (in bits/sec). The name can be useful for debugging purposes, but serves * no functional purposes. * * @param name Name of this scheduler @@ -81,12 +78,12 @@ if (name == null) { - throw new ParameterException("RED(): Name is null."); + throw new ParameterException("fnb.FIFO(): Name is null."); } if (baudRate <= 0) { - throw new ParameterException("RED(): Baudrate <= 0."); + throw new ParameterException("fnb.FIFO(): Baudrate <= 0."); } initialize(); @@ -125,7 +122,7 @@ * @pre pnp != null * @post $none */ - public synchronized boolean checkAndInsertPacketIntoQueue(Packet pnp) + private synchronized boolean checkAndInsertPacketIntoQueue(Packet pnp) { if (size() < getMaxBufferSizeInPkts()) @@ -140,17 +137,15 @@ } } - /** If the queue is full, we have to drop a packet. - * If the packet to get dropped is a control packet, the sim will stop. - * Control packets will be those packets sent between the broker or the gis. - * Normal packets are those belonging to a gridlet. - * We are using the FIFO algorithm. + /** If the queue is full, we have to drop a packet. Note that packets going + * to/coming from entities that are listed in + * the {@link gridsim.GridSim#fnbWhiteList_} will not be dropped. * @param pnp the new incoming packet - * */ - public synchronized void dropPacketFIFO(Packet pnp) + */ + private synchronized void dropPacketFIFO(Packet pnp) { // If the queue is full, we have to drop a packet, giving priority to the control packets - // Control packets will be those packets sent between the broker or the gis. + // Control packets will be those packets sent between the broker or the GIS. // Normal packets are those belonging to a gridlet. // Control packets can only be dropped when the wue is full of control packets @@ -160,8 +155,10 @@ // Check the source of the packet int src_outputPort = ((FnbNetPacket) pnp).getSrcID(); - String src_outputPort_str = GridSim.getEntityName( - src_outputPort); + + boolean isFile = ((FnbNetPacket) pnp).isFile(); + + String src_outputPort_str = GridSim.getEntityName(src_outputPort); // for example, src_outputPort_str = Output_SIM_0_User_0 // Check the destination, as I'm not sure if it works like that @@ -174,10 +171,11 @@ { - /* - // This was the very first version of the Fnbs - insertPacketIntoQueue(pnp); - return true;*/ + /*********** + // This was the very first version of the Fnbs + insertPacketIntoQueue(pnp); + return true; + ***********/ if (makeRoomForPacket()) { @@ -186,27 +184,27 @@ } else { - // The control packet has to be dropped. - System.out.println("\n" + super.get_name() + - ": buffer full, and a control packet has been dropped.\n" + - " src.output: " + src_outputPort_str + - ". dst_inputPort: " + dst_inputPort_str + - "\n HENCE, SIMULATION FINISHED"); + ": 271 A control packet has been dropped.\n" + + "src_output: " + src_outputPort_str + + ". dst_inputPort: " + dst_inputPort_str + + "\nHENCE, SIMULATION FINISHED AT SIM. TIME " + GridSim.clock()); + //fw_write("MaxBufferSizeDuringSim, " + getMaxBufferSize() + "\n", + // this.get_name() + "_MaxBufferSize.csv"); + System.exit(1); // super.shutdownUserEntity(); // super.terminateIOEntities(); - - } } - /* - // If u want more info on the progress of sims, uncomment this. - System.out.println(super.get_name() + ": packet dropped. Src: " + - src_outputPort_str + ", Dst: " + dst_str + - ". Pkt num: " + ((FnbNetPacket) pnp).getPacketNum());*/ + // If u want more info on the progress of sims, uncomment this. + /******************** + System.out.println(super.get_name() + ": packet dropped. Src: " + + src_outputPort_str + ", Dst: " + dst_inputPort_str + + ". Pkt num: " + ((FnbNetPacket) pnp).getPacketNum()); + ********************/ // In this case, we will have to remove the packet, and // also, we will have to tell the source of the packet what has happened. @@ -226,14 +224,11 @@ // for example, src_str = SIM_0_User_0 entity = GridSim.getEntityId(src_str); - } else { // If the destination of the packet is the user, tell the user - entity = GridSim.getEntityId(dst_inputPort_str); - } int pktID = ((FnbNetPacket) pnp).getID(); @@ -242,20 +237,33 @@ // for example, input_src_str = Input_SIM_0_User_0 // int input_src = GridSim.getEntityId(input_src_str); - super.send(src_outputPort, GridSimTags.SCHEDULE_NOW, + int glID; + if (pnp instanceof InfoPacket) + { + glID = 99999; + } + else + { + // check the user and the gl this packet belongs to + glID = ((FnbNetPacket) pnp).getObjectID(); + //filename = ((FnbNetPacket) pnp).getFileName(); + } + + //super.send(src_outputPort, GridSimTags.SCHEDULE_NOW, + super.sim_schedule(src_outputPort, GridSimTags.SCHEDULE_NOW, GridSimTags.FNB_PACKET_DROPPED, - new FnbDroppedUserPacket(entity, pktID)); + new FnbDroppedUserObject(entity, glID, isFile)); // We tell the output entity of the sender of this packet // that the packet has been dropped. pnp = null; // remove the packet. - } /** Calculate the avg queue size for the FIFO algorithm. * - * @return the average queue size of this queue, which has been calculated in this function*/ + * @return the average queue size of this queue, + * which has been calculated in this function*/ public double avgQueueSize() { @@ -279,6 +287,12 @@ } // avgQueueSize() + /**This function initializes the parameters of FIFO policy + */ + protected void initialize() + { + // empty + } /** * Prints out the given message into stdout. @@ -319,15 +333,6 @@ } } - /**This function initializes the parameters of the buffers policies (RED, ARED) - * */ - public void initialize() - { - // empty - - - } - /** * Sets the baud rate that this scheduler will be sending packets at. * @param rate the baud rate of this scheduler (in bits/s) @@ -343,7 +348,6 @@ return false; } super.setBaudRateSCFQ(rate); - return true; } Deleted: trunk/source/gridsim/net/fnb/FnbDroppedUserPacket.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbDroppedUserPacket.java 2008-10-11 03:22:27 UTC (rev 252) +++ trunk/source/gridsim/net/fnb/FnbDroppedUserPacket.java 2008-10-11 03:26:18 UTC (rev 253) @@ -1,160 +0,0 @@ -/* - * Title: GridSim Toolkit - * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation - * of Parallel and Distributed Systems such as Clusters and Grids - * Licence: GPL - http://www.gnu.org/copyleft/gpl.html - * - * Author: Agustin Caminero - * Organization: Universidad de Castilla La Mancha (UCLM), Spain. - * Copyright (c) 2008, The University of Melbourne, Australia and - * Universidad de Castilla La Mancha (UCLM), Spain - */ - -package gridsim.net.fnb; - -import gridsim.net.*; - -/** - * 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 -{ - private int userID; - private int pktID; - - /** - * Create an object of this class. - * @param userID the user id - * @param pktID the packet id - */ - public FnbDroppedUserPacket(int userID, int pktID) - { - this.userID = userID; - this.pktID = pktID; - } - - /** - * Gets the user id - * @return user id - */ - public int getUserID() - { - return userID; - } - - /** - * Gets this packet tag. - * @return -1 since no packet tag has been stored in this class. - * @pre $none - * @post $none - */ - public int getTag() - { - return -1; - } - - /** - * 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 -1 since no entity ID has been stored in this class. - * @pre $none - * @post $none - */ - public int getLast() - { - return -1; - } - - /** - * 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 -1 since no network service type has been stored in this class. - * @pre $none - * @post $none - */ - public int getNetServiceType() - { - return -1; - } - - /** - * Returns the ID of the source of this packet. - * @return -1 since no source ID has been stored in this class. - * @pre $none - * @post $none - */ - public int getSrcID() - { - return -1; - } - - /** - * Returns the ID of this packet - * @return packet ID - * @pre $none - * @post $none - */ - public int getID() - { - return pktID; - } - - /** - * Returns the destination id of this packet. - * @return -1 since no destination ID has been stored in this class. - * @pre $none - * @post $none - */ - public int getDestID() - { - return -1; - } - - /** - * Sets the size of this packet. <br> - * Note that this method is not used. - * @param size size of the packet - * @return <tt>false</tt> since this method is not used. - * @pre size >= 0 - * @post $none - */ - public boolean setSize(long size) - { - return false; - } - - /** - * Returns the size of this packet - * @return size of the packet - * @pre $none - * @post $none - */ - public long getSize() - { - return -1; - } -} Modified: trunk/source/gridsim/net/fnb/FnbEndToEndPath.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbEndToEndPath.java 2008-10-11 03:22:27 UTC (rev 252) +++ trunk/source/gridsim/net/fnb/FnbEndToEndPath.java 2008-10-11 03:26:18 UTC (rev 253) @@ -16,7 +16,7 @@ * 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 case. - * Since many packets from the same gridlet may be dropped, the router only + * 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. @@ -30,32 +30,49 @@ 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 + private boolean isFile; // true if this is a file, false otherwise + + // 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; - - /**Creates a new object of this class. Tihs is used by + + /**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 destID destination id + * @param srcID source id * @param classType network service level * @param totalPkts total number of packets this connection is made of - * @param glID the gridlet/file id + * @param glID the gridlet/file id * */ public FnbEndToEndPath(int destID, int srcID, int classType, int totalPkts, int glID) { + this(destID, srcID, classType, totalPkts, glID, false); + } + + /**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 totalPkts total number of packets this connection is made of + * @param glID the gridlet/file id + * @param isFile <tt>true</tt> if it contains a file, <tt>false</tt> otherwise + * */ + public FnbEndToEndPath(int destID, int srcID, int classType, int totalPkts, + int glID, boolean isFile) + { this.destID = destID; this.srcID = srcID; this.classtype = classType; this.totalPkts = totalPkts; this.glID = glID; + this.isFile = isFile; } - /**Creates a new object of this class. This is used by + /**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 @@ -64,11 +81,7 @@ * */ public FnbEndToEndPath(int destID, int srcID, int classType, int totalPkts) { - this.destID = destID; - this.srcID = srcID; - this.classtype = classType; - this.totalPkts = totalPkts; - this.glID = -1; + this(destID, srcID, classType, totalPkts, -1, false); } /** Sets the destination id for a connection. @@ -106,6 +119,15 @@ totalPkts = total; } + + /** Checks whether this packet contains a file or not + * @return <tt>true</tt> if this is a file, <tt>false</tt> otherwise + */ + public boolean isFile() + { + return isFile; + } + /** Gets the source id of a connection. * @return the source id of the connection * */ Modified: trunk/source/gridsim/net/fnb/FnbNetPacket.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbNetPacket.java 2008-10-11 03:22:27 UTC (rev 252) +++ trunk/source/gridsim/net/fnb/FnbNetPacket.java 2008-10-11 03:26:18 UTC (rev 253) @@ -16,11 +16,11 @@ import gridsim.net.*; /** - * This class contains the structure of a packet + * 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 + * 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. @@ -314,7 +314,7 @@ } /** Establishes the end to end path to another entity - * @param connection an end-to-end connection path + * @param connection an end-to-end connection path */ public void setPath(FnbEndToEndPath connection) { @@ -329,5 +329,14 @@ return conn.getObjectID(); } + /** Checks whether this packet contains a file or not + * @return <tt>true</tt> if this is a file, <tt>false</tt> otherwise + */ + public boolean isFile() + { + return conn.isFile(); + } + } // end class + Modified: trunk/source/gridsim/net/fnb/FnbOutput.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbOutput.java 2008-10-11 03:22:27 UTC (rev 252) +++ trunk/source/gridsim/net/fnb/FnbOutput.java 2008-10-11 03:26:18 UTC (rev 253) @@ -56,14 +56,14 @@ private boolean hasStarted_; // a flag for background traffic has started private static final int BITS = 8; // 1 byte = 8 bits - private ArrayList packetsGridletsList_; // list of firstLastPacketsGridlet objects + // private ArrayList packetsGridletsList_; // list of firstLastPacketsGridlet objects // This list contains the first/last packets belonging to each gridlet private ArrayList filesname_fileMyIDs_; // keep a list of FileName_FileMyID objects - + ////////////////////////// INTERNAL CLASS ///////////////////////// - + private class FileName_FileMyID { // Since files don't have an id until they are registered, we need an id for them. @@ -88,11 +88,11 @@ return fileMyID; } } - - + + ////////////////////////// INTERNAL CLASS ///////////////////////// - - + + /** * Allocates a new Output object * @param name the name of this object @@ -121,7 +121,7 @@ list_ = null; random_ = null; hasStarted_ = false; - packetsGridletsList_ = new ArrayList(); + // packetsGridletsList_ = new ArrayList(); filesname_fileMyIDs_ = new ArrayList(); @@ -319,6 +319,7 @@ break; default: + //System.out.println("346: "+super.get_name()+": tag: "+ev.get_tag()); defaultSend(ev, gisID, statID, shutdownID); break; } @@ -332,40 +333,47 @@ * */ private void processPacketDropped(Sim_event ev) { - FnbDroppedUserPacket userPkt = (FnbDroppedUserPacket) ev.get_data(); - int pkt_dropped_id = userPkt.getID(); + FnbDroppedUserObject userPkt = (FnbDroppedUserObject) ev.get_data(); + + // the id of object (gridlet/file) to which the dropped pkt belonged + int object_dropped_id = userPkt.getID(); int user_id = userPkt.getUserID(); - FnbMessage msgDrop = lookForEntity(pkt_dropped_id); + boolean isFile = userPkt.getIsFile(); + FnbMessage msgDrop; + //FnbMessage msgDrop = lookForEntity(gl_dropped_id); + + if (isFile) + { + // Tell the user that the file is failed because of the dropping of a packet + msgDrop = new FnbMessageDropFile(object_dropped_id, getFilename(object_dropped_id)); - int glID; - if (msgDrop != null) + /**************** + System.out.println(super.get_name() + + ": Sending FNB_FILE_FAILED_BECAUSE_PACKET_DROPPED to " + + GridSim.getEntityName(user_id) + ". File: " + object_dropped_id); + ****************/ + + super.sim_schedule(user_id, GridSimTags.SCHEDULE_NOW, + GridSimTags.FNB_FILE_FAILED_BECAUSE_PACKET_DROPPED, msgDrop); + } + else { - glID = msgDrop.getEntityID(); + // we dropped a gridlet + // Tell the user that the gridlet is failed because of the dropping of a packet + msgDrop = new FnbMessageDropGridlet(object_dropped_id); - if (glID != 9999) - { - // Check if it is a file or a gridlet - if (msgDrop instanceof FnbMessageDropFile) - { - // Tell the user that the file is failed because of the dropping of a packet - super.sim_schedule(user_id, GridSimTags.SCHEDULE_NOW, - GridSimTags. - FNB_FILE_FAILED_BECAUSE_PACKET_DROPPED, - msgDrop); - } - else if (msgDrop instanceof FnbMessageDropGridlet) - { - // Tell the user that the gridlet is failed because of the dropping of a packet - super.sim_schedule(user_id, GridSimTags.SCHEDULE_NOW, - GridSimTags. - FNB_GRIDLET_FAILED_BECAUSE_PACKET_DROPPED, - msgDrop); - } - } - ev = null; // new, to call the garbage collector + /**************** + System.out.println(super.get_name() + + ": Sending FNB_GRIDLET_FAILED_BECAUSE_PACKET_DROPPED to " + + GridSim.getEntityName(user_id) + ". GL: " + object_dropped_id); + ****************/ + + super.sim_schedule(user_id, GridSimTags.SCHEDULE_NOW, + GridSimTags.FNB_GRIDLET_FAILED_BECAUSE_PACKET_DROPPED, msgDrop); } + ev = null; // new, to call the garbage collector } @@ -514,7 +522,16 @@ private synchronized void defaultSend(Sim_event ev, int gisID, int statID, int shutdownID) { - IO_data io = (IO_data) ev.get_data(); + IO_data io = null; + try + { + io = (IO_data) ev.get_data(); + + }catch (ClassCastException e) + { + System.out.println("549 " + super.get_name() + ": ClassCastException. ev.tag: " + ev.get_tag()); + } + int destId = io.getDestID(); /***** // DEBUG info @@ -581,7 +598,7 @@ int numPackets = (int) Math.ceil(size / (MTU * 1.0)); int glID = 9999; int fileID = 9999; - firstLastPacketsGridlet packGl = new firstLastPacketsGridlet(); + //firstLastPacketsGridlet packGl = new firstLastPacketsGridlet(); FnbEndToEndPath conn = null; try{ @@ -590,11 +607,11 @@ glID = ((Gridlet) obj).getGridletID(); // Here we will keep the packets belonging to each gridlet - packGl.setFirstPacketID(pktID_); // the first packet of this gridlet - packGl.setGridletID(glID); + //packGl.setFirstPacketID(pktID_); // the first packet of this gridlet + //packGl.setGridletID(glID); conn = new FnbEndToEndPath(destId, super.get_id(), - netServiceType, numPackets, glID); + netServiceType, numPackets, glID, false); } else if (obj instanceof DataGridlet) // For the datagrid extension @@ -603,11 +620,11 @@ // Here we will keep the packets belonging to each gridlet - packGl.setFirstPacketID(pktID_); // the first packet of this gridlet - packGl.setGridletID(glID); + //packGl.setFirstPacketID(pktID_); // the first packet of this gridlet + //packGl.setGridletID(glID); conn = new FnbEndToEndPath(destId, super.get_id(), - netServiceType, numPackets, glID); + netServiceType, numPackets, glID, false); } else if (obj instanceof Object[]) // For the datagrid extension (File) @@ -647,11 +664,11 @@ }*/ glID = checkFilename(fileName); // get a id for the file - packGl.setFirstPacketID(pktID_); // the first packet of this file - packGl.setFileID(glID); // the name of the file + //packGl.setFirstPacketID(pktID_); // the first packet of this file + //packGl.setFileID(glID); // the name of the file conn = new FnbEndToEndPath(destId, super.get_id(), - netServiceType, numPackets, glID); + netServiceType, numPackets, glID, true); //GridSimTags.FNB_PKT_CONTAINS_FILE); //System.out.println(super.get_name() + ": fileName: " + fileName); @@ -689,18 +706,18 @@ super.get_id(), destId, netServiceType, numPackets, numPackets);*/ - if ((obj instanceof Gridlet) || (obj instanceof DataGridlet) || + /*if ((obj instanceof Gridlet) || (obj instanceof DataGridlet) || (obj instanceof Object[])) { packGl.setLastPacketID(pktID_); // the last packet of this gridlet packetsGridletsList_.add(packGl); // put this firstLastPacketsGridlet entity into the list - /*System.out.println(">>>>>>>>>> "+super.get_name() + - ": submitting entity: " + glID + " .(First, last): (" + - packGl.getFirst() + ", " + packGl.getLast() + ")");*/ + //System.out.println(">>>>>>>>>> "+super.get_name() + + // ": submitting entity: " + glID + " .(First, last): (" + + // packGl.getFirst() + ", " + packGl.getLast() + ")"); - } + }*/ enque(np, GridSimTags.SCHEDULE_NOW); @@ -832,8 +849,7 @@ if (obj instanceof Gridlet) { glID = ((Gridlet) obj).getGridletID(); - conn = new FnbEndToEndPath(destId, super.get_id(), netServiceType, numPackets, - glID); + conn = new FnbEndToEndPath(destId, super.get_id(), netServiceType, numPackets, glID, false); } else { @@ -899,8 +915,7 @@ if (obj instanceof Gridlet) { glID = ((Gridlet) obj).getGridletID(); - conn = new FnbEndToEndPath(destId, super.get_id(), netServiceType, numPackets, - glID); + conn = new FnbEndToEndPath(destId, super.get_id(), netServiceType, numPackets, glID, false); } else { @@ -1018,15 +1033,18 @@ * to know which gridlet a packet belongs to. * @return the packetsGridletsList_ of this output entity */ + /********************* private ArrayList getPacketsGridletsList() { return packetsGridletsList_; } + *********************/ /** This function returns the entity (gridlet/file) to which a packet belongs * @param pktID the ID of the packet of interest * @return a FnbMessage object */ + /********************* private FnbMessage lookForEntity(int pktID) { FnbMessage msgDrop = null; // = new FnbMessage(9999, false); @@ -1035,29 +1053,31 @@ firstLastPacketsGridlet flPktGl = (firstLastPacketsGridlet) packetsGridletsList_.get(i); - if ( (flPktGl.getFirstPacketID() <= pktID) && + if ( (flPktGl.getFirstPacketID() <= pktID) && (flPktGl.getLastPacketID() > pktID) ) { if (flPktGl.isFile() == true) { - msgDrop = new FnbMessageDropFile(flPktGl.getID(), + msgDrop = new FnbMessageDropFile(flPktGl.getID(), getFilename(flPktGl.getID()) ); } - else { - msgDrop = new FnbMessageDropGridlet( flPktGl.getID() ); - } - - /***** - System.out.println(super.get_name() + ": lookForEntity: entiyID: " + - flPktGl.getGridletID() + ". isFile " + flPktGl.getIsFile() + - ". filename " + getFilename(msgDrop.getEntityID())); - *****/ - + //else { + // msgDrop = new FnbMessageDropGridlet( flPktGl.getID() ); + //} + + + //System.out.println(super.get_name() + ": lookForEntity: entiyID: " + + // flPktGl.getGridletID() + ". isFile " + flPktGl.getIsFile() + + // ". filename " + getFilename(msgDrop.getEntityID())); + + return msgDrop; } } return msgDrop;// if there is no entity, return this } + *********************/ } // end class + Modified: trunk/source/gridsim/net/fnb/FnbRIPRouter.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbRIPRouter.java 2008-10-11 03:22:27 UTC (rev 252) +++ trunk/source/gridsim/net/fnb/FnbRIPRouter.java 2008-10-11 03:26:18 UTC (rev 253) @@ -9,6 +9,24 @@ * Author: Gokul Poduval & Chen-Khong Tham * Copyright (c) 2008, The University of Melbourne, Australia and * Universidad de Castilla La Mancha (UCLM), Spain + * + * Based on class RIPRouter, by Gokul Poduval & Chen-Khong Tham, + * National University of Singapore. + * Things added or modified: + * private int my_id_; + * MIN, + * INTERVAL, + * getRoutingTable() + * getMyID() + * packetCounter_HighPriority, + * packetCounter_LowPriority, + * nextInterval + * fw_write(...) + * dequeue(...) + * init(...) + * processNetPacket(...) : FnbNetPacket + * processCountDroppedPkts() + * processEndOfSimulation(...) */ package gridsim.net.fnb; @@ -25,7 +43,8 @@ * protocol used here is similar to <a * href="http://www.ietf.org/rfc/rfc1058.txt">Routing Information Protocol * (RIP) </a>. The routing protocol is run before Gridlets etc. can be - * submitted. + * submitted. Note that this class is based on + * {@link gridsim.net.RIPRouter} class. * <p> * In case there are more than two routes to a destination, the * route with the lower hopcount is used. Since in this simulation routers @@ -35,23 +54,6 @@ * @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. - * Things added or modified: - * private int my_id_; - * MIN, - * INTERVAL, - * getRoutingTable() - * get_my_id() - * packetCounter_HighPriority, - * packetCounter_LowPriority, - * nextInterval - * fw_write(...) - * dequeue(...) - * init(...) - * processNetPacket(...) : FnbNetPacket - * processCountDroppedPkts() - * processEndOfSimulation(...) */ public class FnbRIPRouter extends Router { @@ -61,15 +63,12 @@ private Hashtable routerTable; private Hashtable forwardTable; private int id; - private int my_id_; // for a router named "router0", its my_id will be 0 - - private final int MIN = 60; // 1 minute in seconds - private final double INTERVAL = 2 * MIN; - // the interval to update (reset) the packet counters - + + // the interval (in seconds) to update (reset) the packet counters + private static final double INTERVAL = 120; + private double nextInterval_dropped; - private boolean storeStats; /** @@ -78,7 +77,8 @@ * 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 + * @param my_id the user specified router ID. + * For a router named "router0", <tt>my_id</tt> will be 0. * @throws NullPointerException This happens when name is empty or null * @see #FnbRIPRouter(String, boolean, int) * @pre name != null @@ -98,7 +98,8 @@ * @param name Name of this router * @param trace <tt>true</tt> if you want to record this router's * activity, <tt>false</tt> otherwise - * @param my_id the my_id of this router. For a router named "router0", its my_id will be 0 + * @param my_id the user specified router ID. + * For a router named "router0", <tt>my_id</tt> will be 0. * @throws NullPointerException This happens when name is empty or null * @pre name != null * @post $none @@ -118,7 +119,8 @@ * 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 my_id the user specified router ID. + * For a router named "router0", <tt>my_id</tt> will be 0. * @param stats true if we want to record statistics * @throws NullPointerException This happens when name is empty or null * @see #FnbRIPRouter(String, boolean, int) @@ -141,7 +143,8 @@ * @param name Name of this router * @param trace <tt>true</tt> if you want to record this router's * activity, <tt>false</tt> otherwise - * @param my_id for a router named "Router0", its my_id will be 0 + * @param my_id the user specified router ID. + * For a router named "router0", <tt>my_id</tt> will be 0. * @param stats true if we want to recor statistics * @throws NullPointerException This happens when name is empty or null * @pre name != null @@ -164,9 +167,7 @@ private void init() { this.id = super.get_id(); - nextInterval_dropped = INTERVAL; - linkTable = new Hashtable(); hostTable = new Hashtable(); routerTable = new Hashtable(); @@ -358,11 +359,6 @@ processInternalEvent(ev); break; - case GridSimTags.END_OF_SIMULATION: - //processEndOfSimulation(ev); - processEndSimulation(ev); - break; - case GridSimTags.FNB_UPDATE_ARED_PARAMETERS: updateAREDParameters(); break; @@ -376,62 +372,49 @@ } /** - * This function updates the value of max_p, which is the maximum dropping probability for a packet */ - public void updateAREDParameters() + * This function updates the value of max_p, which is the maximum + * dropping probability for a packet + */ + private void updateAREDParameters() { String link; - FnbSCFQScheduler sched; for (Enumeration e = schedTable.keys(); e.hasMoreElements(); ) { link = (String) e.nextElement(); - sched = (FnbSCFQScheduler) schedTable.get(link); if ((schedTable.get(link)) instanceof ARED) { ((ARED) sched).updateAREDParameters(); } - + if (storeStats == true) { sched.updateStats(); - } + } } //for (Enumeration e = schedTable.keys(); e.hasMoreElements(); ) super.sim_schedule(super.get_id(), - GridSimTags.SCHEDULE_NOW + - GridSimTags.FNB_UPDATE_ARED_PARAMETERS_PERIOD, - GridSimTags.FNB_UPDATE_ARED_PARAMETERS); - + GridSimTags.SCHEDULE_NOW + GridSimTags.FNB_UPDATE_ARED_PARAMETERS_PERIOD, + GridSimTags.FNB_UPDATE_ARED_PARAMETERS); } - + ////////////////////////////////////////////////////////////////// /**At the end of simulations, write the counters into files. - * @param ev an event*/ - protected void processEndSimulation(Sim_event ev) - { - processCountDroppedPkts(ev); - - } - - // todo + */ protected void processEndSimulation() { - // empty + processCountDroppedPkts(); } - - // todo - public ArrayList getRoutingTable() + + /** Sends an initial event to itself regarding to the ARED parameters. + */ + protected void sendInitialEvent() { - return null; - } - - protected void sendInitialEvent() - { // This random is to avoid the initial stages of sims, where nothing happens // (as users have not started to send gridlets). Random random = new Random(); @@ -439,22 +422,24 @@ GridSimTags.SCHEDULE_NOW + (200 * random.nextDouble()), GridSimTags.FNB_UPDATE_ARED_PARAMETERS); } - + ////////////////////////////////////////////////////////////////// /** * This event is used to write in a file the current number of packets * dropped at the schedulers of this router - * @param ev an event*/ - private void processCountDroppedPkts(Sim_event ev) + */ + private void processCountDroppedPkts() { - /*System.out.println(super.get_name() + - ": COUNT_DROPPED_PKTS event arrived. Clock: " + - GridSim.clock() + "Next event will be in (delay) " + - (GridSimTags.SCHEDULE_NOW + 3600));*/ + /********************************* + System.out.println(super.get_name() + + ": COUNT_DROPPED_PKTS event arrived. Clock: " + + GridSim.clock() + "Next event will be in (delay) " + + (GridSimTags.SCHEDULE_NOW + 3600)); + ********************/ + double clock = GridSim.clock(); - String link; int bufferSize; double maxBufferSize; @@ -507,12 +492,16 @@ */ private synchronized void processNetPacket(Sim_event ev, int tag) { - processCountDroppedPkts(ev); + processCountDroppedPkts(); double nextTime = 0; Packet pkt = (Packet) ev.get_data(); PacketScheduler sched = getScheduler(pkt); - + + boolean isFile = false; + if (pkt instanceof FnbNetPacket) + isFile = ((FnbNetPacket)pkt).isFile(); + // if a packet scheduler is not found, then try reschedule this packet // in the future if (sched == null) @@ -563,28 +552,24 @@ // break a large packet into smaller ones that fit into MTU // by making null or empty packets except for the last one FnbNetPacket np = null; + for (int i = 0; i < numPackets - 1; i++) { FnbEndToEndPath conn; if (pkt instanceof FnbNetPacket) { conn = new FnbEndToEndPath(pkt.getDestID(), pkt.getSrcID(), - pkt.getNetServiceType(), - numPackets, - ((FnbNetPacket) pkt).getObjectID()); + pkt.getNetServiceType(), numPackets, + ((FnbNetPacket) pkt).getObjectID(), isFile); } else { conn = new FnbEndToEndPath(pkt.getDestID(), pkt.getSrcID(), - pkt.getNetServiceType(), - numPackets); - + pkt.getNetServiceType(), numPackets); } - np = new FnbNetPacket(null, pkt.getID(), MTU, tag, - conn.getSrc()); - + + np = new FnbNetPacket(null, pkt.getID(), MTU, tag, conn.getSrc()); np.setPath(conn); - np.setLast(id); if (super.reportWriter_ != null) { super.write("enqueing, " + np); @@ -695,7 +680,7 @@ { // need to forward to another router Object[] data = (Object[]) forwardTable.get(dest); - + // in case the forwarding table is incomplete if (data == null) { return null; @@ -709,7 +694,7 @@ catch (Exception e) { sched = null; } - + return sched; } @@ -818,13 +803,12 @@ } /** - * Returns the my_id_ of this router + * Returns the user specified ID of this router * @pre $none * @post $none - * @return the my_id_ of he entity + * @return the user specified ID of this router */ - - public int get_my_id() + public int getMyID() { return my_id_; } @@ -866,7 +850,7 @@ private synchronized void receiveAd(Sim_event ev) { if (super.reportWriter_ != null) { - super.write("receive router ad from, " + + super.write("receive router ad from, " + GridSim.getEntityName(ev.get_src())); } Modified: trunk/source/gridsim/net/fnb/FnbSCFQScheduler.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbSCFQScheduler.java 2008-10-11 03:22:27 UTC (rev 252) +++ trunk/source/gridsim/net/fnb/FnbSCFQScheduler.java 2008-10-11 03:26:18 UTC (rev 253) @@ -27,12 +27,11 @@ * - Everything regarding RED dropping algorithm * - DROPPED_PKTS_COUNTER * - getMaxBufferSize() - * - setMaxBufferSize() + * - setMaxBufferSize() */ package gridsim.net.fnb; - import eduni.simjava.*; import gridsim.*; import java.util.*; @@ -48,6 +47,7 @@ * WFQ because it does not need to compute round numbers at every iteration. * For more details refer to <b>S. R. Golestani's</b> INFOCOM '94 paper * <i>A self-clocked fair queueing scheme for broadband applications</i>. + * Note that this class is based on {@link gridsim.net.SCFQScheduler} class. * <p> * A SCFQ scheduler can provide differentiated service to traffic by changing * the weights associated with a certain class of traffic. The higher the weight @@ -69,7 +69,7 @@ * @since GridSim Toolkit 4.2 * @author Agustin Caminero, Universidad de Castilla-La Mancha (UCLM) (Spain) */ -public abstract class FnbSCFQScheduler extends GridSim implements PacketScheduler +public abstract class FnbSCFQScheduler extends Sim_entity implements PacketScheduler { private String name_; // this scheduler name private double baudRate_; // baud rate of this scheduler @@ -79,41 +79,39 @@ private double CF ; // current finish number private Hashtable flowTable; - private int maxBufferSize = 0; // the maximum buffer size used this scheduler in the experiment + private int maxBufferSize = 0; // max buffer size used this scheduler in the experiment + private boolean storeStats; // record stats or not - private boolean storeStats; // whether we want to store stats for this sim or not - private int DROPPED_PKTS_COUNTER = 0; + private int MAX_BUFF_SIZE_PK; // max number of packets that fit into a buffer - private int MAX_BUFF_SIZE_PK; //max number of packets that fit into a buffer - private ArrayList droppedGl_user; // in this array, we keep the list of FnbDroppedPacketInfo objects, showing the (gridlets, userID) // already dropped in this scheduler. // This way, we will only send a PACKET_DROPPED event for the first dropped packet of a gridlet. // This way, we will avoid a lot of events, thus saving memory. - public double MAX_AVG = 0.0; + //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 - * no functional purposes. - * - * @param name Name of this scheduler - * @param baudRate baud rate in bits/s of the port that is using - * this scheduler. - * @param max_buf_size maximum buffer size for routers - * @param stats whether we want to store stats or not - * @throws Exception This happens when the name is null or - * the baud rate <= 0 - * @pre name != null - * @pre baudRate > 0 - * @post $none - */ - public FnbSCFQScheduler(String name, double baudRate, int max_buf_size, boolean stats) - throws Exception + * 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 + * no functional purposes. + * + * @param name Name of this scheduler + * @param baudRate baud rate in bits/s of the port that is using + * this scheduler. + * @param max_buf_size maximum buffer size for routers + * @param stats whether we want to store stats or not + * @throws Exception This happens when the name is null or + * the baud rate <= 0 + * @pre name != null + * @pre baudRate > 0 + * @post $none + */ + public FnbSCFQScheduler(String name, double baudRate, int max_buf_size, + boolean stats) throws Exception { super(name); @@ -122,66 +120,59 @@ } if (baudRate <= 0) { - throw new ParameterException("FnbSCFQScheduler(): Baudrate <= 0."); + throw new ParameterException("FnbSCFQScheduler(): Baudrate <= 0."); } - name_ = name; baudRate_ = baudRate; - MAX_BUFF_SIZE_PK = max_buf_size; - storeStats = stats; - droppedGl_user = new ArrayList(); - init(); } /** - * Creates a new SCFQ packet scheduler with the specified baud rate - * (bits/s). The name is set to a generic name: <b>"FnbSCFQScheduler"</b>. - * - * @param baudRate baud rate in bits/s of the port that is using - * this scheduler. - * @param max_buf_size maximum buffer size for routers - * @param stats whether we want to store stats or not - * @throws Exception This happens when the baud rate <= 0 - * @pre baudRate > 0 - * @post $none - */ + * Creates a new SCFQ packet scheduler with the specified baud rate + * (bits/s). The name is set to a generic name: <b>"FnbSCFQScheduler"</b>. + * + * @param baudRate baud rate in bits/s of the port that is using + * this scheduler. + * @param max_buf_size maximum buffer size for routers + * @param stats whether we want to store stats or not + * @throws Exception This happens when the baud rate <= 0 + * @pre baudRate > 0 + * @post $none + */ public FnbSCFQScheduler(double baudRate, int max_buf_size, boolean stats) throws Exception { super("FnbSCFQScheduler"); if (baudRate <= 0) { - throw new ParameterException("FnbSCFQScheduler(): Baudrate <= 0."); + throw new ParameterException("FnbSCFQScheduler(): Baudrate <= 0."); } name_ = "FnbSCFQScheduler"; baudRate_ = baudRate; - MAX_BUFF_SIZE_PK = max_buf_size; storeStats = stats; - droppedGl_user = new ArrayList(); init(); } /** - * Creates a new SCFQ packet scheduler with the specified name. - * The baud rate is left at 0, and should be set with - * {@link gridsim.net.PacketScheduler#setBaudRate(double)} - * before the simulation starts. - * - * @param name Name of this scheduler - * @param max_buf_size maximum buffer size for routers - * @param stats whether we want to store stats or not - * @throws Exception This happens when the name is null - * @see gridsim.net.PacketScheduler#setBaudRate(double) - * @pre name != null - * @post $none - */ + * Creates a new SCFQ packet scheduler with the specified name. + * The baud rate is left at 0, and should be set with + * {@link gridsim.net.PacketScheduler#setBaudRate(double)} + * before the simulation starts. + * + * @param name Name of this scheduler + * @param max_buf_size maximum buffer size for routers + * @param stats whether we want to store stats or not + * @throws Exception This happens when the name is null + * @see gridsim.net.PacketScheduler#setBaudRate(double) + * @pre name != null + * @post $none + */ public FnbSCFQScheduler(String name, int max_buf_size, boolean stats) throws Exception { super(name); @@ -192,85 +183,73 @@ name_ = name; baudRate_ = 0; - MAX_BUFF_SIZE_PK = max_buf_size; - storeStats = stats; - droppedGl_user = new ArrayList(); - init(); } /** - * Creates a new packet scheduler with the name <b>"FnbSCFQScheduler"</b>. - * The baud rate is left at 0, and should be set with - * {@link gridsim.net.PacketScheduler#setBaudRate(double)} - * before the simulation starts. - * @param stats whether we want to store stats or not - * @throws Exception This happens when the name is null - * @see gridsim.net.PacketScheduler#setBaudRate(double) - * @pre $none - * @post $none - */ + * Creates a new packet scheduler with the name <b>"FnbSCFQScheduler"</b>. + * The baud rate is left at 0, and should be set with + * {@link gridsim.net.PacketScheduler#setBaudRate(double)} + * before the simulation starts. + * @param stats whether we want to store stats or not + * @throws Exception This happens when the name is null + * @see gridsim.net.PacketScheduler#setBaudRate(double) + * @pre $none + * @post $none + */ public FnbSCFQScheduler(boolean stats) throws Exception { super("FnbSCFQScheduler"); name_ = "FnbSCFQScheduler"; baudRate_ = 0; - storeStats = stats; - droppedGl_user = new ArrayList(); - init(); } - - /** - * Creates a new SCFQ packet scheduler with the specified baud rate - * (bits/s). The name is set to a generic name: <b>"FnbSCFQScheduler"</b>. - * - * @param baudRate baud rate in bits/s of the port that is using - * this scheduler. - * @param max_buf_size maximum buffer size for routers - * @throws Exception This happens when the baud rate <= 0 - * @pre baudRate > 0 - * @post $none - */ + * Creates a new SCFQ packet scheduler with the specified baud rate + * (bits/s). The name is set to a generic name: <b>"FnbSCFQScheduler"</b>. + * + * @param baudRate baud rate in bits/s of the port that is using + * this scheduler. + * @param max_buf_size maximum buffer size for routers + * @throws Exception This happens when the baud rate <= 0 + * @pre baudRate > 0 + * @post $none + */ public FnbSCFQScheduler(double baudRate, int max_buf_size) throws Exception { super("FnbSCFQScheduler"); if (baudRate <= 0) { - throw new ParameterException("FnbSCFQScheduler(): Baudrate <= 0."); + throw new ParameterException("FnbSCFQScheduler(): Baudrate <= 0."); } name_ = "FnbSCFQScheduler"; baudRate_ = baudRate; - MAX_BUFF_SIZE_PK = max_buf_size; - droppedGl_user = new ArrayList(); - init(); } /** - * Creates a new SCFQ packet scheduler with the specified name. - * The baud rate is left at 0, and should be set with - * {@link gridsim.net.PacketScheduler#setBaudRate(double)} - * before the simulation starts. - * - * @param name Name of this scheduler - * @param max_buf_size maximum buffer size for routers - * @throws Exception This happens when the name is null - * @see gridsim.net.PacketScheduler#setBaudRate(double) - * @pre name != null - * @post $none - */ + * Creates a new SCFQ packet scheduler with the specified name. + * The baud rate is left at 0, and should be set with + * {@link gridsim.net.PacketScheduler#setBaudRate(double)} + * before the simulation starts. + * + * @param name Name of this scheduler + * @param max_buf_size maximum buffer size for routers + * @throws Exception This happens when the name is null + * @see gridsim.net.PacketScheduler#setBaudRate(double) + * @pre name != null + * @post $none + */ public FnbSCFQScheduler(String name, int max_buf_size) throws Exception { super(name); @@ -281,20 +260,16 @@ name_ = name; baudRate_ = 0; - MAX_BUFF_SIZE_PK = max_buf_size; - droppedGl_user = new ArrayList(); - init(); } - /** - * Initialises all the attributes - * @pre $none - * @post $none - */ + * Initialises all the attributes + * @pre $none + * @post $none + */ private void init() { flowTable = new Hashtable(); @@ -306,37 +281,35 @@ if (storeStats) { fw_write("Interval, BufferSize, AvgBufferSize, MaxBufferSize\n", - getSchedName() + "_MaxBufferSize.csv", false); + getSchedName() + "_MaxBufferSize.csv", false); fw_write("Interval, DroppedPackets\n", - this.getSchedName() + "_DroppedPkts.csv", false); + this.getSchedName() + "_DroppedPkts.csv", false); fw_write("Clock, MAX_P, MIN_TH, MAX_TH, AVG, QUEUE_SIZE\n", - this.getSchedName() + "_Buffers.csv", false); - + this.getSchedName() + "_Buffers.csv", false); } - } - /**This function initializes the parameters of the buffers policies (RED, ARED) - * */ - public abstract void initialize(); + /**This function initializes the parameters of the buffers policies (RED, ARED) + */ + protected abstract void initialize(); /** - * This method allows you to set different weights for different types of - * traffic. Traffic of class <tt>n</tt> are assigned a weight of - * <tt>weights[n]</tt>. The ... [truncated message content] |
From: <sul...@us...> - 2008-10-11 03:22:33
|
Revision: 252 http://gridsim.svn.sourceforge.net/gridsim/?rev=252&view=rev Author: sulistio Date: 2008-10-11 03:22:27 +0000 (Sat, 11 Oct 2008) Log Message: ----------- Agustin's works: rename FnbDroppedUserPacket class to FnbDroppedUserObject, and add a new attribute. Added Paths: ----------- trunk/source/gridsim/net/fnb/FnbDroppedUserObject.java Copied: trunk/source/gridsim/net/fnb/FnbDroppedUserObject.java (from rev 251, trunk/source/gridsim/net/fnb/FnbDroppedUserPacket.java) =================================================================== --- trunk/source/gridsim/net/fnb/FnbDroppedUserObject.java (rev 0) +++ trunk/source/gridsim/net/fnb/FnbDroppedUserObject.java 2008-10-11 03:22:27 UTC (rev 252) @@ -0,0 +1,172 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Author: Agustin Caminero + * Organization: Universidad de Castilla La Mancha (UCLM), Spain. + * Copyright (c) 2008, The University of Melbourne, Australia and + * Universidad de Castilla La Mancha (UCLM), Spain + */ + +package gridsim.net.fnb; + +import gridsim.net.*; + +/** + * 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 FnbDroppedUserObject implements Packet +{ + private int userID; + private int objectID; // id of the object (e.g. gridlet) the dropped pkt belonged to + private boolean isFile; // true if this is a file + + /** + * Create an object of this class. + * @param userID the user id + * @param objectID the packet id + */ + public FnbDroppedUserObject(int userID, int objectID, boolean isfile) + { + this.userID = userID; + this.objectID = objectID; + this.isFile = isfile; + } + + + /** + * Gets the isFile + * @return true if this is a file, false otherwise + */ + public boolean getIsFile() + { + return isFile; + } + + /** + * Gets the user id + * @return user id + */ + public int getUserID() + { + return userID; + } + + /** + * Gets this packet tag. + * @return -1 since no packet tag has been stored in this class. + * @pre $none + * @post $none + */ + public int getTag() + { + return -1; + } + + /** + * 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 -1 since no entity ID has been stored in this class. + * @pre $none + * @post $none + */ + public int getLast() + { + return -1; + } + + /** + * 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 -1 since no network service type has been stored in this class. + * @pre $none + * @post $none + */ + public int getNetServiceType() + { + return -1; + } + + /** + * Returns the ID of the source of this packet. + * @return -1 since no source ID has been stored in this class. + * @pre $none + * @post $none + */ + public int getSrcID() + { + return -1; + } + + /** + * Returns the ID of this object (e.g. gridlet ID) + * @return packet ID + * @pre $none + * @post $none + */ + public int getID() + { + return objectID; + } + + /** + * Returns the destination id of this packet. + * @return -1 since no destination ID has been stored in this class. + * @pre $none + * @post $none + */ + public int getDestID() + { + return -1; + } + + /** + * Sets the size of this packet. <br> + * Note that this method is not used. + * @param size size of the packet + * @return <tt>false</tt> since this method is not used. + * @pre size >= 0 + * @post $none + */ + public boolean setSize(long size) + { + return false; + } + + /** + * Returns the size of this packet + * @return size of the packet + * @pre $none + * @post $none + */ + public long getSize() + { + return -1; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sul...@us...> - 2008-10-06 08:08:17
|
Revision: 251 http://gridsim.svn.sourceforge.net/gridsim/?rev=251&view=rev Author: sulistio Date: 2008-10-06 08:08:03 +0000 (Mon, 06 Oct 2008) Log Message: ----------- fix few javadoc issues. Modified Paths: -------------- trunk/source/gridsim/net/fnb/FnbInput.java trunk/source/gridsim/net/fnb/FnbNetworkReader.java trunk/source/gridsim/net/fnb/FnbOutput.java Modified: trunk/source/gridsim/net/fnb/FnbInput.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbInput.java 2008-09-29 10:31:58 UTC (rev 250) +++ trunk/source/gridsim/net/fnb/FnbInput.java 2008-10-06 08:08:03 UTC (rev 251) @@ -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 + * + * This class is based on Input class, by Manzur Murshed and Rajkumar Buyya. + * Things added or modifyed: + * - getDataFromLink(...) + * - source_PktNum_array + * - FnbNetPacket instead of NetPacket */ package gridsim.net.fnb; @@ -21,26 +27,22 @@ import gridsim.util.TrafficGenerator; /** - * GridSim FnbInput class defines a port through which a simulation entity - * receives data from the simulated network. + * Thiss class defines a port through which a simulation entity + * receives data from the simulated network. Note that this class is based on + * {@link gridsim.net.Input} class. * <p> * It maintains an event queue * to serialize the data-in-flow and delivers to its parent entity. - * It accepts messages that comes from GridSim entities 'FnbOutput' entity + * It accepts messages that comes from GridSim entities + * {@link gridsim.net.fnb.FnbOutput} entity * and passes the same to the GridSim entity. * It simulates Network communication delay depending on Baud rate * and data length. Simultaneous inputs can be modeled using multiple * instances of this class. * - * @author Agustin Caminero, Universidad de Castilla La Mancha (Spain). - * Based on Input class, by Manzur Murshed and Rajkumar Buyya. + * @author Agustin Caminero, Universidad de Castilla La Mancha (Spain). * @since GridSim Toolkit 4.2 - * - * Things added or modifyed: - * - getDataFromLink(...) - * - source_PktNum_array - * - FnbNetPacket instead of NetPacket - * + * @see gridsim.net.Input */ public class FnbInput extends Sim_entity implements NetIO { @@ -88,20 +90,9 @@ /** * Gets the baud rate * @return the baud rate - * @deprecated As of GridSim 2.1, replaced by {@link #getBaudRate()} * @pre $none * @post $result >= 0.0 */ - public double GetBaudRate() { - return this.getBaudRate(); - } - - /** - * Gets the baud rate - * @return the baud rate - * @pre $none - * @post $result >= 0.0 - */ public double getBaudRate() { return baudRate_; } @@ -110,21 +101,9 @@ * Gets the I/O real number based on a given value * @param value the specified value * @return real number - * @deprecated As of GridSim 2.1, replaced by {@link #realIO(double)} * @pre value >= 0.0 * @post $result >= 0.0 */ - public double real_io(double value) { - return this.realIO(value); - } - - /** - * Gets the I/O real number based on a given value - * @param value the specified value - * @return real number - * @pre value >= 0.0 - * @post $result >= 0.0 - */ public double realIO(double value) { return GridSimRandom.realIO(value); } @@ -320,14 +299,15 @@ int src_outputPort = ((FnbNetPacket) np).getSrcID(); //String src_outputPort_str = GridSim.getEntityName(src_outputPort); - /* + /******** // Uncomment this for more info on the progress of sims if (name.compareTo("Input_SIM_0_Res_0") == 0) System.out.println(super.get_name() + ": packet arrived to the res" + ". Pkt num: " + ((FnbNetPacket) np).getPacketNum() + - " from " + src_outputPort_str);*/ + " from " + src_outputPort_str); + ***********/ //int pktID = ((FnbNetPacket) np).getID(); //int PrevPktNum; // The pkt Num of the previous packet @@ -394,8 +374,6 @@ // convert the packets into IO_data Object data = np.getData(); - - IO_data io = new IO_data(data, np.getSize(), inPort_.get_dest()); @@ -412,6 +390,7 @@ " from " + src_outputPort_str + "\n");*/ + /*********** // NOTE: redundant name = super.get_name(); if (name.indexOf("Input_SIM_0_Res_5") != -1) { @@ -419,13 +398,14 @@ "Data (maybe a gridlet) arrived at the Resource\n", super.get_name()); - /*System.out.println("\n*********" + + System.out.println("\n*********" + super.get_name() + ": Data (maybe a gridlet) arrived at the Resource. Pkt num: " + ((FnbNetPacket) np).getPacketNum() + " from " + src_outputPort_str + - "\n");*/ + "\n"); } + ***********************/ } // if (srcPktNum.getOk() == true) Modified: trunk/source/gridsim/net/fnb/FnbNetworkReader.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbNetworkReader.java 2008-09-29 10:31:58 UTC (rev 250) +++ trunk/source/gridsim/net/fnb/FnbNetworkReader.java 2008-10-06 08:08:03 UTC (rev 251) @@ -110,7 +110,7 @@ * Gets a {@link gridsim.net.Router} object from the list * @param name a router name * @param routerList a list containing the finiteBufferRouter objects - * @return a {@link gridsim.net.fnb.FnbRouter} object or + * @return a {@link gridsim.net.Router} object or * <tt>null</tt> if not found */ public static Router getRouter(String name, LinkedList routerList) Modified: trunk/source/gridsim/net/fnb/FnbOutput.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbOutput.java 2008-09-29 10:31:58 UTC (rev 250) +++ trunk/source/gridsim/net/fnb/FnbOutput.java 2008-10-06 08:08:03 UTC (rev 251) @@ -29,8 +29,9 @@ /** - * GridSim FnbOutput defines a port through which a simulation entity sends - * data to the simulated network. + * This class defines a port through which a simulation entity sends + * data to the simulated network. Note that this class is based on + * {@link gridsim.net.Output} class. * <p> * It maintains an event queue to serialize * the data-out-flow and delivers to the destination entity. @@ -242,21 +243,9 @@ /** * Gets the baud rate * @return the baud rate - * @deprecated As of GridSim 2.1, replaced by {@link #getBaudRate()} * @pre $none * @post $result >= 0.0 */ - public double GetBaudRate() - { - return this.getBaudRate(); - } - - /** - * Gets the baud rate - * @return the baud rate - * @pre $none - * @post $result >= 0.0 - */ public double getBaudRate() { return baudRate_; @@ -266,22 +255,9 @@ * Gets the I/O real number based on a given value * @param value the specified value * @return real number - * @deprecated As of GridSim 2.1, replaced by {@link #realIO(double)} * @pre $none * @post $result >= 0.0 */ - public double real_io(double value) - { - return this.realIO(value); - } - - /** - * Gets the I/O real number based on a given value - * @param value the specified value - * @return real number - * @pre $none - * @post $result >= 0.0 - */ public double realIO(double value) { return GridSimRandom.realIO(value); @@ -354,7 +330,7 @@ * What we do is just set the gridlet as failed. We do not resubmit the gridlet. * @param ev an incoming event * */ - public void processPacketDropped(Sim_event ev) + private void processPacketDropped(Sim_event ev) { FnbDroppedUserPacket userPkt = (FnbDroppedUserPacket) ev.get_data(); int pkt_dropped_id = userPkt.getID(); @@ -731,10 +707,11 @@ pktID_++; // increments packet ID } - /**Returns the my_id of the file. + /** Returns my_id of the file. * @param fname the name of the file - * @return the my_id of the file*/ - int checkFilename(String fname) + * @return my_id of the file + */ + private int checkFilename(String fname) { FileName_FileMyID fname_fid; int last_fileID = 0; @@ -758,10 +735,11 @@ return last_fileID + 1; } - /**Returns the file name of the file with the given my_id + /** Returns the file name of the file with the given my_id * @param fileID the id of the file - * @return the name of the file*/ - String getFilename(int fileID) + * @return the name of the file + */ + private String getFilename(int fileID) { FileName_FileMyID fname_fid; int last_fileID = 0; @@ -1036,20 +1014,20 @@ } } - /**This functions returns the packetsGridletsList_. This is used by the user + /** This functions returns the packetsGridletsList_. This is used by the user * to know which gridlet a packet belongs to. * @return the packetsGridletsList_ of this output entity - * */ - ArrayList getPacketsGridletsList() + */ + private ArrayList getPacketsGridletsList() { return packetsGridletsList_; } - /**This function returns the entity (gridlet/file) to which a packet belongs + /** This function returns the entity (gridlet/file) to which a packet belongs * @param pktID the ID of the packet of interest * @return a FnbMessage object - * */ - FnbMessage lookForEntity(int pktID) + */ + private FnbMessage lookForEntity(int pktID) { FnbMessage msgDrop = null; // = new FnbMessage(9999, false); for (int i = 0; i < packetsGridletsList_.size(); i++) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <sul...@us...> - 2008-09-29 10:30:49
|
Revision: 249 http://gridsim.svn.sourceforge.net/gridsim/?rev=249&view=rev Author: sulistio Date: 2008-09-29 10:30:45 +0000 (Mon, 29 Sep 2008) Log Message: ----------- minor updates due to changes in the ../Router.java and the removal of FnbRouter.java Modified Paths: -------------- trunk/source/gridsim/net/fnb/FnbNetworkReader.java trunk/source/gridsim/net/fnb/FnbRIPRouter.java Modified: trunk/source/gridsim/net/fnb/FnbNetworkReader.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbNetworkReader.java 2008-09-29 10:29:42 UTC (rev 248) +++ trunk/source/gridsim/net/fnb/FnbNetworkReader.java 2008-09-29 10:30:45 UTC (rev 249) @@ -8,9 +8,13 @@ * 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 NetworkReader class. + * Things added or modifyed: + * - createNetworkSCFQ(...) + * - Use finiteBufferSCFQScheduler instead of SCFQScheduler */ -// NOTE: this class is similar to NetworkReader.java -- perhaps modify the original one? package gridsim.net.fnb; import gridsim.net.fnb.*; @@ -19,9 +23,13 @@ import java.io.*; import gridsim.*; + /** * This is an utility class, which parses a file and constructs the - * network topology automatically. <br> + * network topology automatically, using the SCFQ packet scheduler + * for network buffers ({@link gridsim.net.fnb.FnbSCFQScheduler}). + * Note that this class is based on the {@link gridsim.util.NetworkReader} class. + * <p> * The file that defines the network has the following form: <br> <br> * <tt> * # specify the number of routers<br> @@ -43,13 +51,9 @@ * inside a router. * If it is not given, then by default the value is false. * - * Things added or modifyed: - * - createNetworkSCFQ(...) - * - Use finiteBufferSCFQScheduler instead of SCFQScheduler - * + * @see gridsim.net.fnb.FnbSCFQScheduler * @since GridSim Toolkit 4.2 - * @author Agustin Caminero, Universidad de Castilla La Mancha (Spain). - * Based on NetworkReader class, by Uros Cibej and Anthony Sulistio. + * @author Agustin Caminero, Universidad de Castilla-La Mancha (UCLM) (Spain). */ public class FnbNetworkReader { @@ -66,8 +70,8 @@ * @param max_p maximum drop probability for RED * @param queue_weight queue weight for RED * @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 + * @return the list of finiteBufferRouters of the network or + * <tt>null</tt> if an error occurs * @see gridsim.net.fnb.FnbSCFQScheduler */ public static LinkedList createSCFQ(String filename, double[] weight, @@ -103,24 +107,25 @@ /** - * Gets a finiteBufferRouter object from the list + * Gets a {@link gridsim.net.Router} object from the list * @param name a router name * @param routerList a list containing the finiteBufferRouter objects - * @return a finiteBufferRouter object or <tt>null</tt> if not found + * @return a {@link gridsim.net.fnb.FnbRouter} object or + * <tt>null</tt> if not found */ - public static FnbRouter getRouter(String name, LinkedList routerList) + public static Router getRouter(String name, LinkedList routerList) { if (name == null || routerList == null || name.length() == 0) { return null; } - FnbRouter router = null; + Router router = null; try { Iterator it = routerList.iterator(); while ( it.hasNext() ) { - router = (FnbRouter) it.next(); + router = (Router) it.next(); if (router.get_name().equals(name) == true) { break; } @@ -139,12 +144,13 @@ /** * 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 rate a flag denotes the type of Router 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 + * @return a list of {@link gridsim.net.fnb.FnbRIPRouter} objects or + * <tt>null</tt> if an error occurs */ - private static LinkedList createRouter(BufferedReader buf, - boolean rate, boolean stats) throws Exception + private static LinkedList createRouter(BufferedReader buf, boolean rate, + boolean stats) throws Exception { String line = null; StringTokenizer str = null; @@ -172,7 +178,7 @@ } LinkedList routerList = new LinkedList(); - FnbRouter router = null; // a FnbRouter object + Router router = null; // a Router object String name = null; // router name String flag = null; // a flag to denote logging router or not boolean log = false; @@ -211,7 +217,7 @@ int my_id = (Integer.decode(my_id_str)).intValue(); - // create a specific FnbRouter object + // create a specific Router object if (rate == true) { System.out.println(" ****** FnbNetworkReader.createRouter(): " + @@ -240,28 +246,27 @@ * @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 + * @return a list of {@link gridsim.net.fnb.FnbRIPRouter} objects or + * <tt>null</tt> if an error occurs */ - private static LinkedList createNetworkSCFQ(BufferedReader buf, - double[] weight, - int max_buf_size, int drop_alg, - int min_th, int max_th, - double max_p, double queue_weight, boolean stats) throws - Exception + private static LinkedList createNetworkSCFQ(BufferedReader buf, double[] weight, + int max_buf_size, int drop_alg, int min_th, + int max_th, double max_p, double queue_weight, + boolean stats) throws Exception { if (buf == null) { return null; } - // create the FnbRouter objects first + // create the Router objects first LinkedList routerList = createRouter(buf, false, stats); int GB = 1000000000; // 1 GB in bits String line; String name1, name2; StringTokenizer str = null; - FnbRouter r1, r2; + Router r1, r2; Link tempLink = null; // creating the linking between two routers @@ -344,17 +349,13 @@ queue_weight, stats); } - - - r1Sched.setWeights(weight); r2Sched.setWeights(weight); r1.attachRouter(r2, tempLink, r1Sched, r2Sched); } + return routerList; } - - } // end class Modified: trunk/source/gridsim/net/fnb/FnbRIPRouter.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbRIPRouter.java 2008-09-29 10:29:42 UTC (rev 248) +++ trunk/source/gridsim/net/fnb/FnbRIPRouter.java 2008-09-29 10:30:45 UTC (rev 249) @@ -53,7 +53,7 @@ * processCountDroppedPkts() * processEndOfSimulation(...) */ -public class FnbRIPRouter extends FnbRouter +public class FnbRIPRouter extends Router { private Hashtable linkTable; private Hashtable schedTable; // table of schedulers @@ -61,7 +61,6 @@ private Hashtable routerTable; private Hashtable forwardTable; private int id; - private final int BITS = 8; // 1 byte in bits private int my_id_; // for a router named "router0", its my_id will be 0 @@ -194,9 +193,8 @@ * @pre otherSched != null * @post $none */ - public void attachRouter(FnbRouter router, Link link, - PacketScheduler thisSched, - PacketScheduler otherSched) + public void attachRouter(Router router, Link link, + PacketScheduler thisSched, PacketScheduler otherSched) { String msg = super.get_name() + ".attachRouter(): Error - "; if (router == null) @@ -214,12 +212,12 @@ if (thisSched == null || otherSched == null) { System.out.println(msg + - "the one or more packet schedulers are null."); + "the one or more packet schedulers are null."); return; } - thisSched.setBaudRate(link.getBaudRate()); - otherSched.setBaudRate(link.getBaudRate()); + thisSched.setBaudRate( link.getBaudRate() ); + otherSched.setBaudRate( link.getBaudRate() ); link.attach(this, router); this.attachRouter(router, link, thisSched); @@ -230,7 +228,7 @@ * Joins two routers together. This is called by the routers themselves * and should not be called by other entities. * - * @param router The FnbRouter to which this router will be connected. + * @param router The Router to which this router will be connected. * @param link The Link that will be used to join these routers. * @param sched The scheduling policy used on the egress port of the * router when sending data through this route. @@ -239,8 +237,7 @@ * @pre sched != null * @post $none */ - protected void attachRouter(FnbRouter router, Link link, - PacketScheduler sched) + public void attachRouter(Router router, Link link, PacketScheduler sched) { String msg = super.get_name() + ".attachRouter(): Error - "; if (router == null) @@ -263,26 +260,25 @@ linkTable.put(router.get_name(), link.get_name()); - if (!schedTable.containsKey(link.get_name())) - { + if (!schedTable.containsKey( link.get_name()) ) { schedTable.put(link.get_name(), sched); } - routerTable.put(link.get_name(), router.get_name()); - hostTable.put(link.get_name(), router.get_name()); + routerTable.put( link.get_name(), router.get_name() ); + hostTable.put( link.get_name(), router.get_name() ); // logging or recording ... if (reportWriter_ != null) { StringBuffer sb = null; sb = new StringBuffer("attach this ROUTER, with router, "); - sb.append(router.get_name()); + sb.append( router.get_name() ); sb.append(", with link, "); - sb.append(link.get_name()); + sb.append( link.get_name() ); sb.append(", with packet scheduler, "); - sb.append(sched.getSchedName()); + sb.append( sched.getSchedName() ); - super.write(sb.toString()); + super.write( sb.toString() ); } } @@ -316,27 +312,26 @@ } Link link = entity.getLink(); - sched.setBaudRate(link.getBaudRate()); + sched.setBaudRate( link.getBaudRate() ); link.attach(this, entity); - linkTable.put(entity.get_name(), link.get_name()); + linkTable.put( entity.get_name(), link.get_name() ); - if (!schedTable.containsKey(link.get_name())) - { + if (!schedTable.containsKey( link.get_name() )) { schedTable.put(link.get_name(), sched); } - hostTable.put(link.get_name(), entity.get_name()); + hostTable.put( link.get_name(), entity.get_name() ); // recording ... if (reportWriter_ != null) { StringBuffer sb = null; sb = new StringBuffer("attach this ROUTER, to entity, "); - sb.append(entity.get_name()); + sb.append( entity.get_name() ); sb.append(", with packet scheduler, "); - sb.append(sched.getSchedName()); + sb.append( sched.getSchedName() ); - super.write(sb.toString()); + super.write( sb.toString() ); } } @@ -348,7 +343,7 @@ */ protected synchronized void processEvent(Sim_event ev) { - switch (ev.get_tag()) + switch ( ev.get_tag() ) { case GridSimTags.PKT_FORWARD: case GridSimTags.JUNK_PKT: @@ -364,7 +359,8 @@ break; case GridSimTags.END_OF_SIMULATION: - processEndOfSimulation(ev); + //processEndOfSimulation(ev); + processEndSimulation(ev); break; case GridSimTags.FNB_UPDATE_ARED_PARAMETERS: @@ -373,8 +369,8 @@ default: System.out.println(super.get_name() + ".body(): Unable to " + - "handle request from GridSimTags " + - "with constant number " + ev.get_tag()); + "handle request from GridSimTags " + + "with constant number " + ev.get_tag() ); break; } } @@ -396,28 +392,13 @@ if ((schedTable.get(link)) instanceof ARED) { ((ARED) sched).updateAREDParameters(); - - if (storeStats) - { - ((ARED) sched).updateStats(); - } } - else if ((schedTable.get(link)) instanceof RED) + + if (storeStats == true) { - if (storeStats) - { - ((RED) sched).updateStats(); - } - } - else - { - if (storeStats) - { - ((FIFO) sched).updateStats(); - } + sched.updateStats(); + } - } - } //for (Enumeration e = schedTable.keys(); e.hasMoreElements(); ) super.sim_schedule(super.get_id(), @@ -426,14 +407,40 @@ GridSimTags.FNB_UPDATE_ARED_PARAMETERS); } + + ////////////////////////////////////////////////////////////////// /**At the end of simulations, write the counters into files. * @param ev an event*/ - private void processEndOfSimulation(Sim_event ev) + protected void processEndSimulation(Sim_event ev) { processCountDroppedPkts(ev); } + + // todo + protected void processEndSimulation() + { + // empty + } + + // todo + public ArrayList getRoutingTable() + { + return null; + } + + protected void sendInitialEvent() + { + // This random is to avoid the initial stages of sims, where nothing happens + // (as users have not started to send gridlets). + Random random = new Random(); + super.sim_schedule(super.get_id(), + GridSimTags.SCHEDULE_NOW + (200 * random.nextDouble()), + GridSimTags.FNB_UPDATE_ARED_PARAMETERS); + } + + ////////////////////////////////////////////////////////////////// /** @@ -504,19 +511,30 @@ double nextTime = 0; Packet pkt = (Packet) ev.get_data(); - PacketScheduler sched = getScheduler(pkt); + + // if a packet scheduler is not found, then try reschedule this packet + // in the future + if (sched == null) + { + System.out.println(super.get_name() + ".processNetPacket(): " + + "Warning - can't find a packet scheduler for " + pkt); + System.out.println("-> Will reschedule it again in the future."); + super.sim_schedule(super.get_id(), Router.DELAY, tag, pkt); + return; + } + // process ping() request if (pkt instanceof InfoPacket) { ((InfoPacket) pkt).addHop(id); - ((InfoPacket) pkt).addEntryTime(GridSim.clock()); + ((InfoPacket) pkt).addEntryTime( GridSim.clock() ); ((InfoPacket) pkt).addBaudRate(sched.getBaudRate()); } // check downlink MTU, and split accordingly - String linkName = getLinkName(pkt.getDestID()); + String linkName = getLinkName( pkt.getDestID() ); Link downLink = (Link) Sim_system.get_entity(linkName); int MTU = downLink.getMTU(); int numPackets = (int) Math.ceil(pkt.getSize() / (MTU * 1.0)); @@ -524,13 +542,11 @@ // if no packets at the moment if (sched.size() == 0) { - if (numPackets == 1) - { - nextTime = (pkt.getSize() * BITS) / sched.getBaudRate(); + if (numPackets == 1) { + nextTime = (pkt.getSize() * NetIO.BITS) / sched.getBaudRate(); } - else - { - nextTime = (MTU * BITS * 1.0) / sched.getBaudRate(); + else { + nextTime = (MTU * NetIO.BITS * 1.0) / sched.getBaudRate(); } sendInternalEvent(nextTime, sched); @@ -570,15 +586,19 @@ np.setPath(conn); np.setLast(id); - super.write("enqueing, " + np); - sched.enque(np); // put the packet into the scheduler + if (super.reportWriter_ != null) { + super.write("enqueing, " + np); + } + sched.enque(np); // put the packet into the scheduler } // put the actual packet into the last one and resize it accordingly pkt.setLast(id); pkt.setSize(pkt.getSize() - MTU * (numPackets - 1)); - super.write("enqueing, " + pkt); - sched.enque(pkt); // put the packet into the scheduler + if (super.reportWriter_ != null) { + super.write("enqueing, " + pkt); + } + sched.enque(pkt); // put the packet into the scheduler } /** @@ -594,9 +614,8 @@ String linkName = null; //directly connected - if (hostTable.containsValue(destName)) - { - linkName = (String) linkTable.get(destName); + if (hostTable.containsValue(destName)) { + linkName = (String)linkTable.get(destName); } else { @@ -619,12 +638,11 @@ */ public PacketScheduler getScheduler(Packet np) { - if (np == null) - { + if (np == null) { return null; } - String destName = GridSim.getEntityName(np.getDestID()); + String destName = GridSim.getEntityName( np.getDestID() ); return getScheduler(destName); } @@ -640,8 +658,7 @@ */ public PacketScheduler getScheduler(int dest) { - if (dest < 0) - { + if (dest < 0) { return null; } @@ -662,26 +679,37 @@ */ public PacketScheduler getScheduler(String dest) { - if (dest == null || dest.length() == 0) - { + if (dest == null || dest.length() == 0) { return null; } PacketScheduler sched = null; - if (hostTable.containsValue(dest)) + try { - String linkName = (String) linkTable.get(dest); - sched = (PacketScheduler) schedTable.get(linkName); + if ( hostTable.containsValue(dest) ) + { + String linkName = (String) linkTable.get(dest); + sched = (PacketScheduler) schedTable.get(linkName); + } + else + { + // need to forward to another router + Object[] data = (Object[]) forwardTable.get(dest); + + // in case the forwarding table is incomplete + if (data == null) { + return null; + } + + String router = (String) data[0]; + String linkName = (String) linkTable.get(router); + sched = (PacketScheduler) schedTable.get(linkName); + } } - else - { - // need to forward to another router - Object[] data = (Object[]) forwardTable.get(dest); - String router = (String) data[0]; - String linkName = (String) linkTable.get(router); - sched = (PacketScheduler) schedTable.get(linkName); + catch (Exception e) { + sched = null; } - + return sched; } @@ -711,32 +739,32 @@ if (np != null) { // process ping() packet - if (np instanceof InfoPacket) - { - ((InfoPacket) np).addExitTime(GridSim.clock()); + if (np instanceof InfoPacket) { + ((InfoPacket) np).addExitTime( GridSim.clock() ); } - super.write("dequeuing, " + np); + if (super.reportWriter_ != null) { + super.write("dequeuing, " + np); + } // must distinguish between normal and junk packet int tag = GridSimTags.PKT_FORWARD; - if (np.getTag() == GridSimTags.JUNK_PKT) - { + if (np.getTag() == GridSimTags.JUNK_PKT) { tag = GridSimTags.JUNK_PKT; } // sends the packet via the link - String linkName = getLinkName(np.getDestID()); + String linkName = getLinkName( np.getDestID() ); super.sim_schedule(GridSim.getEntityId(linkName), GridSimTags.SCHEDULE_NOW, tag, np); // process the next packet in the scheduler - if (!sched.isEmpty()) + if ( !sched.isEmpty() ) { - double nextTime = (np.getSize() * BITS) / sched.getBaudRate(); + double nextTime = (np.getSize() * NetIO.BITS) / sched.getBaudRate(); sendInternalEvent(nextTime, sched); } - } // if (np !=null) + } } /** @@ -749,8 +777,7 @@ */ private synchronized boolean sendInternalEvent(double time, Object data) { - if (time < 0.0) - { + if (time < 0.0) { return false; } @@ -779,9 +806,9 @@ for (Enumeration e = forwardTable.keys(); e.hasMoreElements(); ) { - String host = (String) e.nextElement(); - Object[] data = (Object[]) forwardTable.get(host); - String nextHop = (String) data[0]; + String host = (String)e.nextElement(); + Object[] data = (Object[])forwardTable.get(host); + String nextHop = (String)data[0]; System.out.println(host + "\t\t" + nextHop); } @@ -814,16 +841,18 @@ Collection hosts = hostTable.values(); // who to advertise Enumeration routers = routerTable.elements(); - while (routers.hasMoreElements()) + while ( routers.hasMoreElements() ) { RIPAdPack ad = new RIPAdPack(super.get_name(), hosts); String router = (String) routers.nextElement(); - super.write("advertise to router, " + router); + if (super.reportWriter_ != null) { + super.write("advertise to router, " + router); + } sim_schedule(Sim_system.get_entity_id(router), GridSimTags.SCHEDULE_NOW, GridSimTags.ROUTER_AD, ad); } - super.sim_pause(5); // wait for 5 secs to gather the results + super.sim_pause(5); // wait for 5 secs to gather the results } /** @@ -836,32 +865,31 @@ */ private synchronized void receiveAd(Sim_event ev) { - super.write("receive router ad from, " + - GridSim.getEntityName(ev.get_src())); + if (super.reportWriter_ != null) { + super.write("receive router ad from, " + + GridSim.getEntityName(ev.get_src())); + } // what to do when an ad is received - RIPAdPack ad = (RIPAdPack) ev.get_data(); + RIPAdPack ad = (RIPAdPack)ev.get_data(); // prevent count-to-infinity - if (ad.getHopCount() > 15) - { + if (ad.getHopCount() > Router.MAX_HOP_COUNT) { return; } String sender = ad.getSender(); Iterator it = ad.getHosts().iterator(); - while (it.hasNext()) + while ( it.hasNext() ) { String host = (String) it.next(); - if (host.equals(super.get_name())) - { + if ( host.equals(super.get_name()) ) { continue; } - if (hostTable.containsValue(host)) - { // direct connection + if (hostTable.containsValue(host)) { // direct connection continue; } @@ -872,15 +900,13 @@ if ((hop) > ad.getHopCount()) { - Object[] toPut = - {sender, new Integer(ad.getHopCount())}; + Object[] toPut = {sender, new Integer(ad.getHopCount()) }; forwardTable.put(host, toPut); } } else { - Object[] toPut = - {sender, new Integer(ad.getHopCount())}; + Object[] toPut = {sender, new Integer(ad.getHopCount()) }; forwardTable.put(host, toPut); } } @@ -900,18 +926,17 @@ { String sender = ad.getSender(); ad.incrementHopCount(); - RIPAdPack newad = new RIPAdPack(super.get_name(), ad.getHosts()); + RIPAdPack newad = new RIPAdPack(super.get_name(),ad.getHosts()); newad.setHopCount(ad.getHopCount()); Enumeration routers = routerTable.elements(); - while (routers.hasMoreElements()) + while ( routers.hasMoreElements() ) { - String router = (String) routers.nextElement(); + String router = (String)routers.nextElement(); if (!router.equals(sender)) { sim_schedule(Sim_system.get_entity_id(router), - GridSimTags.SCHEDULE_NOW, GridSimTags.ROUTER_AD, - newad); + GridSimTags.SCHEDULE_NOW, GridSimTags.ROUTER_AD, newad); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sul...@us...> - 2008-09-29 10:29:47
|
Revision: 248 http://gridsim.svn.sourceforge.net/gridsim/?rev=248&view=rev Author: sulistio Date: 2008-09-29 10:29:42 +0000 (Mon, 29 Sep 2008) Log Message: ----------- add a new protected method called sendInitialEvent() such that its child classes can send events before receiving incoming events. Modified Paths: -------------- trunk/source/gridsim/net/Router.java Modified: trunk/source/gridsim/net/Router.java =================================================================== --- trunk/source/gridsim/net/Router.java 2008-09-29 10:27:42 UTC (rev 247) +++ trunk/source/gridsim/net/Router.java 2008-09-29 10:29:42 UTC (rev 248) @@ -259,6 +259,7 @@ // methods to be overriden by children classes advertiseHosts(); registerOtherEntity(); + sendInitialEvent(); // Process incoming events Sim_event ev = new Sim_event(); @@ -311,13 +312,14 @@ protected abstract void processEvent(Sim_event ev); /** - * Overrides this method when making a type of router. - * This method is called by {@link #body()} to register other type to + * Overrides this method when making a new type of router. + * This method is called by the {@link #body()} method + * to register to other type of the * {@link gridsim.GridInformationService} entity. In doing so, you - * need to create a new child class extending from - * {@link gridsim.GridInformationService}. + * need to create a new child class extending from the + * {@link gridsim.GridInformationService} class. * <br> - * <b>NOTE:</b> You do not need to override {@link #body()} method, if + * <b>NOTE:</b> You do not need to override the {@link #body()} method, if * you use this method. * * @pre $none @@ -327,6 +329,20 @@ protected void registerOtherEntity() { // ... empty } + + /** + * Overrides this method when sending initial event(s) to itself or others + * <b>BEFORE</b> receiving incoming events from other entities. + * <br> + * <b>NOTE:</b> You do not need to override the {@link #body()} method, if + * you use this method. + * + * @pre $none + * @post $none + */ + protected void sendInitialEvent() { + // ... empty + } /** * Writes a debug information to a file. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sul...@us...> - 2008-09-29 10:27:52
|
Revision: 247 http://gridsim.svn.sourceforge.net/gridsim/?rev=247&view=rev Author: sulistio Date: 2008-09-29 10:27:42 +0000 (Mon, 29 Sep 2008) Log Message: ----------- deleted since it is redundant. Removed Paths: ------------- trunk/source/gridsim/net/fnb/FnbRouter.java Deleted: trunk/source/gridsim/net/fnb/FnbRouter.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbRouter.java 2008-09-23 11:11:48 UTC (rev 246) +++ trunk/source/gridsim/net/fnb/FnbRouter.java 2008-09-29 10:27:42 UTC (rev 247) @@ -1,365 +0,0 @@ -/* - * Title: GridSim Toolkit - * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation - * of Parallel and Distributed Systems such as Clusters and Grids - * Licence: GPL - http://www.gnu.org/copyleft/gpl.html - * - * Author: Agustin Caminero - * Organization: Universidad de Castilla La Mancha (UCLM), Spain. - * Author: Gokul Poduval & Chen-Khong Tham - * Copyright (c) 2008, The University of Melbourne, Australia and - * Universidad de Castilla La Mancha (UCLM), Spain - */ - -package gridsim.net.fnb; - -import java.util.*; -import gridsim.*; -import gridsim.net.*; -import gridsim.util.SimReport; -import eduni.simjava.*; - -/** - * This class implements a Router which forwards data from one entity to - * another. - * <p> - * This abstract class only contains abstract methods to connect other - * routers and hosts. In addition, common functionalities are available - * in this class for its children classes to use. - * However, this class does not provide methods on how to setup forwarding - * tables, so the design of that is left to the user if he/she wants to - * create a Router with some specific routing algorithm. - * <p> - * Few important notes to consider when extending from this class: - * <ul> - * <li>do not override {@link #body()} method as - * it contains code/functionality to register this entity to - * {@link gridsim.GridInformationService} entity, and finalizing - * logging information before exiting the simulation. - * <li>must overridden {@link #advertiseHosts()} method. It is - * needed for advertising all hosts or - * entities connected to this entity to adjacent routers. - * <li>{@link #registerOtherEntity()} method : for registering other - * event type/tag to {@link gridsim.GridInformationService}. - * This is optional. - * <li>must overridden {@link #processEvent(Sim_event)} method. - * It is needed for processing incoming events. - * <li>do not forget to implement logging or recording functionalities - * for incoming and outgoing packets. <br> - * {@link gridsim.util.SimReport} object is created in this class, - * hence, you only need to use {@link #write(String)} method. - * </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. - * Functions added or modified: - * - get_my_id() - */ -public abstract class FnbRouter extends Sim_entity -{ - /** An attribute that logs incoming and outgoing packets into a file. - * Use {@link #write(String)} to log or record the information. - */ - protected SimReport reportWriter_; - - /** Denotes a time delay (in second) for sending events in the future. */ - protected static int DELAY = 2; // in seconds - - - /** - *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 #FnbRouter(String, boolean)}. - * - * @param name Name of this router - * @throws NullPointerException This happens when name is empty or null - * @see #FnbRouter(String, boolean) - * @pre name != null - * @post $none - */ - public FnbRouter(String name) throws NullPointerException - { - super(name); - reportWriter_ = null; - } - - /** - * Creates a new FnbRouter object with logging facility if it is turned on. - * <br> - * NOTE: If logging facility is turned on, there are some overheads - * in terms of performance and memory consumption. - * - * @param name Name of this router - * @param trace <tt>true</tt> if you want to record this router's - * activity, <tt>false</tt> otherwise - * @throws NullPointerException This happens when name is empty or null - * @pre name != null - * @post $none - */ - public FnbRouter(String name, boolean trace) throws NullPointerException - { - super(name); - try - { - if (trace == true) { - reportWriter_ = new SimReport(name + "_report"); - } - else { - reportWriter_ = null; - } - } - catch (Exception e) - { - System.out.println(name + "(): Exception error."); - System.out.println( e.getMessage() ); - reportWriter_ = null; - } - } - - /** - * Joins two routers with a Link. - * - * @param router The router on the other side to which this one will - * be attached. - * @param link This is the link that will be used to connect the two - * routers. - * @param thisSched The scheduling policy used on this routers egress port - * when sending data through it. - * @param otherSched The scheduling policy that will be used on the - * egress port of the router being connected to when - * sending data to this router. - * @pre router != null - * @pre link != null - * @pre thisSched != null - * @pre otherSched != null - * @post $none - */ - public abstract void attachRouter(FnbRouter router, Link link, - PacketScheduler thisSched, PacketScheduler otherSched); - - /** - * Joins two routers together. This is called by the routers themselves - * and should not be called by other entities. - * - * @param router The FnbRouter to which this router will be connected. - * @param link The Link that will be used to join these routers. - * @param sched The scheduling policy used on the egress port of the - * router when sending data through this route. - * @pre router != null - * @pre link != null - * @pre sched != null - * @post $none - */ - protected abstract void attachRouter(FnbRouter router, Link link, - PacketScheduler sched); - - /** - * Attaches an entity to this router. The link between the router and the - * entity being attached is taken from - * {@link gridsim.GridSimCore#getLink()}. - * - * @param entity The entity to be attached. - * @param sched The scheduling policy that will be used on the egress - * port when the router sends data to the entity being - * joined. - * @see gridsim.GridSimCore#getLink() - * @pre entity != null - * @pre sched != null - * @post $none - */ - public abstract void attachHost(GridSimCore entity, PacketScheduler sched); - - /** - * Returns the Scheduler associated with a packet. Each packet has a - * destination. The router returns the scheduler that it would use to - * scheduler this packet if it were traversing this router. Once a - * reference to the scheduler is obtained, different parameters - * (like priorities, weights etc.) could be modified. - * - * @param np NetPacket for which the associated scheduler is to be - * returned. This can be used to set weigths, priorities, etc. - * as the case may be on the Scheduler. - * @return the packet's scheduler - * @pre np != null - * @post $none - */ - public abstract PacketScheduler getScheduler(Packet np); - - /** - * Returns the Scheduler that the router would use to reach a particular - * destination. Once a reference to the scheduler is obtained, different - * parameters (like priorities, weights etc.) could be modified. - * - * @param dest id of the destination for which the Scheduler is required. - * @return the packet's scheduler - * @pre dest > 0 - * @post $none - */ - public abstract PacketScheduler getScheduler(int dest); - - /** - * Returns the Scheduler that the router would use to reach a particular - * destination. This can be used to set weigths, priorities etc. as the - * case may be on the Scheduler - * - * @param dest Name of the destination for which the Scheduler is required. - * @return the packet's scheduler - * @pre dest != null - * @post $none - */ - public abstract PacketScheduler getScheduler(String dest); - - /** - * This method prints out the forwarding table of the router in a human - * readable form. - * @pre $none - * @post $none - */ - public abstract void printRoutingTable(); - - - /** - * Returns an ArrayList containing this router's routing table in a nice-formatted layout, using RoutingPath class. - * @pre $none - * @post $none - */ - - // public abstract ArrayList getRoutingTable(); - - - /** - * Returns the my_id_ of this router - * @pre $none - * @post $none - * @return the my_id_ of he entity - */ - - public abstract int get_my_id(); - - /** - * Handles incoming requests. <b>DO NOT</b> overrides this method as - * it contains code/functionality to register this entity to - * {@link gridsim.GridInformationService} entity, and finalizing - * logging information before exiting the simulation. - * <p> - * This method also calls these methods in the following order: - * <ol> - * <li>must overridden {@link #advertiseHosts()} method. It is - * needed for advertising all hosts or - * entities connected to this entity to adjacent routers. - * <li> {@link #registerOtherEntity()} method : for registering other - * event type/tag to {@link gridsim.GridInformationService}. - * This is optional. - * <li>must overridden {@link #processEvent(Sim_event)} method. - * It is needed for processing incoming events. - * </ol> - * - * @pre $none - * @post $none - */ - public void body() - { - //register oneself - write("register this entity to GridInformationService entity."); - super.sim_schedule(GridSim.getGridInfoServiceEntityId(), - GridSimTags.SCHEDULE_NOW, GridSimTags.REGISTER_ROUTER, - new Integer(super.get_id()) ); - - // methods to be overriden by children classes - advertiseHosts(); - registerOtherEntity(); - - // This random is to avoid the initial stages of sims, where nothing happens - // (as users have not started to send gridlets). - Random random = new Random(5); - super.sim_schedule(super.get_id(), - GridSimTags.SCHEDULE_NOW + (200 * random.nextDouble()), - GridSimTags.FNB_UPDATE_ARED_PARAMETERS); - - // Process incoming events - Sim_event ev = new Sim_event(); - while ( Sim_system.running() ) - { - //Sim_event ev = new Sim_event(); - super.sim_get_next(ev); - - // if the simulation finishes then exit the loop - if (ev.get_tag() == GridSimTags.END_OF_SIMULATION) - { - write("receives, END_OF_SIMULATION, signal, from, " + - GridSim.getEntityName(ev.get_src()) ); - break; - } - - // process the received event - processEvent(ev); - } - - // finalize logging before exiting - if (reportWriter_ != null) { - reportWriter_.finalWrite(); - } - } - - /** - * All hosts connected to this router are advertised to adjacent routers - * @pre $none - * @post $none - */ - protected abstract void advertiseHosts(); - - /** - * Overrides this method when creating a new type of router. - * This method is called by {@link #body()} for incoming unknown tags. - * <p> - * The services or tags available for this resource are: - * <ul> - * <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 - * @pre ev != null - * @post $none - */ - protected abstract void processEvent(Sim_event ev); - - /** - * Overrides this method when making a type of router. - * This method is called by {@link #body()} to register other type to - * {@link gridsim.GridInformationService} entity. In doing so, you - * need to create a new child class extending from - * {@link gridsim.GridInformationService}. - * <br> - * <b>NOTE:</b> You do not need to override {@link #body()} method, if - * you use this method. - * - * @pre $none - * @post $none - * @see gridsim.GridInformationService - */ - protected void registerOtherEntity() { - // ... empty - } - - /** - * Writes a debug information to a file. - * The format of information is left to the coder. - * - * @param str a string message - * @pre str != null - * @post $none - */ - protected void write(String str) - { - if (reportWriter_ != null) { - reportWriter_.write(str); - } - } - - -} // end class This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sul...@us...> - 2008-09-23 11:11:51
|
Revision: 246 http://gridsim.svn.sourceforge.net/gridsim/?rev=246&view=rev Author: sulistio Date: 2008-09-23 11:11:48 +0000 (Tue, 23 Sep 2008) Log Message: ----------- changes to the code due to improvements and modifications in other classes. Modified Paths: -------------- trunk/source/gridsim/net/fnb/FnbInput.java trunk/source/gridsim/net/fnb/FnbOutput.java Modified: trunk/source/gridsim/net/fnb/FnbInput.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbInput.java 2008-09-23 11:10:43 UTC (rev 245) +++ trunk/source/gridsim/net/fnb/FnbInput.java 2008-09-23 11:11:48 UTC (rev 246) @@ -370,12 +370,12 @@ // Increase the number of pkts already received //srcPktNum.setNumOfPkts(srcPktNum.getNumOfPkts() + 1); - srcPktNum.increaseNumOfArrivedPkts(); + srcPktNum.addNumOfArrivedPkts(); // If this is the last packet of the gridlet, then the gridlet is ok int totalPkt = ((FnbNetPacket) np).getTotalPackets(); - if (srcPktNum.getNumOfPkts() == totalPkt) - srcPktNum.setOk(true); + if (srcPktNum.getNumOfPacket() == totalPkt) + srcPktNum.setStatus(true); @@ -388,7 +388,7 @@ { // This is the last packet in the gridlet, so we have to check // if the previous packets have arrived. - if (srcPktNum.getOk() == true) + if (srcPktNum.getStatus() == true) { // The gridlet has arrived perfect, with no packet lost @@ -453,7 +453,7 @@ { srcPktNum = (source_pktNum) source_PktNum_array.get(i); - if ((srcPktNum.getSource() == src) && (srcPktNum.getGlID() == glID)) + if ((srcPktNum.getSourceID() == src) && (srcPktNum.getGridletID() == glID)) return srcPktNum; } @@ -473,7 +473,7 @@ { srcPktNum = (source_pktNum) source_PktNum_array.get(i); - if (srcPktNum.getSource() == src) + if (srcPktNum.getSourceID() == src) source_PktNum_array.remove(i); } Modified: trunk/source/gridsim/net/fnb/FnbOutput.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbOutput.java 2008-09-23 11:10:43 UTC (rev 245) +++ trunk/source/gridsim/net/fnb/FnbOutput.java 2008-09-23 11:11:48 UTC (rev 246) @@ -57,8 +57,40 @@ private ArrayList packetsGridletsList_; // list of firstLastPacketsGridlet objects // This list contains the first/last packets belonging to each gridlet - private ArrayList filesname_fileMyIDs_; // keep a list of Fnb_FileName_FileMyID objects + private ArrayList filesname_fileMyIDs_; // keep a list of FileName_FileMyID objects + + ////////////////////////// INTERNAL CLASS ///////////////////////// + + private class FileName_FileMyID + { + // Since files don't have an id until they are registered, we need an id for them. + String filename; + int fileMyID; + + FileName_FileMyID(String f, int fid) + { + filename = f; + fileMyID = fid; + + } + + + String getFileName() + { + return filename; + } + + int getFileId() + { + return fileMyID; + } + } + + + ////////////////////////// INTERNAL CLASS ///////////////////////// + + /** * Allocates a new Output object * @param name the name of this object @@ -581,7 +613,7 @@ glID = ((Gridlet) obj).getGridletID(); // Here we will keep the packets belonging to each gridlet - packGl.setFirst(pktID_); // the first packet of this gridlet + packGl.setFirstPacketID(pktID_); // the first packet of this gridlet packGl.setGridletID(glID); conn = new FnbEndToEndPath(destId, super.get_id(), @@ -594,7 +626,7 @@ // Here we will keep the packets belonging to each gridlet - packGl.setFirst(pktID_); // the first packet of this gridlet + packGl.setFirstPacketID(pktID_); // the first packet of this gridlet packGl.setGridletID(glID); conn = new FnbEndToEndPath(destId, super.get_id(), @@ -638,13 +670,9 @@ }*/ glID = checkFilename(fileName); // get a id for the file + packGl.setFirstPacketID(pktID_); // the first packet of this file + packGl.setFileID(glID); // the name of the file - packGl.setFirst(pktID_); // the first packet of this file - packGl.setGridletID(glID); // the name of the file - - packGl.setIsFile(true); - - conn = new FnbEndToEndPath(destId, super.get_id(), netServiceType, numPackets, glID); //GridSimTags.FNB_PKT_CONTAINS_FILE); @@ -687,7 +715,7 @@ if ((obj instanceof Gridlet) || (obj instanceof DataGridlet) || (obj instanceof Object[])) { - packGl.setLast(pktID_); // the last packet of this gridlet + packGl.setLastPacketID(pktID_); // the last packet of this gridlet packetsGridletsList_.add(packGl); // put this firstLastPacketsGridlet entity into the list @@ -707,11 +735,11 @@ * @return the my_id of the file*/ int checkFilename(String fname) { - Fnb_FileName_FileMyID fname_fid; + FileName_FileMyID fname_fid; int last_fileID = 0; for (int i =0; i< filesname_fileMyIDs_.size(); i++) { - fname_fid = (Fnb_FileName_FileMyID) filesname_fileMyIDs_.get(i); + fname_fid = (FileName_FileMyID) filesname_fileMyIDs_.get(i); last_fileID = fname_fid.getFileId(); @@ -721,7 +749,7 @@ } } - fname_fid = new Fnb_FileName_FileMyID(fname, last_fileID + 1); + fname_fid = new FileName_FileMyID(fname, last_fileID + 1); filesname_fileMyIDs_.add(fname_fid); @@ -734,7 +762,7 @@ * @return the name of the file*/ String getFilename(int fileID) { - Fnb_FileName_FileMyID fname_fid; + FileName_FileMyID fname_fid; int last_fileID = 0; /*System.out.println(super.get_name() + ": getFilename(). fileID " + fileID + @@ -743,7 +771,7 @@ for (int i = 0; i < filesname_fileMyIDs_.size(); i++) { - fname_fid = (Fnb_FileName_FileMyID) filesname_fileMyIDs_.get(i); + fname_fid = (FileName_FileMyID) filesname_fileMyIDs_.get(i); last_fileID = fname_fid.getFileId(); @@ -1028,13 +1056,17 @@ firstLastPacketsGridlet flPktGl = (firstLastPacketsGridlet) packetsGridletsList_.get(i); - if ((flPktGl.getFirst() <= pktID) && (flPktGl.getLast() > pktID)) + if ( (flPktGl.getFirstPacketID() <= pktID) && + (flPktGl.getLastPacketID() > pktID) ) { - if (flPktGl.getIsFile()) - msgDrop = new FnbMessageDropFile(flPktGl.getGridletID() , getFilename(flPktGl.getGridletID())); - else - msgDrop = new FnbMessageDropGridlet(flPktGl.getGridletID()); - + if (flPktGl.isFile() == true) { + msgDrop = new FnbMessageDropFile(flPktGl.getID(), + getFilename(flPktGl.getID()) ); + } + else { + msgDrop = new FnbMessageDropGridlet( flPktGl.getID() ); + } + /***** System.out.println(super.get_name() + ": lookForEntity: entiyID: " + flPktGl.getGridletID() + ". isFile " + flPktGl.getIsFile() + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sul...@us...> - 2008-09-23 11:10:47
|
Revision: 245 http://gridsim.svn.sourceforge.net/gridsim/?rev=245&view=rev Author: sulistio Date: 2008-09-23 11:10:43 +0000 (Tue, 23 Sep 2008) Log Message: ----------- finish javadoc comments. In addition, modify few things inside this class. Modified Paths: -------------- 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/FnbWhiteList.java trunk/source/gridsim/net/fnb/firstLastPacketsGridlet.java trunk/source/gridsim/net/fnb/source_pktNum.java Modified: trunk/source/gridsim/net/fnb/FnbMessage.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbMessage.java 2008-09-23 11:09:18 UTC (rev 244) +++ trunk/source/gridsim/net/fnb/FnbMessage.java 2008-09-23 11:10:43 UTC (rev 245) @@ -13,14 +13,29 @@ package gridsim.net.fnb; /** - * + * This class provides a template for sending a message due to a packet + * being dropped in the network. * @author Agustin Caminero * @since GridSim Toolkit 4.2 + * @see gridsim.net.fnb.FnbMessageDropGridlet + * @see gridsim.net.fnb.FnbMessageDropFile */ public interface FnbMessage { - public void setEntityID(int i); + /** + * Sets an entity ID that is being dropped in the network. <br> + * NOTE: the type of an entity depends on its subclasses. + * An entity could represents a Gridlet or a File. + * @param id an entity id + * @see gridsim.net.fnb.FnbMessageDropGridlet#setEntityID(int) + * @see gridsim.net.fnb.FnbMessageDropFile#setEntityID(int) + */ + public void setEntityID(int id); + /** + * Gets an entity ID of this class. + * @return an entity ID + */ public int getEntityID(); +} -} Modified: trunk/source/gridsim/net/fnb/FnbMessageDropFile.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbMessageDropFile.java 2008-09-23 11:09:18 UTC (rev 244) +++ trunk/source/gridsim/net/fnb/FnbMessageDropFile.java 2008-09-23 11:10:43 UTC (rev 245) @@ -12,44 +12,66 @@ package gridsim.net.fnb; -import gridsim.net.fnb.*; +import gridsim.net.fnb.FnbMessage; /** - * + * This class contains a file ID and its name, that is currently being + * dropped in the network. + * This class is primarily used by the {@link gridsim.net.fnb.FnbOutput} class. * @author Agustin Caminero * @since GridSim Toolkit 4.2 + * @see gridsim.net.fnb.FnbOutput */ public class FnbMessageDropFile implements FnbMessage { - int fileID; - String filename; + private int fileID_; + private String filename_; - public FnbMessageDropFile(int e, String f) + /** + * A constructor + * @param fileID a file ID + * @param filename a filename + */ + public FnbMessageDropFile(int fileID, String filename) { - fileID = e; - filename = f; + fileID_ = fileID; + filename_ = filename; } - public void setEntityID(int i) + /** + * Sets a file ID that is being dropped in the network. + * @param fileID a file ID + */ + public void setEntityID(int fileID) { - fileID = i; + fileID_ = fileID; } - + /** + * Gets a file ID + * @return a file ID + */ public int getEntityID() { - return fileID; + return fileID_; } - public void setFilename(String f) + /** + * Sets a filename that is being dropped in the network. + * @param filename a filename + */ + public void setFilename(String filename) { - filename = f; + filename_ = filename; } + /** + * Gets a filename + * @return a filename + */ public String getFilename() { - return filename; + return filename_; } - - + } Modified: trunk/source/gridsim/net/fnb/FnbMessageDropGridlet.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbMessageDropGridlet.java 2008-09-23 11:09:18 UTC (rev 244) +++ trunk/source/gridsim/net/fnb/FnbMessageDropGridlet.java 2008-09-23 11:10:43 UTC (rev 245) @@ -12,32 +12,45 @@ package gridsim.net.fnb; -import gridsim.net.fnb.*; +import gridsim.net.fnb.FnbMessage; /** - * + * This class contains a Gridlet ID, that is currently being + * dropped in the network. + * This class is primarily used by the {@link gridsim.net.fnb.FnbOutput} class. * @author Agustin Caminero * @since GridSim Toolkit 4.2 + * @see gridsim.net.fnb.FnbOutput */ public class FnbMessageDropGridlet implements FnbMessage { - int gridletID; + private int gridletID_; - public FnbMessageDropGridlet (int e) + /** + * A constructor + * @param gridletID a gridlet ID + */ + public FnbMessageDropGridlet (int gridletID) { - gridletID = e; + gridletID_ = gridletID; } - public void setEntityID(int i) + /** + * Sets a gridlet ID that is being dropped in the network. + * @param gridletID a gridlet ID + */ + public void setEntityID(int gridletID) { - gridletID = i; + gridletID_ = gridletID; } - + /** + * Gets a gridlet ID + * @return a gridlet ID + */ public int getEntityID() { - return gridletID; + return gridletID_; } - } Modified: trunk/source/gridsim/net/fnb/FnbWhiteList.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbWhiteList.java 2008-09-23 11:09:18 UTC (rev 244) +++ trunk/source/gridsim/net/fnb/FnbWhiteList.java 2008-09-23 11:10:43 UTC (rev 245) @@ -13,108 +13,132 @@ package gridsim.net.fnb; import java.util.*; -import gridsim.*; +import gridsim.GridSim; + /** - * + * This class stores a (white) list of entity IDs, such that their messages + * are guaranteed not to be dropped in the network. * @author Agustin Caminero * @since GridSim Toolkit 4.2 */ -public class FnbWhiteList +public class FnbWhiteList extends ArrayList { - private ArrayList list_; + /** + * Creates a new object of this class. + */ public FnbWhiteList() { - list_ = new ArrayList(); + super(); } + + /** + * Creates a new object of this class with the specified initial capacity. + * @param initialCapacity the initial capacity of the list + */ + public FnbWhiteList(int initialCapacity) + { + super(initialCapacity); + } - - /**Returns true if the given id is in the list. - * @param id the id of an entity - * @return true if the given id is in the list. - * */ + /** + * Returns <tt>true</tt> if the given id is in the white list. + * @param id an entity id + * @return <tt>true</tt> if the given id is in the white list, + * <tt>false</tt> otherwise. + */ public boolean checkList(int id) { - int id_tmp; - for (int i =0; i<list_.size(); i++) + for (int i = 0; i < super.size(); i++) { - id_tmp = ((Integer)list_.get(i)).intValue(); - + id_tmp = ((Integer) super.get(i)).intValue(); if (id == id_tmp) { - //System.out.println("----- checking : " + GridSim.getEntityName(id) + " TRUE"); + //System.out.println("----- checking : " + + // GridSim.getEntityName(id) + " TRUE"); return true; } } - //System.out.println("----- checking : " + GridSim.getEntityName(id) + " FALSE"); + //System.out.println("----- checking : " + GridSim.getEntityName(id) + // + " FALSE"); return false; - } - - + /** + * Adds this entity ID to the white list. + * Note that this method also adds the IDs of {@link gridsim.net.Input} and + * {@link gridsim.net.Output} ports associated with this entity ID. + * @param id an entity ID + * @return <tt>true</tt> if the entity ID has been added to the white list, + * <tt>false</tt> otherwise. + * @see gridsim.net.Input + * @see gridsim.net.Output + */ public boolean addEntityID(Integer id) { - // We must add not only the entity id, but also the ids of the input/output ports. - - if ( (id == null) || (id.intValue() <= 0) ) + if ( (id == null) || (id.intValue() <= 0) ) { return false; - - if (checkList(id.intValue()) == true) + } + + // check if already exist in the list + if (checkList(id.intValue()) == true) { return false; - + } + String name = GridSim.getEntityName(id); - String input = "Input_" + name; String output = "Output_" + name; int input_id = GridSim.getEntityId(input); int output_id = GridSim.getEntityId(output); - list_.add(id); - list_.add(new Integer(input_id)); - list_.add(new Integer(output_id)); + super.add(id); + super.add(new Integer(input_id)); + super.add(new Integer(output_id)); return true; } - - + /** + * Adds this entity ID to the white list. + * Note that this method also adds the IDs of {@link gridsim.net.Input} and + * {@link gridsim.net.Output} ports associated with this entity ID. + * @param id an entity ID + * @return <tt>true</tt> if the entity ID has been added to the white list, + * <tt>false</tt> otherwise. + * @see gridsim.net.Input + * @see gridsim.net.Output + */ public boolean addEntityID(int id) { - return addEntityID(new Integer (id)); + return addEntityID(new Integer(id)); } - /**Removes the given id of the list. - * @param id the id of an entity, to be removed from the list - * @return true if the entity is removed properly, false otherwise*/ - public boolean removeID(int id) - { - int id_tmp; - for (int i =0; i<list_.size(); i++) - { - id_tmp = ((Integer)list_.get(i)).intValue(); + /** + * Removes the given entity id from the white list. + * @param id the entity id to be removed from the white list + * @return <tt>true</tt> if the entity has been removed successfully, + * <tt>false</tt> otherwise. + */ + public boolean removeID(int id) + { + boolean flag = false; + int id_tmp; + for (int i = 0; i < super.size(); i++) + { + id_tmp = ((Integer) super.get(i)).intValue(); + if (id == id_tmp) + { + super.remove(i); + flag = true; + break; + } + } - if (id == id_tmp) - list_.remove(i); + return flag; + } - } - - return false; - - } - - public int size() - { - return list_.size(); - } - - public Integer get(int i) - { - return (Integer) list_.get(i); - } - } Modified: trunk/source/gridsim/net/fnb/firstLastPacketsGridlet.java =================================================================== --- trunk/source/gridsim/net/fnb/firstLastPacketsGridlet.java 2008-09-23 11:09:18 UTC (rev 244) +++ trunk/source/gridsim/net/fnb/firstLastPacketsGridlet.java 2008-09-23 11:10:43 UTC (rev 245) @@ -4,7 +4,7 @@ * of Parallel and Distributed Systems such as Clusters and Grids * Licence: GPL - http://www.gnu.org/copyleft/gpl.html * - * Author: Agustin Caminero + * Author: Agustin Caminero and Anthony Sulistio * Organization: Universidad de Castilla La Mancha (UCLM), Spain. * Copyright (c) 2008, The University of Melbourne, Australia and * Universidad de Castilla La Mancha (UCLM), Spain @@ -13,62 +13,59 @@ package gridsim.net.fnb; /** - * This class is used to keep the number of packets each gridlet is made of. - * This is neccesary when using finite buffers in routers, as when a packet is dropped, - * we have to know which gridlet each dropped packet belonged to. - * + * This class contains relevant information of a dropped + * {@link gridsim.Gridlet} or {@link gridsim.datagrid.File} object. + * Since a gridlet or a file is broken into many packets according to the + * Maximum Transmission Unit (MTU), this class records the first packet ID, + * the last packet ID, and the Gridlet or File ID. + * This class is mainly used by the {@link gridsim.net.fnb.FnbInput} and + * {@link gridsim.net.fnb.FnbOutput} classes. + * <p> * For example, a gridlet with id = 3 is made of 20 packets, e.g. from * packet id 2 to 21. Then, this class stores the following information: - * the first packet number is 2, the last packet number is 21, and - * the gridlet ID is 3. + * the first packet number is 2, the last packet number is 21, + * the ID is 3, and {@link #isFile()} returns <tt>false</tt>. * - * @author Agustin Caminero + * @author Agustin Caminero and Anthony Sulistio * @since GridSim Toolkit 4.2 + * @see gridsim.net.Link#DEFAULT_MTU + * @see gridsim.Gridlet + * @see gridsim.datagrid.File */ public class firstLastPacketsGridlet { - int firstPacket; // the id of the first packet in a gridlet - int lastPacket; // the id of the last packet in a gridlet - int gridletID; // the gridlet/file id + private int firstPacket; // the id of the first packet in a gridlet + private int lastPacket; // the id of the last packet in a gridlet + private int id_; // the gridlet or file id + private boolean isFile; // whether this class contains a gridlet or a file - boolean isFile; - - /**Creates a new object of this class. This is used in the FnbInput and FnbOutput classes. - * @param first id of the first packet - * @param last id of the last packet - * @param gl the gridlet id - * */ - public void firstLastPacketsGridlet(int first, int last, int gl) + /** + * Creates a new object of this class. + * @param firstPacketID the first packet id + * @param lastPacketID the last packet id + */ + public void firstLastPacketsGridlet(int firstPacketID, int lastPacketID) { - firstPacket = first; - lastPacket = last; - gridletID = gl; - isFile = false; + this.firstPacket = firstPacketID; + this.lastPacket = lastPacketID; + this.id_ = -1; + this.isFile = false; } - - - /** Sets the isFile. - * @param f if this is a file or not + /** + * Determines whether this class stores a file ID or a gridlet ID + * @return <tt>true</tt> this class stores a file ID, <tt>false</tt> otherwise * */ - public void setIsFile(boolean f) + public boolean isFile() { - isFile = f; - } - - /** Gets the isFile. - * @return true is this is a file - * */ - public boolean getIsFile() - { return isFile; } /** Gets the id of the first packet. * @return the id of the first packet * */ - public int getFirst() + public int getFirstPacketID() { return firstPacket; } @@ -76,42 +73,54 @@ /** Gets the id of the last packet. * @return the id of the last packet * */ - public int getLast() + public int getLastPacketID() { return lastPacket; - } + } - - /** Gets the gridlet id - * @return the gridlet id - * */ - public int getGridletID() - { - return gridletID; - } - /** Sets the id of the last packet. - * @param last the id of the last packet. + * @param lastID the id of the last packet. * */ - public void setLast(int last) + public void setLastPacketID(int lastID) { - lastPacket = last; + lastPacket = lastID; } /** Sets the id of the first packet. - * @param first the id of the first packet. + * @param firstID the id of the first packet. * */ - public void setFirst(int first) + public void setFirstPacketID(int firstID) { - firstPacket = first; + firstPacket = firstID; } - /** Sets the id of gridlet. - * @param gl the id of the gridlet + /** Sets the gridlet id. + * @param gridletID the gridlet id * */ - public void setGridletID(int gl) + public void setGridletID(int gridletID) { - gridletID = gl; + id_ = gridletID; + isFile = false; } + + /** Sets the file id. + * @param fileID the file id + */ + public void setFileID(int fileID) + { + id_ = fileID; + this.isFile = true; + } + + /** + * Gets a file or gridlet ID.<br> + * NOTE: If {@link #isFile()} denotes <tt>true</tt>, then it is a file ID, + * <tt>false</tt> otherwise + * @return a file or gridlet ID. + */ + public int getID() + { + return id_; + } } Modified: trunk/source/gridsim/net/fnb/source_pktNum.java =================================================================== --- trunk/source/gridsim/net/fnb/source_pktNum.java 2008-09-23 11:09:18 UTC (rev 244) +++ trunk/source/gridsim/net/fnb/source_pktNum.java 2008-09-23 11:10:43 UTC (rev 245) @@ -12,98 +12,109 @@ package gridsim.net.fnb; -/**This class is used in the FnbInput class, to make sure that - * all the packets of a gridlet arrive at the user/resource. +/** + * This class is used by the {@link gridsim.net.fnb.FnbInput} entity, + * to make sure that all Gridlet packets arrive at the destination. * @author Agustin Caminero * @since GridSim Toolkit 4.2 + * @see gridsim.net.fnb.FnbInput */ - public class source_pktNum { - int source; - int numOfPkts; // how many pkts have arrived yet - int glID; // the id of the gridslet this pkt belongs to - boolean ok; // tells if the current gridlet is fine or not + private int source; + private int numOfPkts; // how many pkts have arrived yet + private int glID; // the id of the gridslet this pkt belongs to + private boolean ok; // tells if the current gridlet is fine or not - /**Creates an object of this class. - * @param s the source - * @param g the gridlet this pkt belongs to - * */ - public source_pktNum(int s, int g) + + /** + * Creates an object of this class. + * @param sourceID the source ID + * @param gridletID the gridlet ID that this packet belongs to + */ + public source_pktNum(int sourceID, int gridletID) { - source = s; + source = sourceID; numOfPkts = 0; - glID = g; + glID = gridletID; ok = false; } - /** Gets the source of the gridlet - * @return source of the gridlet */ - public int getSource() + /** + * Gets the source ID of the gridlet + * @return source ID of the gridlet + */ + public int getSourceID() { return source; } - /** Gets the number of packets already received - * @return number of packets already received */ - public int getNumOfPkts() + /** + * Gets the number of packets already received + * @return number of packets already received + */ + public int getNumOfPacket() { return numOfPkts; } - /** Gets the if the gridlet is ok or not, up to now - * @return true if all the packets of a gridlet have already arrived properly. False otherwise */ - public boolean getOk() + /** + * Checks if the gridlet packets have arrived properly or not. + * @return <tt>true</tt> if all the packets of a gridlet have + * arrived properly, <tt>false</tt> otherwise. + */ + public boolean getStatus() { return ok; } - /**Sets the source parameter - * @param s the source of a gridlet - * */ - public void setSource(int s) + /** Sets the source ID + * @param sourceID the source ID of this gridlet + */ + public void setSourceID(int sourceID) { - source = s; + source = sourceID; } - - /**Sets the ok parameter - * @param o the new ok parameter - * */ - public void setOk(boolean o) + /** Sets the status of the incoming gridlet packets. + * @param status <tt>true</tt> if all the packets of a gridlet have + * arrived properly, <tt>false</tt> otherwise. + */ + public void setStatus(boolean status) { - ok = o; + this.ok = status; } - /**Sets the number of packets - * @param n the number of packets of a gridlet - * */ - public void setNumOfPkts(int n) + /** Sets the number of packets + * @param num the number of packets of a gridlet + */ + public void setNumOfPacket(int num) { - numOfPkts = n; + numOfPkts = num; } - /**Sets the gridlet id - * @param g gridlet id - * */ - public void setGlID(int g) + /** Sets the gridlet id + * @param gridletID gridlet id + */ + public void setGridletID(int gridletID) { - glID = g; + glID = gridletID; } /** Gets the gridlet id - * @return gridlet id */ - public int getGlID() + * @return gridlet id + */ + public int getGridletID() { return glID; } - /**Increases the number of received packets - * */ - public void increaseNumOfArrivedPkts() + /** Adds the number of received packets by 1. */ + public void addNumOfArrivedPkts() { - numOfPkts = numOfPkts +1; + numOfPkts++; } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sul...@us...> - 2008-09-23 11:09:24
|
Revision: 244 http://gridsim.svn.sourceforge.net/gridsim/?rev=244&view=rev Author: sulistio Date: 2008-09-23 11:09:18 +0000 (Tue, 23 Sep 2008) Log Message: ----------- merge this file into FnbOutput.java (as an internal class). Removed Paths: ------------- trunk/source/gridsim/net/fnb/Fnb_FileName_FileMyID.java Deleted: trunk/source/gridsim/net/fnb/Fnb_FileName_FileMyID.java =================================================================== --- trunk/source/gridsim/net/fnb/Fnb_FileName_FileMyID.java 2008-09-21 11:46:26 UTC (rev 243) +++ trunk/source/gridsim/net/fnb/Fnb_FileName_FileMyID.java 2008-09-23 11:09:18 UTC (rev 244) @@ -1,43 +0,0 @@ -/* - * Title: GridSim Toolkit - * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation - * of Parallel and Distributed Systems such as Clusters and Grids - * Licence: GPL - http://www.gnu.org/copyleft/gpl.html - * - * Author: Agustin Caminero - * Organization: Universidad de Castilla La Mancha (UCLM), Spain. - * Copyright (c) 2008, The University of Melbourne, Australia and - * Universidad de Castilla La Mancha (UCLM), Spain - */ - -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. - String filename; - int fileMyID; - - Fnb_FileName_FileMyID(String f, int fid) - { - filename = f; - fileMyID = fid; - - } - - - String getFileName() - { - return filename; - } - - int getFileId() - { - return fileMyID; - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <sul...@us...> - 2008-09-09 08:13:57
|
Revision: 242 http://gridsim.svn.sourceforge.net/gridsim/?rev=242&view=rev Author: sulistio Date: 2008-09-09 08:14:06 +0000 (Tue, 09 Sep 2008) Log Message: ----------- add javadoc comments (was done by Agustin) Modified Paths: -------------- trunk/source/gridsim/net/fnb/ARED.java trunk/source/gridsim/net/fnb/FIFO.java trunk/source/gridsim/net/fnb/FnbEndToEndPath.java trunk/source/gridsim/net/fnb/FnbInput.java trunk/source/gridsim/net/fnb/FnbNetPacket.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/RED.java trunk/source/gridsim/net/fnb/firstLastPacketsGridlet.java Modified: trunk/source/gridsim/net/fnb/ARED.java =================================================================== --- trunk/source/gridsim/net/fnb/ARED.java 2008-09-01 10:04:22 UTC (rev 241) +++ trunk/source/gridsim/net/fnb/ARED.java 2008-09-09 08:14:06 UTC (rev 242) @@ -59,8 +59,12 @@ * @param name Name of this scheduler * @param baudRate baud rate in bits/s of the port that is using * this scheduler. + * @param max_p the maximum dropping probability for an incoming packet * @param max_buf_size maximum buffer size for routers - * @throws ParameterException This happens when the baud rate <= 0 + * @param queue_weight this parameter reflects how important is the last + * measurement of the buffer size on the calculation of the average buffer size + * @param stats whether we want to store stats or not + * @throws Exception This happens when the baud rate <= 0 * @pre baudRate > 0 * @post $none */ @@ -74,7 +78,7 @@ /** * This function updates the value of max_p, which is the maximum dropping * probability for a packet. - * It also updates ALPHA, as it depends on max_p. + * It also updates ALPHA, as it depends on max_p. */ public void updateAREDParameters() { @@ -162,6 +166,7 @@ /** * Sets the baud rate that this scheduler will be sending packets at. * @param rate the baud rate of this scheduler (in bits/s) + * @return true if the baud rate has been set properly * @pre rate > 0 * @post $none */ Modified: trunk/source/gridsim/net/fnb/FIFO.java =================================================================== --- trunk/source/gridsim/net/fnb/FIFO.java 2008-09-01 10:04:22 UTC (rev 241) +++ trunk/source/gridsim/net/fnb/FIFO.java 2008-09-09 08:14:06 UTC (rev 242) @@ -64,7 +64,9 @@ * @param baudRate baud rate in bits/s of the port that is using * this scheduler. * @param max_buf_size maximum buffer size for routers - * @throws ParameterException This happens when the name is null or + * @param queue_weight this parameter reflects how important is the last + * @param stats whether we want to store stats or not + * @throws Exception This happens when the name is null or * the baud rate <= 0 * @pre name != null * @pre baudRate > 0 @@ -112,7 +114,7 @@ checkAndInsertPacketIntoQueue(pnp); /// insert the pkt into the queue //double avgQueueSize = avgQueueSize(); return true; - } + } /** @@ -145,7 +147,7 @@ * We are using the FIFO algorithm. * @param pnp the new incoming packet * */ - public synchronized boolean dropPacketFIFO(Packet pnp) + public synchronized void dropPacketFIFO(Packet pnp) { // If the queue is full, we have to drop a packet, giving priority to the control packets // Control packets will be those packets sent between the broker or the gis. @@ -196,7 +198,7 @@ // super.shutdownUserEntity(); // super.terminateIOEntities(); - return false; + } } @@ -248,13 +250,12 @@ pnp = null; // remove the packet. - return true; - } /** Calculate the avg queue size for the FIFO algorithm. - * */ + * + * @return the average queue size of this queue, which has been calculated in this function*/ public double avgQueueSize() { @@ -330,6 +331,7 @@ /** * Sets the baud rate that this scheduler will be sending packets at. * @param rate the baud rate of this scheduler (in bits/s) + * @return true if the baud rate has been set properly * @pre rate > 0 * @post $none */ @@ -345,7 +347,8 @@ return true; } - /** Returns the avg buffer size*/ + /** Returns the avg buffer size + * @return the average queue size, which was already calculated*/ public double getAvg() { return AVG; Modified: trunk/source/gridsim/net/fnb/FnbEndToEndPath.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbEndToEndPath.java 2008-09-01 10:04:22 UTC (rev 241) +++ trunk/source/gridsim/net/fnb/FnbEndToEndPath.java 2008-09-09 08:14:06 UTC (rev 242) @@ -43,8 +43,8 @@ /**Creates a new object of this class. Tihs is used in the FnbOutput class. * @param destID destination id - * @param sourceID source id - * @param classType network service level + * @param srcID source id + * @param classtype network service level * @param totalPkts total number of packets this connection is made of * @param glID the gridlet/file id * */ @@ -63,10 +63,9 @@ /**Creates a new object of this class. Tihs is used in the FnbOutput class. * @param destID destination id - * @param sourceID source id - * @param classType network service level + * @param srcID source id + * @param classtype network service level * @param totalPkts total number of packets this connection is made of - * @param glID the gridlet id * */ public FnbEndToEndPath(int destID, int srcID, int classtype, int totalPkts) { Modified: trunk/source/gridsim/net/fnb/FnbInput.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbInput.java 2008-09-01 10:04:22 UTC (rev 241) +++ trunk/source/gridsim/net/fnb/FnbInput.java 2008-09-09 08:14:06 UTC (rev 242) @@ -442,7 +442,6 @@ /** * Look for a especific source_pktNum object in the source_PktNum_array * @param src the source of the packet - * @param pktID the unique id of a packet * @param glID the id of the girdlet this packet belongs to. * @return a source_pktNum object whose source is src, null otherwise * */ @@ -465,7 +464,6 @@ /** * Look for a especific source_pktNum object in the source_PktNum_array * @param src the source of the packet - * @return a source_pktNum object whose source is src, null otherwise * */ public void removeFromSrcPktNum(int src) { Modified: trunk/source/gridsim/net/fnb/FnbNetPacket.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbNetPacket.java 2008-09-01 10:04:22 UTC (rev 241) +++ trunk/source/gridsim/net/fnb/FnbNetPacket.java 2008-09-09 08:14:06 UTC (rev 242) @@ -57,7 +57,6 @@ * @param tag The original tag which was used with the data, its * reapplied when the data is extracted from the NetPacket. * @param srcID The id of the entity where the packet was created. - * @param destID The destination to which the packet has to be sent. * @pre $none * @post $none */ @@ -88,13 +87,8 @@ * @param tag The original tag which was used with the data, its * reapplied when the data is extracted from the NetPacket. * @param srcID The id of the entity where the packet was created. - * @param destID The destination to which the packet has to be sent. - * @param netServiceType the network class type of this packet * @param pktNum The packet number of this packet in its series. If there * are 10 packets, they should be numbered from 1 to 10. - * @param totalPkts The total number of packets that the original data was - * split into. This is used by the receiver to confirm that - * all packets have been received. * @pre $none * @post $none */ @@ -323,13 +317,15 @@ return conn.getTotalPkts(); } - /** Establishes the end to end path to another entity */ + /** Establishes the end to end path to another entity + * @param c new FnbEndToEndPath */ public void setPath(FnbEndToEndPath c) { conn = c; } - /**Returns the gridlet/file to which this packet belongs*/ + /**Returns the gridlet/file to which this packet belongs + * @return the gridlet/file to which this packet belongs*/ public int getObjectID() { return conn.getObjectID(); Modified: trunk/source/gridsim/net/fnb/FnbNetworkReader.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbNetworkReader.java 2008-09-01 10:04:22 UTC (rev 241) +++ trunk/source/gridsim/net/fnb/FnbNetworkReader.java 2008-09-09 08:14:06 UTC (rev 242) @@ -64,6 +64,7 @@ * @param max_th maximum threshold for RED * @param max_p maximum drop probability for RED * @param queue_weight queue weight for RED + * @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 Modified: trunk/source/gridsim/net/fnb/FnbOutput.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbOutput.java 2008-09-01 10:04:22 UTC (rev 241) +++ trunk/source/gridsim/net/fnb/FnbOutput.java 2008-09-09 08:14:06 UTC (rev 242) @@ -701,7 +701,9 @@ pktID_++; // increments packet ID } - /**Returns the my_id of the file. */ + /**Returns the my_id of the file. + * @param fname the name of the file + * @return the my_id of the file*/ int checkFilename(String fname) { Fnb_FileName_FileMyID fname_fid; @@ -726,7 +728,9 @@ return last_fileID + 1; } - /**Returns the file name of the file with the given my_id*/ + /**Returns the file name of the file with the given my_id + * @param fileID the id of the file + * @return the name of the file*/ String getFilename(int fileID) { Fnb_FileName_FileMyID fname_fid; @@ -759,8 +763,7 @@ * @param size packet size (in bytes) * @param numPackets total number of packets to be created * @param tag packet tag - * @param destId destination ID for sending the packet - * @param netServiceType level type of service for the packet + * @param conn a FnbEndToEndPath defining the end points of the transmission * @pre $none * @post $none */ @@ -1013,7 +1016,7 @@ } /**This function returns the entity (gridlet/file) to which a packet belongs - * @param pkt the ID of the packet of interest + * @param pktID the ID of the packet of interest * @return a FnbMessage object * */ FnbMessage lookForEntity(int pktID) Modified: trunk/source/gridsim/net/fnb/FnbRIPRouter.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbRIPRouter.java 2008-09-01 10:04:22 UTC (rev 241) +++ trunk/source/gridsim/net/fnb/FnbRIPRouter.java 2008-09-09 08:14:06 UTC (rev 242) @@ -34,7 +34,7 @@ * * @invariant $none * @author Agustin Caminero, University of Castilla La Mancha, Spain. - * Based on class RIPRouter, by Gokul Poduval & Chen-Khong Tham, + * Based on class RIPRouter, by Gokul Poduval & Chen-Khong Tham, * National University of Singapore. * Things added or modified: * private int my_id_; @@ -60,11 +60,11 @@ private Hashtable routerTable; private Hashtable forwardTable; private int id; - private final int BITS = 8; // 1 byte in bits + private final int BITS = 8; // 1 byte in bits private int my_id_; // for a router named "router0", its my_id will be 0 - private final int MIN = 60; // 1 minute in seconds + private final int MIN = 60; // 1 minute in seconds private final double INTERVAL = 2 * MIN; // the interval to update (reset) the packet counters @@ -73,41 +73,44 @@ private boolean storeStats; /** - * 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)}. - * - * @param name Name of this router - * @throws NullPointerException This happens when name is empty or null - * @see #FnbRIPRouter(String, boolean) - * @pre name != null - * @post $none - */ - public FnbRIPRouter(String name, int my_id) throws NullPointerException - { - this(name, false, my_id); - storeStats = false; - } + * 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)}. + * + * @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) + * @pre name != null + * @post $none + */ + public FnbRIPRouter(String name, int my_id) throws NullPointerException + { + this(name, false, my_id); + storeStats = false; + } - /** - * Creates a new FnbRIPRouter object with logging facility if it is turned on. - * <br> - * NOTE: If logging facility is turned on, there are some overheads - * in terms of performance and memory consumption. - * - * @param name Name of this router - * @param trace <tt>true</tt> if you want to record this router's - * activity, <tt>false</tt> otherwise - * @throws NullPointerException This happens when name is empty or null - * @pre name != null - * @post $none - */ - public FnbRIPRouter(String name, boolean trace, int my_id) throws NullPointerException - { - super(name, trace); - my_id_ = my_id; - storeStats = false; - init(); + /** + * Creates a new FnbRIPRouter object with logging facility if it is turned on. + * <br> + * NOTE: If logging facility is turned on, there are some overheads + * in terms of performance and memory consumption. + * + * @param name Name of this router + * @param trace <tt>true</tt> if you want to record this router's + * activity, <tt>false</tt> otherwise + * @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 + * @pre name != null + * @post $none + */ + public FnbRIPRouter(String name, boolean trace, int my_id) throws + NullPointerException + { + super(name, trace); + my_id_ = my_id; + storeStats = false; + init(); } /** @@ -123,7 +126,8 @@ * @pre name != null * @post $none */ - public FnbRIPRouter(String name, int my_id, boolean stats) throws NullPointerException + public FnbRIPRouter(String name, int my_id, boolean stats) throws + NullPointerException { this(name, false, my_id); storeStats = stats; @@ -144,7 +148,8 @@ * @pre name != null * @post $none */ - public FnbRIPRouter(String name, boolean trace, int my_id, boolean stats) throws NullPointerException + public FnbRIPRouter(String name, boolean trace, int my_id, boolean stats) throws + NullPointerException { super(name, trace); my_id_ = my_id; @@ -190,7 +195,8 @@ * @post $none */ public void attachRouter(FnbRouter router, Link link, - PacketScheduler thisSched, PacketScheduler otherSched) + PacketScheduler thisSched, + PacketScheduler otherSched) { String msg = super.get_name() + ".attachRouter(): Error - "; if (router == null) @@ -208,12 +214,12 @@ if (thisSched == null || otherSched == null) { System.out.println(msg + - "the one or more packet schedulers are null."); + "the one or more packet schedulers are null."); return; } - thisSched.setBaudRate( link.getBaudRate() ); - otherSched.setBaudRate( link.getBaudRate() ); + thisSched.setBaudRate(link.getBaudRate()); + otherSched.setBaudRate(link.getBaudRate()); link.attach(this, router); this.attachRouter(router, link, thisSched); @@ -233,7 +239,8 @@ * @pre sched != null * @post $none */ - protected void attachRouter(FnbRouter router, Link link, PacketScheduler sched) + protected void attachRouter(FnbRouter router, Link link, + PacketScheduler sched) { String msg = super.get_name() + ".attachRouter(): Error - "; if (router == null) @@ -256,25 +263,26 @@ linkTable.put(router.get_name(), link.get_name()); - if (!schedTable.containsKey( link.get_name()) ) { + if (!schedTable.containsKey(link.get_name())) + { schedTable.put(link.get_name(), sched); } - routerTable.put( link.get_name(), router.get_name() ); - hostTable.put( link.get_name(), router.get_name() ); + routerTable.put(link.get_name(), router.get_name()); + hostTable.put(link.get_name(), router.get_name()); // logging or recording ... if (reportWriter_ != null) { StringBuffer sb = null; sb = new StringBuffer("attach this ROUTER, with router, "); - sb.append( router.get_name() ); + sb.append(router.get_name()); sb.append(", with link, "); - sb.append( link.get_name() ); + sb.append(link.get_name()); sb.append(", with packet scheduler, "); - sb.append( sched.getSchedName() ); + sb.append(sched.getSchedName()); - super.write( sb.toString() ); + super.write(sb.toString()); } } @@ -308,26 +316,27 @@ } Link link = entity.getLink(); - sched.setBaudRate( link.getBaudRate() ); + sched.setBaudRate(link.getBaudRate()); link.attach(this, entity); - linkTable.put( entity.get_name(), link.get_name() ); + linkTable.put(entity.get_name(), link.get_name()); - if (!schedTable.containsKey( link.get_name() )) { + if (!schedTable.containsKey(link.get_name())) + { schedTable.put(link.get_name(), sched); } - hostTable.put( link.get_name(), entity.get_name() ); + hostTable.put(link.get_name(), entity.get_name()); // recording ... if (reportWriter_ != null) { StringBuffer sb = null; sb = new StringBuffer("attach this ROUTER, to entity, "); - sb.append( entity.get_name() ); + sb.append(entity.get_name()); sb.append(", with packet scheduler, "); - sb.append( sched.getSchedName() ); + sb.append(sched.getSchedName()); - super.write( sb.toString() ); + super.write(sb.toString()); } } @@ -339,7 +348,7 @@ */ protected synchronized void processEvent(Sim_event ev) { - switch ( ev.get_tag() ) + switch (ev.get_tag()) { case GridSimTags.PKT_FORWARD: case GridSimTags.JUNK_PKT: @@ -358,14 +367,14 @@ processEndOfSimulation(ev); break; - case GridSimTags.FNB_UPDATE_ARED_PARAMETERS: - updateAREDParameters(); - break; + case GridSimTags.FNB_UPDATE_ARED_PARAMETERS: + updateAREDParameters(); + break; default: System.out.println(super.get_name() + ".body(): Unable to " + - "handle request from GridSimTags " + - "with constant number " + ev.get_tag() ); + "handle request from GridSimTags " + + "with constant number " + ev.get_tag()); break; } } @@ -399,7 +408,8 @@ { ((RED) sched).updateStats(); } - }else + } + else { if (storeStats) { @@ -410,7 +420,6 @@ } //for (Enumeration e = schedTable.keys(); e.hasMoreElements(); ) - super.sim_schedule(super.get_id(), GridSimTags.SCHEDULE_NOW + GridSimTags.FNB_UPDATE_ARED_PARAMETERS_PERIOD, @@ -418,23 +427,24 @@ } - /**At the end of simulations, write the counters into files.*/ + /**At the end of simulations, write the counters into files. + * @param ev an event*/ private void processEndOfSimulation(Sim_event ev) { - processCountDroppedPkts(ev); + processCountDroppedPkts(ev); - } /** * This event is used to write in a file the current number of packets - * dropped at the schedulers of this router*/ + * dropped at the schedulers of this router + * @param ev an event*/ private void processCountDroppedPkts(Sim_event ev) { /*System.out.println(super.get_name() + - ": COUNT_DROPPED_PKTS event arrived. Clock: " + - GridSim.clock() + "Next event will be in (delay) " + + ": COUNT_DROPPED_PKTS event arrived. Clock: " + + GridSim.clock() + "Next event will be in (delay) " + (GridSimTags.SCHEDULE_NOW + 3600));*/ double clock = GridSim.clock(); @@ -444,7 +454,7 @@ if (clock > nextInterval_dropped) { FnbSCFQScheduler sched = null; - double droppedPktsCounter; + double droppedPktsCounter; for (Enumeration e = schedTable.keys(); e.hasMoreElements(); ) { link = (String) e.nextElement(); @@ -474,15 +484,17 @@ nextInterval_dropped = GridSim.clock() + INTERVAL; - }// if (clock > nextInterval_dropped) + } // if (clock > nextInterval_dropped) } + /** * Processes incoming network packets, one at a time. * The incoming packet will be split up into smaller pieces if * the packet size > MTU of the other end. * * @param ev a Sim_event object + * @param tag tag of the event * @pre ev != null * @post $none */ @@ -499,12 +511,12 @@ if (pkt instanceof InfoPacket) { ((InfoPacket) pkt).addHop(id); - ((InfoPacket) pkt).addEntryTime( GridSim.clock() ); + ((InfoPacket) pkt).addEntryTime(GridSim.clock()); ((InfoPacket) pkt).addBaudRate(sched.getBaudRate()); } // check downlink MTU, and split accordingly - String linkName = getLinkName( pkt.getDestID() ); + String linkName = getLinkName(pkt.getDestID()); Link downLink = (Link) Sim_system.get_entity(linkName); int MTU = downLink.getMTU(); int numPackets = (int) Math.ceil(pkt.getSize() / (MTU * 1.0)); @@ -512,10 +524,12 @@ // if no packets at the moment if (sched.size() == 0) { - if (numPackets == 1) { + if (numPackets == 1) + { nextTime = (pkt.getSize() * BITS) / sched.getBaudRate(); } - else { + else + { nextTime = (MTU * BITS * 1.0) / sched.getBaudRate(); } @@ -539,14 +553,15 @@ if (pkt instanceof FnbNetPacket) { conn = new FnbEndToEndPath(pkt.getDestID(), pkt.getSrcID(), - pkt.getNetServiceType(), - numPackets, ((FnbNetPacket) pkt).getObjectID()); + pkt.getNetServiceType(), + numPackets, + ((FnbNetPacket) pkt).getObjectID()); } else { conn = new FnbEndToEndPath(pkt.getDestID(), pkt.getSrcID(), - pkt.getNetServiceType(), - numPackets); + pkt.getNetServiceType(), + numPackets); } np = new FnbNetPacket(null, pkt.getID(), MTU, tag, @@ -556,14 +571,14 @@ np.setLast(id); super.write("enqueing, " + np); - sched.enque(np); // put the packet into the scheduler + sched.enque(np); // put the packet into the scheduler } // put the actual packet into the last one and resize it accordingly pkt.setLast(id); pkt.setSize(pkt.getSize() - MTU * (numPackets - 1)); super.write("enqueing, " + pkt); - sched.enque(pkt); // put the packet into the scheduler + sched.enque(pkt); // put the packet into the scheduler } /** @@ -579,8 +594,9 @@ String linkName = null; //directly connected - if (hostTable.containsValue(destName)) { - linkName = (String)linkTable.get(destName); + if (hostTable.containsValue(destName)) + { + linkName = (String) linkTable.get(destName); } else { @@ -603,11 +619,12 @@ */ public PacketScheduler getScheduler(Packet np) { - if (np == null) { + if (np == null) + { return null; } - String destName = GridSim.getEntityName( np.getDestID() ); + String destName = GridSim.getEntityName(np.getDestID()); return getScheduler(destName); } @@ -623,7 +640,8 @@ */ public PacketScheduler getScheduler(int dest) { - if (dest < 0) { + if (dest < 0) + { return null; } @@ -644,12 +662,13 @@ */ public PacketScheduler getScheduler(String dest) { - if (dest == null || dest.length() == 0) { + if (dest == null || dest.length() == 0) + { return null; } PacketScheduler sched = null; - if ( hostTable.containsValue(dest) ) + if (hostTable.containsValue(dest)) { String linkName = (String) linkTable.get(dest); sched = (PacketScheduler) schedTable.get(linkName); @@ -730,7 +749,8 @@ */ private synchronized boolean sendInternalEvent(double time, Object data) { - if (time < 0.0) { + if (time < 0.0) + { return false; } @@ -759,9 +779,9 @@ for (Enumeration e = forwardTable.keys(); e.hasMoreElements(); ) { - String host = (String)e.nextElement(); - Object[] data = (Object[])forwardTable.get(host); - String nextHop = (String)data[0]; + String host = (String) e.nextElement(); + Object[] data = (Object[]) forwardTable.get(host); + String nextHop = (String) data[0]; System.out.println(host + "\t\t" + nextHop); } @@ -771,10 +791,11 @@ } /** - * Returns the my_id_ of this router - * @pre $none - * @post $none - */ + * Returns the my_id_ of this router + * @pre $none + * @post $none + * @return the my_id_ of he entity + */ public int get_my_id() { @@ -793,7 +814,7 @@ Collection hosts = hostTable.values(); // who to advertise Enumeration routers = routerTable.elements(); - while ( routers.hasMoreElements() ) + while (routers.hasMoreElements()) { RIPAdPack ad = new RIPAdPack(super.get_name(), hosts); String router = (String) routers.nextElement(); @@ -802,7 +823,7 @@ GridSimTags.SCHEDULE_NOW, GridSimTags.ROUTER_AD, ad); } - super.sim_pause(5); // wait for 5 secs to gather the results + super.sim_pause(5); // wait for 5 secs to gather the results } /** @@ -815,46 +836,51 @@ */ private synchronized void receiveAd(Sim_event ev) { - super.write("receive router ad from, "+GridSim.getEntityName(ev.get_src())); + super.write("receive router ad from, " + + GridSim.getEntityName(ev.get_src())); // what to do when an ad is received - RIPAdPack ad = (RIPAdPack)ev.get_data(); + RIPAdPack ad = (RIPAdPack) ev.get_data(); // prevent count-to-infinity if (ad.getHopCount() > 15) { - return ; + return; } String sender = ad.getSender(); Iterator it = ad.getHosts().iterator(); - while ( it.hasNext() ) + while (it.hasNext()) { String host = (String) it.next(); - if ( host.equals(super.get_name()) ) { + if (host.equals(super.get_name())) + { continue; } - if (hostTable.containsValue(host)) { // direct connection + if (hostTable.containsValue(host)) + { // direct connection continue; } if (forwardTable.containsKey(host)) { - Object[] data = (Object[])forwardTable.get(host); - int hop = ((Integer)data[1]).intValue(); + Object[] data = (Object[]) forwardTable.get(host); + int hop = ((Integer) data[1]).intValue(); if ((hop) > ad.getHopCount()) { - Object[] toPut = { sender, new Integer(ad.getHopCount()) }; + Object[] toPut = + {sender, new Integer(ad.getHopCount())}; forwardTable.put(host, toPut); } } else { - Object[] toPut = { sender, new Integer(ad.getHopCount()) }; + Object[] toPut = + {sender, new Integer(ad.getHopCount())}; forwardTable.put(host, toPut); } } @@ -874,59 +900,60 @@ { String sender = ad.getSender(); ad.incrementHopCount(); - RIPAdPack newad = new RIPAdPack(super.get_name(),ad.getHosts()); + RIPAdPack newad = new RIPAdPack(super.get_name(), ad.getHosts()); newad.setHopCount(ad.getHopCount()); Enumeration routers = routerTable.elements(); - while ( routers.hasMoreElements() ) + while (routers.hasMoreElements()) { - String router = (String)routers.nextElement(); + String router = (String) routers.nextElement(); if (!router.equals(sender)) { sim_schedule(Sim_system.get_entity_id(router), - GridSimTags.SCHEDULE_NOW, GridSimTags.ROUTER_AD, newad); + GridSimTags.SCHEDULE_NOW, GridSimTags.ROUTER_AD, + newad); } } } /** - * 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; + * 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 - { - 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); + } + } } // end class Modified: trunk/source/gridsim/net/fnb/FnbRouter.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbRouter.java 2008-09-01 10:04:22 UTC (rev 241) +++ trunk/source/gridsim/net/fnb/FnbRouter.java 2008-09-09 08:14:06 UTC (rev 242) @@ -52,7 +52,7 @@ * * @invariant $none * @author Agustin Caminero, University of Castilla La Mancha, Spain. - * Based on class Router, by Gokul Poduval & Chen-Khong Tham, + * Based on class Router, by Gokul Poduval & Chen-Khong Tham, * National University of Singapore. * Functions added or modified: * - get_my_id() @@ -233,6 +233,7 @@ * Returns the my_id_ of this router * @pre $none * @post $none + * @return the my_id_ of he entity */ public abstract int get_my_id(); Modified: trunk/source/gridsim/net/fnb/FnbSCFQScheduler.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbSCFQScheduler.java 2008-09-01 10:04:22 UTC (rev 241) +++ trunk/source/gridsim/net/fnb/FnbSCFQScheduler.java 2008-09-09 08:14:06 UTC (rev 242) @@ -103,7 +103,8 @@ * @param baudRate baud rate in bits/s of the port that is using * this scheduler. * @param max_buf_size maximum buffer size for routers - * @throws ParameterException This happens when the name is null or + * @param stats whether we want to store stats or not + * @throws Exception This happens when the name is null or * the baud rate <= 0 * @pre name != null * @pre baudRate > 0 @@ -142,7 +143,8 @@ * @param baudRate baud rate in bits/s of the port that is using * this scheduler. * @param max_buf_size maximum buffer size for routers - * @throws ParameterException This happens when the baud rate <= 0 + * @param stats whether we want to store stats or not + * @throws Exception This happens when the baud rate <= 0 * @pre baudRate > 0 * @post $none */ @@ -172,7 +174,8 @@ * * @param name Name of this scheduler * @param max_buf_size maximum buffer size for routers - * @throws ParameterException This happens when the name is null + * @param stats whether we want to store stats or not + * @throws Exception This happens when the name is null * @see gridsim.net.PacketScheduler#setBaudRate(double) * @pre name != null * @post $none @@ -202,7 +205,8 @@ * The baud rate is left at 0, and should be set with * {@link gridsim.net.PacketScheduler#setBaudRate(double)} * before the simulation starts. - * @throws ParameterException This happens when the name is null + * @param stats whether we want to store stats or not + * @throws Exception This happens when the name is null * @see gridsim.net.PacketScheduler#setBaudRate(double) * @pre $none * @post $none @@ -230,7 +234,7 @@ * @param baudRate baud rate in bits/s of the port that is using * this scheduler. * @param max_buf_size maximum buffer size for routers - * @throws ParameterException This happens when the baud rate <= 0 + * @throws Exception This happens when the baud rate <= 0 * @pre baudRate > 0 * @post $none */ @@ -260,7 +264,7 @@ * * @param name Name of this scheduler * @param max_buf_size maximum buffer size for routers - * @throws ParameterException This happens when the name is null + * @throws Exception This happens when the name is null * @see gridsim.net.PacketScheduler#setBaudRate(double) * @pre name != null * @post $none @@ -370,6 +374,7 @@ * @pre np != null * @pre nextTime >= 0 * @post $none + * @return finish time for the network paket */ private double calculateFinishTime(Packet np, double nextTime) { @@ -513,7 +518,8 @@ return p; } - /**Returns the size of the pkt list.*/ + /**Returns the size of the pkt list. + * @return size of the list of packets*/ public double pktListSize() { return pktList.size(); @@ -576,6 +582,7 @@ * @param rate the baud rate of this scheduler (in bits/s) * @pre rate > 0 * @post $none + * @return true if the baud rate has been set properly, false otherwise */ public boolean setBaudRateSCFQ(double rate) { @@ -789,7 +796,8 @@ } /** - * Returns the DROPPED_PKTS_COUNTER */ + * Returns the DROPPED_PKTS_COUNTER + * @return the counter of dropped packets*/ public double getCounterDroppedPkts() { return DROPPED_PKTS_COUNTER; @@ -805,6 +813,7 @@ /**This function returns maximum buffer size, up to this moment along the experiment. * This is not the max allowed buffer size in pkts. + * @return the maximum buffer size, up this moment * */ double getMaxBufferSize() { @@ -812,7 +821,7 @@ } /**This function returns the max buffer size in pkts. - * */ + * @return the maximum number of packets that fit into this buffer*/ double getMaxBufferSizeInPkts() { return MAX_BUFF_SIZE_PK; @@ -822,7 +831,7 @@ /**This function sets the maximum buffer size - * */ + * @param maxSize the new maximum buffer size */ void setMaxBufferSize(int maxSize) { maxBufferSize = maxSize; @@ -884,7 +893,8 @@ } } - /** Returns the avg buffer size*/ + /** Returns the avg buffer size + * @return the avg buffer size */ public abstract double getAvg(); @@ -900,6 +910,8 @@ /**Checks if there is an existing gridletID_userID in the droppedGl_user array. * We consider gridlets, datagridlets and files + * @param gl the gridlet + * @param user user to which the gridlet belongs * @return true, if there is a gridletID_userID object, false otherwise */ public boolean checkDroppedGlList(int gl, int user) { Modified: trunk/source/gridsim/net/fnb/FnbWhiteList.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbWhiteList.java 2008-09-01 10:04:22 UTC (rev 241) +++ trunk/source/gridsim/net/fnb/FnbWhiteList.java 2008-09-09 08:14:06 UTC (rev 242) @@ -26,7 +26,10 @@ } - /**Returns true if the given id is in the list.*/ + /**Returns true if the given id is in the list. + * @param id the id of an entity + * @return true if the given id is in the list. + * */ public boolean checkList(int id) { @@ -81,7 +84,9 @@ return addEntityID(new Integer (id)); } - /**Removes the given id of the list.*/ + /**Removes the given id of the list. + * @param id the id of an entity, to be removed from the list + * @return true if the entity is removed properly, false otherwise*/ public boolean removeID(int id) { int id_tmp; Modified: trunk/source/gridsim/net/fnb/RED.java =================================================================== --- trunk/source/gridsim/net/fnb/RED.java 2008-09-01 10:04:22 UTC (rev 241) +++ trunk/source/gridsim/net/fnb/RED.java 2008-09-09 08:14:06 UTC (rev 242) @@ -68,13 +68,12 @@ * @param baudRate baud rate in bits/s of the port that is using * this scheduler. * @param max_buf_size maximum buffer size for routers - * @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 queue_weigth queue weight for RED * @param storeStats whether we want to store stats or not - * @throws ParameterException This happens when the name is null or + * @throws Exception This happens when the name is null or * the baud rate <= 0 * @pre name != null * @pre baudRate > 0 @@ -202,7 +201,7 @@ * We are using the RED algorithm. * @param pnp the new incoming packet * */ - public synchronized boolean dropPacket(Packet pnp) + public synchronized void dropPacket(Packet pnp) { increaseDroppedPktCounter(); // increase the counter of dropped packets @@ -263,7 +262,7 @@ // If we have been able of dropping a data packet, then we have room for this control packet insertPacketIntoQueue(pnp); - return true; + //return true; } else { @@ -282,7 +281,7 @@ // super.shutdownUserEntity(); // super.terminateIOEntities(); - return false; + //return false; } } @@ -422,12 +421,12 @@ } - return true; + //return true; } /** Calculate the avg queue size for the RED algorithm. - * */ + * @return the avg queue size, which is calculated in this method */ public double avgQueueSize() { @@ -540,6 +539,7 @@ * @param rate the baud rate of this scheduler (in bits/s) * @pre rate > 0 * @post $none + * @return true if the baud rate has been set properly, false otherwise */ public boolean setBaudRate(double rate) { @@ -564,53 +564,62 @@ this.getSchedName() + "_Buffers"); } - /** Returns the avg buffer size*/ + /** Returns the avg buffer size + * @return the avg buffer size */ public double getAvg() { return AVG; } - /** Returns the max_p */ + /** Returns the max_p + * @return the maximum dropping probability */ public double getMaxP() { return MAX_P; } - /** Updates the vaule of MAX_P*/ + /** Updates the vaule of MAX_P + * @param m new value for the maximum dropping probability */ public void setMaxP(double m) { MAX_P = m; } - /** Returns the min_threshold*/ + /** Returns the min_threshold + * @return the minimum threshold*/ public double getMinTh() { return MIN_TH; } - /** Returns the max_threshold*/ + /** Returns the max_threshold + * @return the maximum threshold*/ public double getMaxTh() { return MAX_TH; } + /**Updates the value QUEUE_WEIGHT + * @param q new queue weight */ public void setQueueWeight(double q) { QUEUE_WEIGHT = q; } - /** Updates the vaule of MIN_TH*/ + /** Updates the value of MIN_TH + * @param m new minimum threshold*/ public void setMinTh(double m) { MIN_TH = m; } - /** Updates the vaule of MAX_TH*/ + /** Updates the value of MAX_TH + * @param m new maximum threshold*/ public void setMaxTh(double m) { MAX_TH = m; Modified: trunk/source/gridsim/net/fnb/firstLastPacketsGridlet.java =================================================================== --- trunk/source/gridsim/net/fnb/firstLastPacketsGridlet.java 2008-09-01 10:04:22 UTC (rev 241) +++ trunk/source/gridsim/net/fnb/firstLastPacketsGridlet.java 2008-09-09 08:14:06 UTC (rev 242) @@ -50,6 +50,7 @@ /** Sets the isFile. + * @param f if this is a file or not * */ public void setIsFile(boolean f) { @@ -98,7 +99,7 @@ } /** Sets the id of the first packet. - * @param last the id of the first packet. + * @param first the id of the first packet. * */ public void setFirst(int first) { @@ -106,7 +107,7 @@ } /** Sets the id of gridlet. - * @param last the id of gridlet. + * @param gl the id of the gridlet * */ public void setGridletID(int gl) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sul...@us...> - 2008-09-01 10:04:16
|
Revision: 241 http://gridsim.svn.sourceforge.net/gridsim/?rev=241&view=rev Author: sulistio Date: 2008-09-01 10:04:22 +0000 (Mon, 01 Sep 2008) Log Message: ----------- add this file to gridsim.net.fnb package Added Paths: ----------- trunk/source/gridsim/net/fnb/FnbNetworkReader.java Added: trunk/source/gridsim/net/fnb/FnbNetworkReader.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbNetworkReader.java (rev 0) +++ trunk/source/gridsim/net/fnb/FnbNetworkReader.java 2008-09-01 10:04:22 UTC (rev 241) @@ -0,0 +1,356 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Author: Agustin Caminero + * Organization: Universidad de Castilla La Mancha (UCLM), Spain. + * Copyright (c) 2008, The University of Melbourne, Australia and + * Universidad de Castilla La Mancha (UCLM), Spain + */ + +// NOTE: this class is similar to NetworkReader.java -- perhaps modify the original one? +package gridsim.net.fnb; + +import gridsim.net.fnb.*; +import gridsim.net.*; +import java.util.*; +import java.io.*; +import gridsim.*; + +/** + * This is an utility class, which parses a file and constructs the + * network topology automatically. <br> + * The file that defines the network has the following form: <br> <br> + * <tt> + * # specify the number of routers<br> + * number_of_routers<br> + * <br> + * # specify the name of each router and (optional) logging facility<br> + * router_name1 [true/false]<br> + * router_name2 [true/false]<br> + * router_name3 [true/false]<br> + * ... // other router names<br> + * <br> + * # linking two routers. NOTE: the router name is case sensitive!<br> + * router_name1 router_name2 baud_rate(GB/s) prop_delay(ms) mtu(byte) <br> + * router_name1 router_name3 baud_rate(GB/s) prop_delay(ms) mtu(byte) <br> + * ... // linking other routers<br> + * </tt> + * <br> + * NOTE: <tt>[]</tt> means an optional parameter for logging activities + * inside a router. + * If it is not given, then by default the value is false. + * + * Things added or modifyed: + * - createNetworkSCFQ(...) + * - Use finiteBufferSCFQScheduler instead of SCFQScheduler + * + * @author Agustin Caminero, Universidad de Castilla La Mancha (Spain). + * Based on NetworkReader class, by Uros Cibej and Anthony Sulistio. + */ +public class FnbNetworkReader +{ + /** + * Creates a network topology that uses a SCFQ packet scheduler + * @param filename the name of the file containing the description of + * the network topology + * @param weight a linear array of the weights to be assigned to + * different classes of traffic. + * @param max_buf_size maximum buffer size for routers + * @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 + * @return the list of finiteBufferRouters of the network or <tt>null</tt> if an error + * occurs + * @see gridsim.net.finiteBufferSCFQScheduler + */ + public static LinkedList createSCFQ(String filename, double[] weight, + int max_buf_size, int drop_alg, + int min_th, int max_th, double max_p, + double queue_weight, boolean stats) + { + if (weight == null) + { + return null; + } + + LinkedList routerList = null; + try + { + FileReader fileReader = new FileReader(filename); + BufferedReader buffer = new BufferedReader(fileReader); + + routerList = createNetworkSCFQ(buffer, weight, max_buf_size, + drop_alg, min_th, max_th, max_p, + queue_weight, stats); + } + catch (Exception exp) + { + System.out.println("NetworkReader: File not found or " + + "weight[] is null."); + routerList = null; + } + + return routerList; + } + + + + /** + * Gets a finiteBufferRouter object from the list + * @param name a router name + * @param routerList a list containing the finiteBufferRouter objects + * @return a finiteBufferRouter object or <tt>null</tt> if not found + */ + public static FnbRouter getRouter(String name, LinkedList routerList) + { + if (name == null || routerList == null || name.length() == 0) { + return null; + } + + FnbRouter router = null; + try + { + Iterator it = routerList.iterator(); + while ( it.hasNext() ) + { + router = (FnbRouter) it.next(); + if (router.get_name().equals(name) == true) { + break; + } + else { + router = null; + } + } + } + catch (Exception e) { + router = null; + } + + return router; + } + + /** + * 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 + * @return a list of FnbRouter objects or <tt>null</tt> if an error occurs + */ + private static LinkedList createRouter(BufferedReader buf, + boolean rate) throws Exception + { + String line = null; + StringTokenizer str = null; + int num_router = -1; // num of routers + + // parse each line + while ((line = buf.readLine()) != null) + { + str = new StringTokenizer(line); + if (str.hasMoreTokens() == false) { // ignore newlines + continue; + } + + String num = str.nextToken(); // get next token + if (num.startsWith("#") == true) { // ignore comments + continue; + } + + // get the num of router + if (num_router == -1) + { + num_router = (new Integer(num)).intValue(); + break; + } + } + + LinkedList routerList = new LinkedList(); + FnbRouter router = null; // a FnbRouter object + String name = null; // router name + String flag = null; // a flag to denote logging router or not + boolean log = false; + + // then for each line, get the router name + for (int i = 1; i <= num_router; i++) + { + log = false; + line = buf.readLine(); + str = new StringTokenizer(line); + if (str.hasMoreTokens() == false) // ignore newlines + { + i--; + continue; + } + + name = str.nextToken(); // get next token + if (name.startsWith("#") == true) // ignore comments + { + i--; + continue; + } + + if (str.hasMoreTokens() == true) + { + flag = str.nextToken(); // get the optional entry + if (flag.equalsIgnoreCase("true") == true) + { + log = true; + } + } + + // The name of a roputer is "Router10", so the my_id is 10 + int endRouter = name.lastIndexOf('r'); + String my_id_str = name.substring(endRouter + 1); + + int my_id = (Integer.decode(my_id_str)).intValue(); + + // create a specific FnbRouter object + if (rate == true) + { + System.out.println(" ****** FnbNetworkReader.createRouter(): " + + "RateControlledScheduler is not available for the finite " + + "network buffers functionality"); + + } + else { + router = new FnbRIPRouter(name, log, my_id); + } + routerList.add(router); // add the router into the list + } + + return routerList; + } + + /** + * Creates a network topology from a given buffered reader + * @param buf a Buffered Reader object + * @param weight a linear array of the weights to be assigned to + * different classes of traffic. + * @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 + * @return a list of FnbRouter objects or <tt>null</tt> if an error occurs + */ + private static LinkedList createNetworkSCFQ(BufferedReader buf, + double[] weight, + int max_buf_size, int drop_alg, + int min_th, int max_th, + double max_p, double queue_weight, boolean stats) throws + Exception + { + if (buf == null) + { + return null; + } + + // create the FnbRouter objects first + LinkedList routerList = createRouter(buf, false); + + int GB = 1000000000; // 1 GB in bits + String line; + String name1, name2; + StringTokenizer str = null; + FnbRouter r1, r2; + Link tempLink = null; + + // creating the linking between two routers + while ((line = buf.readLine()) != null) + { + str = new StringTokenizer(line); + if (str.hasMoreTokens() == false) { // ignore newlines + continue; + } + + // parse the name of the connected routers + name1 = str.nextToken(); // router name + if (name1.startsWith("#") == true) { // ignore comments + continue; + } + + name2 = str.nextToken(); // router name + r1 = getRouter(name1, routerList); + r2 = getRouter(name2, routerList); + + if (r1 == null || r2 == null) + { + System.out.println("NetworkReader.createNetworkSCFQ(): " + + "Warning - unable to connect both "+name1+" and "+name2); + continue; + } + + // get baud rate of the link + String baud = str.nextToken(); // bandwidth (Gbps) + String propDelay = str.nextToken(); // latency (in millisec) + String mtu = str.nextToken(); // link MTU (in byte) + + tempLink = new SimpleLink(r1.get_name() + "_" + r2.get_name(), + Double.parseDouble(baud) * GB, + Double.parseDouble(propDelay), Integer.parseInt(mtu)); + + + FnbSCFQScheduler r1Sched; + + FnbSCFQScheduler r2Sched; + + if (GridSimTags.FNB_ARED == drop_alg) + { + r1Sched = (FnbSCFQScheduler)new ARED(r1.get_name() + + "_to_" + r2.get_name(), + tempLink.getBaudRate(), max_p, + max_buf_size, queue_weight, stats); + + r2Sched = (FnbSCFQScheduler)new ARED(r2.get_name() + + "_to_" + r1.get_name(), + tempLink.getBaudRate(), max_p, + max_buf_size, queue_weight, stats); + } + else if (GridSimTags.FNB_RED == drop_alg) + { + r1Sched = (FnbSCFQScheduler)new RED(r1.get_name() + + "_to_" + r2.get_name(), + tempLink.getBaudRate(), + max_buf_size, min_th, max_th, max_p, + queue_weight, stats); + + r2Sched = (FnbSCFQScheduler)new RED(r2.get_name() + + "_to_" + r1.get_name(), + tempLink.getBaudRate(), + max_buf_size, min_th, max_th, max_p, + queue_weight, stats); + } + else //if (GridSimTags.FNB_FIFO == drop_alg) + { + r1Sched = (FnbSCFQScheduler)new FIFO(r1.get_name() + + "_to_" + r2.get_name(), + tempLink.getBaudRate(), + max_buf_size, + queue_weight, stats); + + r2Sched = (FnbSCFQScheduler)new FIFO(r2.get_name() + + "_to_" + r1.get_name(), + tempLink.getBaudRate(), + max_buf_size, + queue_weight, stats); + } + + + + + r1Sched.setWeights(weight); + r2Sched.setWeights(weight); + r1.attachRouter(r2, tempLink, r1Sched, r2Sched); + } + return routerList; + } + + + +} // end class + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sul...@us...> - 2008-08-31 09:30:43
|
Revision: 240 http://gridsim.svn.sourceforge.net/gridsim/?rev=240&view=rev Author: sulistio Date: 2008-08-31 09:30:53 +0000 (Sun, 31 Aug 2008) Log Message: ----------- update this file to incorporate the new gridsim.net.fnb package. Modified Paths: -------------- trunk/source/gridsim/GridSim.java trunk/source/gridsim/GridSimTags.java Modified: trunk/source/gridsim/GridSim.java =================================================================== --- trunk/source/gridsim/GridSim.java 2008-08-31 09:30:07 UTC (rev 239) +++ trunk/source/gridsim/GridSim.java 2008-08-31 09:30:53 UTC (rev 240) @@ -9,7 +9,7 @@ package gridsim; -//import gridsim.net.fnb.FnbWhiteList; +import gridsim.net.fnb.FnbWhiteList; import gridsim.net.Link; import gridsim.filter.*; import java.io.*; @@ -104,7 +104,7 @@ * if they are going to/coming from the entity stored in the list. * @see gridsim.net.fnb.FnbWhiteList */ - //public static FnbWhiteList fnbWhiteList_ = null; // TODO + public static FnbWhiteList fnbWhiteList_ = null; private static int gisID_ = -1; // id of GIS entity private static int shutdownID_ = -1; // id of GridSimShutdown entity @@ -2538,7 +2538,7 @@ case GridSimTags.NET_BUFFER_PACKET_LEVEL: GridSimCore.NETWORK_TYPE = GridSimTags.NET_BUFFER_PACKET_LEVEL; - //fnbWhiteList_ = new FnbWhiteList(); // TODO + fnbWhiteList_ = new FnbWhiteList(); break; default: Modified: trunk/source/gridsim/GridSimTags.java =================================================================== --- trunk/source/gridsim/GridSimTags.java 2008-08-31 09:30:07 UTC (rev 239) +++ trunk/source/gridsim/GridSimTags.java 2008-08-31 09:30:53 UTC (rev 240) @@ -207,6 +207,64 @@ public static final int FLOW_ACK = NETBASE + 17; + /////////////////////////////////////////////////////////////// + // For the gridsim.net.fnb package + + /** This is to simulate the finite buffers. + * This constant is to tell an entity + * that a packet has been dropped. */ + public static final int FNB_PACKET_DROPPED = NETBASE + 31; + + /** This is to simulate the finite buffers. + * This constant is used when an Output + * port tells a user that a gridlet has failed because its (Gridlet) packets + * has been dropped. */ + public static final int FNB_GRIDLET_FAILED_BECAUSE_PACKET_DROPPED = NETBASE + 32; + + /** This is to simulate the finite buffers. A FIFO dropping algorithm. */ + public static final int FNB_FIFO = NETBASE + 33; + + /** This is to simulate the finite buffers. A RED (Random Early Detection) + dropping algorithm. */ + public static final int FNB_RED = NETBASE + 34; + + /** This is to simulate the finite buffers. + * The event used to capture the number of dropped packets. + * This event is sent form a SCFScheduler to itself every T time. */ + public static final int FNB_COUNT_DROPPED_PKTS = NETBASE + 35; + + /** This is to simulate the finite buffers. + * Adaptative RED (Random Early Detection) dropping algorithm. */ + public static final int FNB_ARED = NETBASE + 36; + + /** This is to update the parameters of ARED. */ + public static final int FNB_UPDATE_ARED_PARAMETERS = NETBASE + 37; + + /** This is to simulate the finite buffers. + * This constant is used when an Output port tells a user that a file + * has failed because its (File) packets has been dropped. */ + public static final int FNB_FILE_FAILED_BECAUSE_PACKET_DROPPED = NETBASE + 38; + + /** This is to simulate the finite buffers. + * This constant is used when an Output port tells a user that a file + * and a gridlet have failed because their (File and Gridlet) packets + * has been dropped. */ + public static final int FNB_FILE_GRIDLET_FAILED_BECAUSE_PACKET_DROPPED = NETBASE + 39; + + /** This is to identify when a packet contains a file. */ + public static final int FNB_PKT_CONTAINS_FILE = NETBASE + 40; + + /** This is to update the parameters of ARED. + * The time period between updates (0.5 seconds). */ + public static final double FNB_UPDATE_ARED_PARAMETERS_PERIOD = 0.5; + + /** + * When a router drops a packet, it has to tell to a user. + * But the router does not notify immediately (when the dropping ocurs), + * but with a given delay (this delay). */ + public static final double FNB_DROPPING_DELAY = 0.01; // 10 milliseconds + + ///////////////////////////////////////////////////////////// // I intentionally put a gap to incorporate future tags // so I don't have to change the numbers! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sul...@us...> - 2008-08-31 09:29:59
|
Revision: 239 http://gridsim.svn.sourceforge.net/gridsim/?rev=239&view=rev Author: sulistio Date: 2008-08-31 09:30:07 +0000 (Sun, 31 Aug 2008) Log Message: ----------- integrate the gridsim.net.fnb package (done by Agustin Caminero, UCLM) from /branches/gridsim4.0-branch2/ into this directory. Added Paths: ----------- trunk/source/gridsim/net/fnb/ 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/FnbNetPacket.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/firstLastPacketsGridlet.java trunk/source/gridsim/net/fnb/source_pktNum.java Added: trunk/source/gridsim/net/fnb/ARED.java =================================================================== --- trunk/source/gridsim/net/fnb/ARED.java (rev 0) +++ trunk/source/gridsim/net/fnb/ARED.java 2008-08-31 09:30:07 UTC (rev 239) @@ -0,0 +1,220 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Author: Agustin Caminero + * Organization: Universidad de Castilla La Mancha (UCLM), Spain. + * Copyright (c) 2008, The University of Melbourne, Australia and + * Universidad de Castilla La Mancha (UCLM), Spain + */ + +package gridsim.net.fnb; + +import gridsim.GridSim; +import java.io.FileWriter; +import gridsim.net.Link; + +/** + * This class implements the Adaptative Random Early Detection policy for + * the management of network buffers at routers. + * Its basic functionality is as follows: + * <ul> + * <li> There is a <tt>ARED</tt> object at each outport in routers. + * <li> For each incoming packet that reaches that outport port, the policy + * decides whether it is enqueued or dropped. This is done by calculating the + * average buffer size and comparing it with two thresholds. + * <li> If the packet is dropped, and it is not a junk packet, we must inform the + * user involved in the transmission about the dropping. + * </ul> + * + * For more details refer to A. Caminero, A. Sulistio, B. Caminero, C. Carrion, + * and R. Buyya, + * <a href="http://www.gridbus.org/papers/BufferManagementNetGrids-ANSS41.pdf"> + * Simulation of Buffer Management Policies in Networks for Grids</a>, + * Proceedings of the 41th Annual Simulation Symposium (ANSS-41, IEEE CS Press, + * Los Alamitos, CA, USA), April 14-16, 2008, Ottawa, Canada. + * + * @author Agustin Caminero + * @since GridSim Toolkit 4.2 + */ +public class ARED extends RED +{ + /** Decrease factor*/ + private double BETA; + + /** Increment*/ + private double ALPHA; + + /** Target for AVG */ + private double TARGET_LOW; + + /** Target for AVG*/ + private double TARGET_HIGH; + + + /** + * Creates a new Adaptative Random Early Detection (ARED) policy. + * @param name Name of this scheduler + * @param baudRate baud rate in bits/s of the port that is using + * this scheduler. + * @param max_buf_size maximum buffer size for routers + * @throws ParameterException This happens when the baud rate <= 0 + * @pre baudRate > 0 + * @post $none + */ + public ARED(String name, double baudRate, double max_p, int max_buf_size, + double queue_weight, boolean stats) throws Exception + { + super(name, baudRate, max_buf_size, 0.0, 0.0, max_p, queue_weight, stats); + initialize(); + } + + /** + * This function updates the value of max_p, which is the maximum dropping + * probability for a packet. + * It also updates ALPHA, as it depends on max_p. + */ + public void updateAREDParameters() + { + double max_p = getMaxP(); + if ((getAvg() > TARGET_HIGH) && (getMaxP() <= 0.5)) + { + // increase max_p + setMaxP(max_p + ALPHA); + } + else if ((getAvg() < TARGET_LOW) && (max_p >= 0.01)) + { + // decrease max_p + setMaxP(max_p * BETA); + } + + if ((max_p / 4) < 0.01) + ALPHA = max_p / 4; + else + ALPHA = 0.01; + + } + + /** Update the stats file of this scheduler. + */ + public void updateStats() + { + fw_write(GridSim.clock() + "\t" + getMaxP() + "\t" + getMinTh() + "\t" + + getMaxTh() + "\t" + getAvg() + "\t" + this.size() + "\n", + this.getSchedName() + "_Buffers"); + } + + + /** + * This methods sets some parameters for the RED and ARED algorithms, + * such as the thresholds. + */ + public void setThresholds() + { + double minTh; + + double C = super.getBaudRate() / (Link.DEFAULT_MTU * 8); + // baudRate_is in bits per second, MTU is in bytes. + + double term = -1 / C; + double term2 = Math.exp(term); + + setQueueWeight(1 - term2); + + double DELAY_TARGET = 0.005; // 5 milliseconds + double var = DELAY_TARGET * C / 2; + + if (5 > var) + { + minTh = 5; + } + else + { + minTh = var; + + } + + setMinTh(minTh); + setMaxTh(3 * minTh); + + } + + /**This function initializes the parameters of the buffers policies + * */ + public void initialize() + { + super.initialize(); + + setThresholds(); + + if ((getMaxP() / 4) < 0.01) + ALPHA = getMaxP() / 4; + else + ALPHA = 0.01; + + BETA = 0.9; + + } + + + /** + * Sets the baud rate that this scheduler will be sending packets at. + * @param rate the baud rate of this scheduler (in bits/s) + * @pre rate > 0 + * @post $none + */ + public boolean setBaudRate(double rate) + { + + if (rate <= 0.0) + { + return false; + } + super.setBaudRateSCFQ(rate); + + initialize(); + + return 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 + */ + private static void fw_write(String msg, String file) + { + FileWriter fwriter = null; + + 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.close(); + } catch (Exception ex) + { + ex.printStackTrace(); + System.out.println("Unwanted errors while closing file " + file); + } + } +} + Added: trunk/source/gridsim/net/fnb/FIFO.java =================================================================== --- trunk/source/gridsim/net/fnb/FIFO.java (rev 0) +++ trunk/source/gridsim/net/fnb/FIFO.java 2008-08-31 09:30:07 UTC (rev 239) @@ -0,0 +1,362 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Author: Agustin Caminero + * Organization: Universidad de Castilla La Mancha (UCLM), Spain. + * Copyright (c) 2008, The University of Melbourne, Australia and + * Universidad de Castilla La Mancha (UCLM), Spain + */ + +package gridsim.net.fnb; + +import gridsim.net.fnb.*; +import gridsim.net.Packet; +import gridsim.GridSimTags; +import gridsim.ParameterException; +import gridsim.GridSim; +import java.io.FileWriter; +import gridsim.net.*; + +/** + * This class implements the FIFO policy for the management + * of network buffers at routers. + * Its basic functionality is as follows: + * <ul> + * <li> There is a FIFO object at each outport in routers. + * <li> For each incoming packet that reaches that outport port, the policy + * decides whether it is enqueued or dropped. This is done by calculating the + * average buffer size and comparing it with two thresholds. + * <li> If the packet is dropped, and it is not a junk packet, we must inform the + * user involved in the transmission about the dropping. + * </ul> + * + * For more details refer to A. Caminero, A. Sulistio, B. Caminero, C. Carrion, + * and R. Buyya, + * <a href="http://www.gridbus.org/papers/BufferManagementNetGrids-ANSS41.pdf"> + * Simulation of Buffer Management Policies in Networks for Grids</a>, + * Proceedings of the 41th Annual Simulation Symposium (ANSS-41, IEEE CS Press, + * Los Alamitos, CA, USA), April 14-16, 2008, Ottawa, Canada. + * + * @author Agustin Caminero + * @since GridSim Toolkit 4.2 + * */ +public class FIFO extends FnbSCFQScheduler +{ + + private double QUEUE_WEIGHT; // the queue weigth + private double AVG; + private double Q_TIME; + private double S; + + /** */ + public double MAX_AVG = 0.0; + + + /** + * Creates a new FIFO policy with the specified name and baud rate + * (in bits/s). The name can be useful for debugging purposes, but serves + * no functional purposes. + * + * @param name Name of this scheduler + * @param baudRate baud rate in bits/s of the port that is using + * this scheduler. + * @param max_buf_size maximum buffer size for routers + * @throws ParameterException This happens when the name is null or + * the baud rate <= 0 + * @pre name != null + * @pre baudRate > 0 + * @post $none + */ + public FIFO(String name, double baudRate, int max_buf_size, + double queue_weight, boolean stats) throws Exception + { + super(name, baudRate, max_buf_size, stats); + + QUEUE_WEIGHT = queue_weight; + + if (name == null) + { + throw new ParameterException("RED(): Name is null."); + } + + if (baudRate <= 0) + { + throw new ParameterException("RED(): Baudrate <= 0."); + } + + initialize(); + + } + + + /** + * Checks queue size and puts a packet into the queue + * + * @param pnp A Packet to be enqued by this scheduler. + * @return <tt>true</tt> if enqued, <tt>false</tt> otherwise + * @pre pnp != null + * @post $none + */ + public synchronized boolean enque(Packet pnp) + { + /*double clock = GridSim.clock(); + if (clock > nextInterval) + { + updateAFIFOParameters(); + nextInterval = clock + INTERVAL; + }*/ + + checkAndInsertPacketIntoQueue(pnp); /// insert the pkt into the queue + //double avgQueueSize = avgQueueSize(); + return true; + } + + + /** + * Puts a packet into the queue, checking the queue size before that. + * + * @param pnp A Packet to be enqued by this scheduler. + * @return <tt>true</tt> if enqued, <tt>false</tt> otherwise + * @pre pnp != null + * @post $none + */ + public synchronized boolean checkAndInsertPacketIntoQueue(Packet pnp) + { + + if (size() < getMaxBufferSizeInPkts()) + { + insertPacketIntoQueue(pnp); + return true; + } + else + { + dropPacketFIFO(pnp); + return false; + } + } + + /** If the queue is full, we have to drop a packet. + * If the packet to get dropped is a control packet, the sim will stop. + * Control packets will be those packets sent between the broker or the gis. + * Normal packets are those belonging to a gridlet. + * We are using the FIFO algorithm. + * @param pnp the new incoming packet + * */ + public synchronized boolean dropPacketFIFO(Packet pnp) + { + // If the queue is full, we have to drop a packet, giving priority to the control packets + // Control packets will be those packets sent between the broker or the gis. + // Normal packets are those belonging to a gridlet. + // Control packets can only be dropped when the wue is full of control packets + + increaseDroppedPktCounter(); // increase the counter of dropped packets + + // First: check if the new incoming packet is a control packet or not. + + // Check the source of the packet + int src_outputPort = ((FnbNetPacket) pnp).getSrcID(); + String src_outputPort_str = GridSim.getEntityName( + src_outputPort); + // for example, src_outputPort_str = Output_SIM_0_User_0 + + // Check the destination, as I'm not sure if it works like that + int dst_inputPort = ((FnbNetPacket) pnp).getDestID(); + String dst_inputPort_str = GridSim.getEntityName(dst_inputPort); + + // if neither the src or the dest of the packet are in the whitelist, then drop the packet + if ((GridSim.fnbWhiteList_.checkList(dst_inputPort) == false) && + (GridSim.fnbWhiteList_.checkList(src_outputPort) == false)) + + { + + /* + // This was the very first version of the Fnbs + insertPacketIntoQueue(pnp); + return true;*/ + + if (makeRoomForPacket()) + { + // If we have been able of dropping a data packet, then we have room for this control packet + insertPacketIntoQueue(pnp); + } + else + { + // The control packet has to be dropped. + + System.out.println("\n" + super.get_name() + + ": buffer full, and a control packet has been dropped.\n" + + " src.output: " + src_outputPort_str + + ". dst_inputPort: " + dst_inputPort_str + + "\n HENCE, SIMULATION FINISHED"); + + System.exit(1); + // super.shutdownUserEntity(); + // super.terminateIOEntities(); + + return false; + } + } + + /* + // If u want more info on the progress of sims, uncomment this. + System.out.println(super.get_name() + ": packet dropped. Src: " + + src_outputPort_str + ", Dst: " + dst_str + + ". Pkt num: " + ((FnbNetPacket) pnp).getPacketNum());*/ + + // In this case, we will have to remove the packet, and + // also, we will have to tell the source of the packet what has happened. + // The source of a packet is the user/resource which sent it. + // So, in order to contact the entity, we do it through its output port. + // This is done through an event, not through the network + + int entity; + if (src_outputPort_str.indexOf("User") != -1) + { + // if the src of the packet is an user, tell him what has happened + + // NOTE: this is a HACK job. "Output_" has 7 chars. So, + // the idea is to get only the entity name by removing + // "Output_" word in the outName string. + String src_str = src_outputPort_str.substring(7); + // for example, src_str = SIM_0_User_0 + + entity = GridSim.getEntityId(src_str); + + } + else + { + // If the destination of the packet is the user, tell the user + + entity = GridSim.getEntityId(dst_inputPort_str); + + } + + int pktID = ((FnbNetPacket) pnp).getID(); + + // String input_src_str = "Input_" + src_str; + // for example, input_src_str = Input_SIM_0_User_0 + // int input_src = GridSim.getEntityId(input_src_str); + + super.send(src_outputPort, GridSimTags.SCHEDULE_NOW, + GridSimTags.FNB_PACKET_DROPPED, + new FnbDroppedUserPacket(entity, pktID)); + // We tell the output entity of the sender of this packet + // that the packet has been dropped. + + pnp = null; // remove the packet. + + return true; + + } + + + /** Calculate the avg queue size for the FIFO algorithm. + * */ + public double avgQueueSize() + { + + int q = size(); + double time = GridSim.clock(); + + // Only this if is necesary for the algo + if (q != 0) + { + AVG = AVG + QUEUE_WEIGHT * (q - AVG); + } + else + { + AVG = Math.pow((1 - QUEUE_WEIGHT), (time - Q_TIME) / S) * AVG; + } + + if (AVG > MAX_AVG) + MAX_AVG = AVG; + + return AVG; + + } // avgQueueSize() + + + /** + * 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 + { + 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.close(); + } catch (Exception ex) + { + ex.printStackTrace(); + System.out.println("Unwanted errors while closing file " + file); + } + } + + /**This function initializes the parameters of the buffers policies (RED, ARED) + * */ + public void initialize() + { + // empty + + + } + + /** + * Sets the baud rate that this scheduler will be sending packets at. + * @param rate the baud rate of this scheduler (in bits/s) + * @pre rate > 0 + * @post $none + */ + public boolean setBaudRate(double rate) + { + + if (rate <= 0.0) + { + return false; + } + super.setBaudRateSCFQ(rate); + + return true; + } + + /** Returns the avg buffer size*/ + public double getAvg() + { + return AVG; + } + + /** Update the stats file of this scheduler. + */ + public void updateStats() + { + fw_write(GridSim.clock() + "\t\t\t\t" + AVG + "\t" + this.size() + "\n", + this.getSchedName() + "_Buffers"); + } +} + Added: trunk/source/gridsim/net/fnb/FnbDroppedPacketInfo.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbDroppedPacketInfo.java (rev 0) +++ trunk/source/gridsim/net/fnb/FnbDroppedPacketInfo.java 2008-08-31 09:30:07 UTC (rev 239) @@ -0,0 +1,75 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Author: Agustin Caminero + * Organization: Universidad de Castilla La Mancha (UCLM), Spain. + * Copyright (c) 2008, The University of Melbourne, Australia and + * Universidad de Castilla La Mancha (UCLM), Spain + */ + +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.1 + */ +public class FnbDroppedPacketInfo +{ + private int glID; // TODO try to be more general, not just gridlet + + 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) + { + glID = g; + userID = u; + } + + /** 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() + { + return glID; + } + + + /** Gets the user id. + * @return the user id. + * */ + public int getUserID() + { + return userID; + } + +} Added: trunk/source/gridsim/net/fnb/FnbDroppedUserPacket.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbDroppedUserPacket.java (rev 0) +++ trunk/source/gridsim/net/fnb/FnbDroppedUserPacket.java 2008-08-31 09:30:07 UTC (rev 239) @@ -0,0 +1,170 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Author: Agustin Caminero + * Organization: Universidad de Castilla La Mancha (UCLM), Spain. + * Copyright (c) 2008, The University of Melbourne, Australia and + * Universidad de Castilla La Mancha (UCLM), Spain + */ + +package gridsim.net.fnb; + +import gridsim.net.*; + +/** + * 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 + * */ +public class FnbDroppedUserPacket implements Packet +{ + int userID; + int pktID; + + /**Create an object of this class. + * @param userID the user id + * @param pktID the packet id */ + public FnbDroppedUserPacket(int userID, int pktID) + { + this.userID= userID; + this.pktID= pktID; + } + + + /** Gets the user id + * @return user id */ + public int getUser() + { + return userID; + } + + + /** Gets the packet id + * @return packet id */ + public int getPkt() + { + return pktID; + } + + + /** + * Gets this packet tag + * @return this packet tag + * @pre $none + * @post $none + */ + public int getTag() + { + return -1; + } + + /** + * Sets an entity ID from the last hop that this packet has traversed. + * @param last an entity ID from the last hop + * @pre last > 0 + * @post $none + */ + public void setLast(int last) + { + + } + + /** + * Gets an entity ID from the last hop that this packet has traversed. + * @return an entity ID + * @pre $none + * @post $none + */ + public int getLast() + { + 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. + * @param serviceType this packet's service type + * @pre serviceType >= 0 + * @post $none + */ + public void setNetServiceType(int serviceType) + { + + } + + /** + * Gets the network service type of this packet + * @return the network service type + * @pre $none + * @post $none + */ + public int getNetServiceType() + { + return -1; + } + + + /** + * Returns the ID of the source of this packet. + * @return source id + * @pre $none + * @post $none + */ + public int getSrcID() + { + return -1; + } + + + /** + * Returns the ID of this packet + * @return packet ID + * @pre $none + * @post $none + */ + public int getID() + { + return pktID; + } + + + /** + * Returns the destination id of this packet. + * @return destination id + * @pre $none + * @post $none + */ + public int getDestID() + { + return -1; + } + + /** + * Sets the size of this packet + * @param size size of the packet + * @return <tt>true</tt> if it is successful, <tt>false</tt> otherwise + * @pre size >= 0 + * @post $none + */ + public boolean setSize(long size) + { + return false; + } + + /** + * Returns the size of this packet + * @return size of the packet + * @pre $none + * @post $none + */ + public long getSize() + { + return -1; + } +} Added: trunk/source/gridsim/net/fnb/FnbEndToEndPath.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbEndToEndPath.java (rev 0) +++ trunk/source/gridsim/net/fnb/FnbEndToEndPath.java 2008-08-31 09:30:07 UTC (rev 239) @@ -0,0 +1,202 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Author: Agustin Caminero + * Organization: Universidad de Castilla La Mancha (UCLM), Spain. + * Copyright (c) 2008, The University of Melbourne, Australia and + * Universidad de Castilla La Mancha (UCLM), Spain + */ + +package gridsim.net.fnb; + +/** + * This class keeps some information which are common to all the packets of a gridlet. + * 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. + * Thus, we put all of the common information (e.g. source and destination IDs) + * into this class. + * + * @since GridSim Toolkit 4.1 + * @author Agustin Caminero + */ +public class FnbEndToEndPath +{ + private int destID; + private int srcID; + private int classtype; + private int totalPkts; // total num of packet that belongs to a group + 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. + * @param destID destination id + * @param sourceID source id + * @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, + int glID) + { + this.destID = destID; + this.srcID = srcID; + 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. + * @param destID destination id + * @param sourceID source id + * @param classType network service level + * @param totalPkts total number of packets this connection is made of + * @param glID the gridlet id + * */ + public FnbEndToEndPath(int destID, int srcID, int classtype, int totalPkts) + { + this.destID = destID; + this.srcID = srcID; + 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 + * */ + public void setDest(int d) + { + destID = d; + } + + + /** Sets the source id for a connection. + * @param s the source id + * */ + public void setSrc(int s) + { + srcID = s; + } + + + /** Sets the network service level (or classtype) for a connection. + * @param c the network service level id + * */ + public void setClasstype(int c) + { + classtype = c; + } + + + /** Sets the total packets for a connection. + * @param t total packets + * */ + public void setTotalPkts(int t) + { + totalPkts = t; + } + + /** Gets the source id of a connection. + * @return the source id of the connection + * */ + public int getSrc() + { + return srcID; + } + + + /** Gets the destination id of a connection. + * @return the destination id of the connection + * */ + public int getDest() + { + return destID; + } + + + /** Gets the classtype of a connection. + * @return the classtype of the connection + * */ + public int getClasstype() + { + return classtype; + } + + + /** Gets the total number of packets of a connection. + * @return the total number of packets of the connection + * */ + public int getTotalPkts() + { + return totalPkts; + } + + + /** Sets the gridlet/file id of a connection. + * @param g the gridlet id of the connection + * */ + public void setObjectID(int g) + { + glID = g; + } + + + /** Gets the gridlet/file id of a connection. + * @return the gridlet id of the connection + * */ + public int getObjectID() + { + return glID; + } +} Added: trunk/source/gridsim/net/fnb/FnbInput.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbInput.java (rev 0) +++ trunk/source/gridsim/net/fnb/FnbInput.java 2008-08-31 09:30:07 UTC (rev 239) @@ -0,0 +1,546 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Author: Agustin Caminero (based on Input.java) + * Organization: Universidad de Castilla La Mancha (UCLM), Spain. + * Copyright (c) 2008, The University of Melbourne, Australia and + * Universidad de Castilla La Mancha (UCLM), Spain + */ + +package gridsim.net.fnb; + +import gridsim.net.fnb.*; +import gridsim.*; +import gridsim.net.*; +import eduni.simjava.*; +import java.util.*; +import java.io.FileWriter; +import gridsim.util.TrafficGenerator; + +/** + * GridSim FnbInput class defines a port through which a simulation entity + * receives data from the simulated network. + * <p> + * It maintains an event queue + * to serialize the data-in-flow and delivers to its parent entity. + * It accepts messages that comes from GridSim entities 'FnbOutput' entity + * and passes the same to the GridSim entity. + * It simulates Network communication delay depending on Baud rate + * and data length. Simultaneous inputs can be modeled using multiple + * instances of this class. + * + * @author Agustin Caminero, Universidad de Castilla La Mancha (Spain). + * Based on Input class, by Manzur Murshed and Rajkumar Buyya. + * @since GridSim Toolkit 4.1 + * + * Things added or modifyed: + * - getDataFromLink(...) + * - source_PktNum_array + * - FnbNetPacket instead of NetPacket + * + */ +public class FnbInput extends Sim_entity implements NetIO +{ + private Sim_port inPort_; + private Link link_; + private double baudRate_; + private static final int BITS = 8; // 1 byte = 8 bits + + private ArrayList source_PktNum_array; + + /** + * Allocates a new Input object + * @param name the name of this object + * @param baudRate the communication speed + * @throws NullPointerException This happens when creating this entity + * before initializing GridSim package or this entity name + * is <tt>null</tt> or empty + * @pre name != null + * @pre baudRate >= 0.0 + * @post $none + */ + public FnbInput(String name, double baudRate) throws NullPointerException + { + super(name); + this.baudRate_ = baudRate; + link_= null; + + inPort_ = new Sim_port("input_buffer"); + super.add_port(inPort_); + + source_PktNum_array = new ArrayList(); + } + + /** + * Sets the Input entities link. This should be used only if the network + * extensions are being used. + * @param link the link to which this Input entity should send data + * @pre link != null + * @post $none + */ + public void addLink(Link link) { + this.link_ = link; + } + + /** + * Gets the baud rate + * @return the baud rate + * @deprecated As of GridSim 2.1, replaced by {@link #getBaudRate()} + * @pre $none + * @post $result >= 0.0 + */ + public double GetBaudRate() { + return this.getBaudRate(); + } + + /** + * Gets the baud rate + * @return the baud rate + * @pre $none + * @post $result >= 0.0 + */ + public double getBaudRate() { + return baudRate_; + } + + /** + * Gets the I/O real number based on a given value + * @param value the specified value + * @return real number + * @deprecated As of GridSim 2.1, replaced by {@link #realIO(double)} + * @pre value >= 0.0 + * @post $result >= 0.0 + */ + public double real_io(double value) { + return this.realIO(value); + } + + /** + * Gets the I/O real number based on a given value + * @param value the specified value + * @return real number + * @pre value >= 0.0 + * @post $result >= 0.0 + */ + public double realIO(double value) { + return GridSimRandom.realIO(value); + } + + /** + * 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; + } + + /** + * A method that gets one process event at one time until the end + * of a simulation, then delivers an event to the entity (its parent) + * @pre $none + * @post $none + */ + public void body() + { + // Process events + Object obj = null; + while ( Sim_system.running() ) + { + Sim_event ev = new Sim_event(); + super.sim_get_next(ev); // get the next event in the queue + obj = ev.get_data(); // get the incoming data + + // if the simulation finishes then exit the loop + if (ev.get_tag() == GridSimTags.END_OF_SIMULATION) { + break; + } + + // if this entity is not connected in a network topology + if (obj != null && obj instanceof IO_data) { + getDataFromEvent(ev); + } + + // if this entity belongs to a network topology + else if (obj != null && link_ != null) { + getDataFromLink(ev); + } + + ev = null; // reset to null for gc to collect + } + } + + /** + * Process incoming event for data without using the network extension + * @param ev a Sim_event object + * @pre ev != null + * @post $none + */ + private void getDataFromEvent(Sim_event ev) + { + IO_data io = (IO_data) ev.get_data(); + + // if the sender is not part of the overall network topology + // whereas this entity is, then need to return back the data, + // since it is not compatible. + if (link_ != null) + { + // outName = "Output_xxx", where xxx = sender entity name + String outName = GridSim.getEntityName( ev.get_src() ); + + // NOTE: this is a HACK job. "Output_" has 7 chars. So, + // the idea is to get only the entity name by removing + // "Output_" word in the outName string. + String name = outName.substring(7); + + // if the sender is not system GIS then ignore the message + if (GridSim.getEntityId(name) != GridSim.getGridInfoServiceEntityId()) + { + // sends back the data to "Input_xxx", where + // xxx = sender entity name. If not sent, then the sender + // will wait forever to receive this data. As a result, + // the whole simulation program will be hanged or does not + // terminate successfully. + int id = GridSim.getEntityId("Input_" + name); + super.sim_schedule(id, 0.0, ev.get_tag(), io); + + // print an error message + System.out.println(super.get_name() + ".body(): Error - " + + "incompatible message protocol."); + System.out.println(" Sender: " + name + " is not part " + + "of this entity's network topology."); + System.out.println(" Hence, sending back the received data."); + System.out.println(); + return; + } + } + + // NOTE: need to have a try-catch statement. This is because, + // if the above if statement holds, then Input_receiver will send + // back to Input_sender without going through Output_receiver entity. + // Hence, a try-catch is needed to prevent exception of wrong casting. + try + { + // Simulate Transmission Time after Receiving + // Hold first then dispatch + double senderBaudRate = ( (Output) + Sim_system.get_entity(ev.get_src()) ).getBaudRate(); + + // NOTE: io is in byte and baud rate is in bits. 1 byte = 8 bits + // So, convert io into bits + double minBaudRate = Math.min(baudRate_, senderBaudRate); + double communicationDelay = GridSimRandom.realIO( + (io.getByteSize() * BITS) / minBaudRate); + + // NOTE: Below is a deprecated method for SimJava 2 + //super.sim_hold(communicationDelay); + super.sim_process(communicationDelay); // receiving time + } + catch (Exception e) { + // .... empty + } + + // Deliver Event to the entity (its parent) to which + // it is acting as buffer + super.sim_schedule( inPort_, GridSimTags.SCHEDULE_NOW, + ev.get_tag(), io.getData() ); + } + + /** + * Process incoming events from senders that are using the network + * extension + * @param ev a Sim_event object + * @pre ev != null + * @post $none + */ + private void getDataFromLink(Sim_event ev) + { + Object obj = ev.get_data(); + if (obj instanceof Packet) + { + // decrypt the packet into original format + Packet pkt = (Packet) ev.get_data(); + + /*System.out.println(super.get_name() + ": >>>> FnbInput. PktID: " + + ((FnbNetPacket) pkt).getID() + ". glID: " + + ((FnbNetPacket) pkt).getGlID());*/ + + if (pkt instanceof InfoPacket) + { + processPingRequest( (InfoPacket) pkt); + return; + } + + source_pktNum srcPktNum; + // all except last packet in a data session are null packets + if (pkt instanceof FnbNetPacket) + { + FnbNetPacket np = (FnbNetPacket) pkt; + int tag = np.getTag(); + + // ignore incoming junk packets + if (tag == GridSimTags.JUNK_PKT) { + return; + } + + + // We have to count the gridlet packets arriving at a resource/user, + // so that we make sure all the packets belonging to a gridlet arrive. + // If any of those packets of a gridlet don't arrive, then the gridlet is failed. + // In that case, the router where those packets have been dropped will have told + // the user about the dropping. + String name = super.get_name(); + + + int src_outputPort = ((FnbNetPacket) np).getSrcID(); + //String src_outputPort_str = GridSim.getEntityName(src_outputPort); + + /* + // Uncomment this for more info on the progress of sims + if (name.compareTo("Input_SIM_0_Res_0") == 0) + System.out.println(super.get_name() + + ": packet arrived to the res" + + ". Pkt num: " + + ((FnbNetPacket) np).getPacketNum() + + " from " + src_outputPort_str);*/ + + //int pktID = ((FnbNetPacket) np).getID(); + //int PrevPktNum; // The pkt Num of the previous packet + int pktNum = ((FnbNetPacket) np).getPacketNum(); + int glID = ((FnbNetPacket) np).getObjectID(); + srcPktNum = lookForSrcPktNum(src_outputPort, glID); + + if (srcPktNum == null) + { + // Not correct anymore + // Remove form the source_PktNum_array the items whose src is the + // src_outputPort, as those gridlets will be failed (dropped packets) + // removeFromSrcPktNum(src_outputPort); + + // We create a new source_pktNum object only if the packet is the first in this gridlet. + // This means that if the gridlet is failed (as some packets have been dropped), + // no source_pktNum wil be created. + + if (pktNum == 1) + { + srcPktNum = new source_pktNum(src_outputPort, glID); + + source_PktNum_array.add(srcPktNum); + + /*System.out.println(super.get_name() + + ": >>>> FnbInput. First pkt of a gl has just arrived . PktID: " + + ((FnbNetPacket) pkt).getID() + ". glID: " + + ((FnbNetPacket) pkt).getGlID());*/ + + } + }//if (srcPktNum == null) + + if (srcPktNum != null) + { + // If srcPktNum != null this means that the srcPktNum object is correct. + // We have not lost any packet, so the gridlet is ok up to now. + // Hence, update the pktNum in the array. + //srcPktNum.setPktNum(pktNum); + //srcPktNum.setPktID(pktID); + + // Increase the number of pkts already received + //srcPktNum.setNumOfPkts(srcPktNum.getNumOfPkts() + 1); + srcPktNum.increaseNumOfArrivedPkts(); + + // If this is the last packet of the gridlet, then the gridlet is ok + int totalPkt = ((FnbNetPacket) np).getTotalPackets(); + if (srcPktNum.getNumOfPkts() == totalPkt) + srcPktNum.setOk(true); + + + + // ignore incoming null dummy packets + if (tag == GridSimTags.EMPTY_PKT && np.getData() == null) + { + return; + } + else + { + // This is the last packet in the gridlet, so we have to check + // if the previous packets have arrived. + if (srcPktNum.getOk() == true) + { + // The gridlet has arrived perfect, with no packet lost + + // 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()); + + /*// REMOVE!!! + System.out.println("\n*********" + super.get_name() + + ": Data (maybe a gridlet) arrived. Pkt num: " + + ((FnbNetPacket) np).getPacketNum() + + " from " + src_outputPort_str + + "\n");*/ + + name = super.get_name(); + if (name.indexOf("Input_SIM_0_Res_5") != -1) + { + fw_write( + "Data (maybe a gridlet) arrived at the Resource\n", + super.get_name()); + + /*System.out.println("\n*********" + + super.get_name() + + ": Data (maybe a gridlet) arrived at the Resource. Pkt num: " + + ((FnbNetPacket) np).getPacketNum() + + " from " + src_outputPort_str + + "\n");*/ + } + + } // if (srcPktNum.getOk() == true) + + } // else of the if (tag == GridSimTags.EMPTY_PKT && np.getData() == null) + + }//if (srcPktNum != null) + + }// if (pkt instanceof FnbNetPacket) + + }// if (obj instanceof Packet) + + } + + /** + * Look for a especific source_pktNum object in the source_PktNum_array + * @param src the source of the packet + * @param pktID the unique id of a packet + * @param glID the id of the girdlet this packet belongs to. + * @return a source_pktNum object whose source is src, null otherwise + * */ + public source_pktNum lookForSrcPktNum(int src, int glID) + { + + source_pktNum srcPktNum; + for (int i = 0; i < source_PktNum_array.size(); i++) + { + srcPktNum = (source_pktNum) source_PktNum_array.get(i); + + if ((srcPktNum.getSource() == src) && (srcPktNum.getGlID() == glID)) + return srcPktNum; + } + + return null; + + } + + /** + * Look for a especific source_pktNum object in the source_PktNum_array + * @param src the source of the packet + * @return a source_pktNum object whose source is src, null otherwise + * */ + public void removeFromSrcPktNum(int src) + { + + source_pktNum srcPktNum; + for (int i = 0; i < source_PktNum_array.size(); i++) + { + srcPktNum = (source_pktNum) source_PktNum_array.get(i); + + if (srcPktNum.getSource() == src) + source_PktNum_array.remove(i); + } + + } + + + + /** + * 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 + { + 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.close(); + } catch (Exception ex) + { + ex.printStackTrace(); + System.out.println("Unwanted errors while closing file " + file); + } + } + + + /** + * Processes a ping request + * @param pkt a packet for pinging + * @pre pkt != null + * @post $none + */ + private void processPingRequest(InfoPacket pkt) + { + // add more information to ping() packet + pkt.addHop( inPort_.get_dest() ); + pkt.addEntryTime( GridSim.clock() ); + + IO_data io = new IO_data( pkt, pkt.getSize(), inPort_.get_dest() ); + + // send this ping() packet to the entity + super.sim_schedule(inPort_, GridSimTags.SCHEDULE_NOW, + pkt.getTag(), io.getData()); + } + +} // end class + Added: trunk/source/gridsim/net/fnb/FnbMessage.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbMessage.java (rev 0) +++ trunk/source/gridsim/net/fnb/FnbMessage.java 2008-08-31 09:30:07 UTC (rev 239) @@ -0,0 +1,21 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Author: Agustin Caminero + * Organization: Universidad de Castilla La Mancha (UCLM), Spain. + * Copyright (c) 2008, The University of Melbourne, Australia and + * Universidad de Castilla La Mancha (UCLM), Spain + */ + +package gridsim.net.fnb; + +public interface FnbMessage +{ + public void setEntityID(int i); + + public int getEntityID(); + +} Added: trunk/source/gridsim/net/fnb/FnbMessageDropFile.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbMessageDropFile.java (rev 0) +++ trunk/source/gridsim/net/fnb/FnbMessageDropFile.java 2008-08-31 09:30:07 UTC (rev 239) @@ -0,0 +1,50 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Author: Agustin Caminero + * Organization: Universidad de Castilla La Mancha (UCLM), Spain. + * Copyright (c) 2008, The University of Melbourne, Australia and + * Universidad de Castilla La Mancha (UCLM), Spain + */ + +package gridsim.net.fnb; + +import gridsim.net.fnb.*; + +public class FnbMessageDropFile implements FnbMessage +{ + int fileID; + String filename; + + public FnbMessageDropFile(int e, String f) + { + fileID = e; + filename = f; + } + + public void setEntityID(int i) + { + fileID = i; + } + + + public int getEntityID() + { + return fileID; + } + + public void setFilename(String f) + { + filename = f; + } + + public String getFilename() + { + return filename; + } + + +} Added: trunk/source/gridsim/net/fnb/FnbMessageDropGridlet.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbMessageDropGridlet.java (rev 0) +++ trunk/source/gridsim/net/fnb/FnbMessageDropGridlet.java 2008-08-31 09:30:07 UTC (rev 239) @@ -0,0 +1,38 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Author: Agustin Caminero + * Organization: Universidad de Castilla La Mancha (UCLM), Spain. + * Copyright (c) 2008, The University of Melbourne, Australia and + * Universidad de Castilla La Mancha (UCLM), Spain + */ + +package gridsim.net.fnb; + +import gridsim.net.fnb.*; + +public class FnbMessageDropGridlet implements FnbMessage +{ + int gridletID; + + public FnbMessageDropGridlet (int e) + { + gridletID = e; + } + + public void setEntityID(int i) + { + gridletID = i; + } + + + public int getEntityID() + { + return gridletID; + } + + +} Added: trunk/source/gridsim/net/fnb/FnbNetPacket.java =================================================================== --- trunk/source/gridsim/net/fnb/FnbNetPacket.java (rev 0) +++ trunk/source/gridsim/net/fnb/FnbNetPacket.java 2008-08-31 09:30:07 UTC (rev 239) @@ -0,0 +1,340 @@ +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Author: Agustin Caminero + * Organization: Universidad de Castilla La Mancha (UCLM), Spain. + * Copyright (c) 2008, The University of Melbourne, Australia and + * Universidad de Castilla La Mancha (UCLM), Spain + */ + +package gridsim.net.fnb; + +import gridsim.*; +import gridsim.net.*; + +/** + * Structure of a packet used to encapsulate data passing through the network, + * for the finite network buffers. + * + * 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 + * @since GridSim Toolkit 4.2 + * @author Agustin Caminero + */ +public class FnbNetPacket implements Packet +{ + private long size; // packet size (for calculating transmission time) + private Object obj; // the actual object, the type depends on context + + // original tag with which the encapsulated object was submitted + private int tag; + + // the last entity encountered by the object, used to determine direction + private int last; + + 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; + + /** + * Constructs a network packet for data that fits into a single network + * packet. + * + * @param data The data to be encapsulated. + * @param pktID The ID of this packet + * @param size The size of the data (in bytes) + * @param tag The original tag which was used with the data, its + * reapplied when the data is extracted from the NetPacket. + * @param srcID The id of the entity where the packet was created. + * @param destID The destination to which the packet has to be sent. + * @pre $none + * @post $none + */ + public FnbNetPacket(Object data, int pktID, long size, int tag, int srcID) + { + this.obj = data ; + this.size = size ; + this.tag = tag ; + + this.last = srcID ; + this.pktID_ = pktID; + + this.pktNum = 1; + + this.desc_ = 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 + * 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. + * + * @param data The data to be encapsulated. + * @param pktID The ID of this packet + * @param size The size of the data (in bytes) + * @param tag The original tag which was used with the data, its + * reapplied when the data is extracted from the NetPacket. + * @param srcID The id of the entity where the packet was created. + * @param destID The destination to which the packet has to be sent. + * @param netServiceType the network class type of this packet + * @param pktNum The packet number of this packet in its series. If there + * are 10 packets, they should be numbered from 1 to 10. + * @param totalPkts The total number of packets that the original data was + * split into. This is used by the receiver to confirm that + * all packets have been received. + * @pre $none + * @post $none + */ + public FnbNetPacket(Object data, int pktID, long size, int tag, int srcID, int pktNum) + { + this.obj = data; + this.size = size; + this.tag = tag; + + this.last = srcID; + + this.pktNum = pktNum; + this.pktID_ = pktID; + + this.desc_ = null; + } + + /** + * Returns a description of this packet + * @return a description of this... [truncated message content] |
From: <sul...@us...> - 2008-08-31 07:16:40
|
Revision: 238 http://gridsim.svn.sourceforge.net/gridsim/?rev=238&view=rev Author: sulistio Date: 2008-08-31 07:16:49 +0000 (Sun, 31 Aug 2008) Log Message: ----------- change from DOS formatting to UNIX Modified Paths: -------------- trunk/source/gridsim/auction/Auction.java trunk/source/gridsim/auction/AuctionObserver.java trunk/source/gridsim/auction/AuctionTags.java trunk/source/gridsim/auction/Auctioneer.java trunk/source/gridsim/auction/ContinuousDoubleAuction.java trunk/source/gridsim/auction/DoubleAuction.java trunk/source/gridsim/auction/DutchAuction.java trunk/source/gridsim/auction/EnglishAuction.java trunk/source/gridsim/auction/FirstPriceSealedBidAuction.java trunk/source/gridsim/auction/Message.java trunk/source/gridsim/auction/MessageAsk.java trunk/source/gridsim/auction/MessageBid.java trunk/source/gridsim/auction/MessageCallForBids.java trunk/source/gridsim/auction/MessageInformOutcome.java trunk/source/gridsim/auction/MessageInformStart.java trunk/source/gridsim/auction/MessageRejectBid.java trunk/source/gridsim/auction/MessageRejectCallForBid.java trunk/source/gridsim/auction/OneSidedAuction.java trunk/source/gridsim/auction/Responder.java trunk/source/gridsim/auction/ReverseDutchAuction.java trunk/source/gridsim/auction/ReverseEnglishAuction.java trunk/source/gridsim/auction/ReverseFirstPriceSealedBidAuction.java trunk/source/gridsim/datagrid/index/AbstractRC.java trunk/source/gridsim/datagrid/index/RegionalRC.java trunk/source/gridsim/net/RateControlledScheduler.java Modified: trunk/source/gridsim/auction/Auction.java =================================================================== --- trunk/source/gridsim/auction/Auction.java 2008-08-23 06:55:34 UTC (rev 237) +++ trunk/source/gridsim/auction/Auction.java 2008-08-31 07:16:49 UTC (rev 238) @@ -1,359 +1,359 @@ -/* - * Title: GridSim Toolkit - * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation - * of Parallel and Distributed Systems such as Clusters and Grids - * Licence: GPL - http://www.gnu.org/copyleft/gpl.html - * - * Copyright (c) 2006, The University of Melbourne, Australia - */ -package gridsim.auction; - -import eduni.simjava.Sim_event; -import eduni.simjava.Sim_port; -import eduni.simjava.Sim_system; -import gridsim.GridSim; -import gridsim.GridSimTags; -import gridsim.IO_data; - -import java.util.Hashtable; -import java.util.LinkedList; - -/** - * This class represents an auction. This is class has generic - * attributes common to all auctions - * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.0 - * @see gridsim.auction.OneSidedAuction - * @see gridsim.auction.DoubleAuction - * @see gridsim.auction.AuctionTags - */ -public abstract class Auction extends GridSim { - /* - * TODO: Maybe this class does not need to extend GridSim. It could extend - * just Sim_entity. However, to make my experiments easier, I ended up - * extending GridSim. - * - */ - - private int auctionID = -1; - - //starting simulation time - private double startingTime; - - //code of the kind of auction protocol - private int auctionProtocol; - - //additional attributes that need to be assigned to the auction - private Hashtable attributes; - - //list of current bidders engaged in the auction - private LinkedList bidders; - - //used to auto generate auction id - private static int currentID = 0; - - /* The AuctionPolicy will send messages on behalf of the auctioneer, therefore - * it is necessary to specify the auxtioneer's id, so the reply messages - * can be returned to the auctioneer - */ - private int auctioneerID = -1; - - /** - * The Auction output port. This port is mainly used to send - * messages generated by this Auction class. - * This is because an Auction class has to send messages - * on the auctioneer's behalf - */ - protected Sim_port outputPort = null; - - /** - * Default constructor - * @param auctionName name for the auction - * @param auctioneerID the ID of the auctioner because the auction sends messages - * on the auctioneer's behalf - * @param auctionProtocol an int representing the auction protocol - * @param output the auctioneer's output port - * @throws Exception - * @see gridsim.GridSim - */ - public Auction( String auctionName, int auctioneerID, - int auctionProtocol, Sim_port output)throws Exception { - super(auctionName); - this.auctioneerID = auctioneerID; - this.attributes = new Hashtable(); - this.outputPort = output; - setAuctionProtocol(auctionProtocol); - this.auctionID = Auction.genID(); - /* - * TODO: To create a report with information about the auction - */ - } - - /** - * Constructor - * @param auctionName name for the auction - * on the auctioneer's behalf - * @param auctionProtocol an int representing the auction protocol - * @throws Exception - * @see gridsim.GridSim - */ - public Auction( String auctionName, int auctionProtocol)throws Exception { - super(auctionName); - this.attributes = new Hashtable(); - setAuctionProtocol(auctionProtocol); - this.auctionID = Auction.genID(); - /* - * TODO: To create a report with information about the auction - */ - } - - /** - * Returns the auctioneer ID - * @return the ID of a GridSim entity - */ - public int getAuctioneerID(){ - return auctioneerID; - } - - /** - * Sets the id of the auctioneer responsible for this auction - * @param auctioneerID the auctioneer ID - * @return <tt>true</tt> if the id was properly set - */ - public boolean setAuctioneerID(int auctioneerID){ - if(auctioneerID >= 0){ - this.auctioneerID = auctioneerID; - return true; - } - return false; - } - - /** - * Sets the output port to be used by this auction. The output port - * is the auctioneer's output port since the auction sends messages - * on the auctioneer's behalf - * @param output the port to be used - * @return <tt>true</tt> if the output port was properly set - */ - public boolean setOutputPort(Sim_port output){ - if(output!=null){ - this.outputPort = output; - return true; - } - return false; - } - - // Used just to generate a unique ID - //TODO: It might not be necessary, the ID could be the entity's ID - private synchronized static int genID(){ - return currentID++; - } - - /** - * Sets the auction's ID manually - * @param id the id to be used by the auction - * @return <tt>true</tt> if the ID has been set; <tt>false</tt> otherwise. - */ - public boolean setAuctionID(int id) { - if(id < 0) - return false; - - auctionID = id; - return true; - } - - /** - * Returns the ID of this auction - * @return auction ID - */ - public int getAuctionID(){ - return auctionID; - } - - /** - * Sets a list of the bidders associated with this auction - * @param list of bidders. The IDs must be entities' ids - * @pre list != null - * @return <tt>true</tt> if the bidders were correctly set - */ - public boolean setBidders(LinkedList list){ - if(list == null) - return false; - - synchronized(this){ - this.bidders = list; - } - return true; - } - - /** - * Returns the list of bidders - * @return list of GridSim entities' IDs - */ - public LinkedList getBidders(){ - synchronized(this){ - return this.bidders; - } - } - - /** - * Returns the output port used by this auction - * to send messages - * @return the output port - */ - protected Sim_port getOutputPort(){ - return this.outputPort; - } - - /** - * Sets an attribute to this auction. Anything additional has to - * be set as an attribute of the auction. - * @param key the key used to retrieve the value of the attribute - * @param value the value of the attribute - * @pre key != null && value !=null - * @return <tt>true</tt> if the value of the attribute was correctly set - */ - public boolean setAttribute(Object key, Object value){ - if(key == null || value == null) - return false; - - attributes.put(key, value); - return true; - } - - /** - * Returns a Hashtable with the attributes defined in the - * auction. - * @return the attributes defined in this auction - */ - protected Hashtable getAttributes(){ - return attributes; - } - - /** - * Returns a given attribute of the auction - * @param key used to retrieve the attribute - * @return the attribute - */ - public Object getAttribute(Object key){ - return attributes.get(key); - } - - /** - * Sets the auction protocol used by the auction - * @param protocol - * @pre protocol > 0 - * @return <tt>true</tt> if the the auction protocol was properly set - */ - protected boolean setAuctionProtocol(int protocol){ - if(protocol <= 0) - return false; - - auctionProtocol = protocol; - return true; - } - - /** - * Returns the auction protocol - * @return int representing the auction protocol - */ - protected int getAuctionProtocol(){ - return auctionProtocol; - } - - /** - * Sets the initial time of the auction - * @param time is the simulation time - * @pre time >= 0.0D - * @return <tt>true</tt> if the starting time was properly set - */ - protected boolean setStartingTime(double time){ - if(time < 0) - return false; - - startingTime = time; - return true; - } - - /** - * Returns the initial time of the auction - * @return the simulation time in which the auction started - */ - public double getStartingTime(){ - return startingTime; - } - - /** - * Brodcasts a message to all bidders engaged in the auction - * @param msg Message to be broadcast - * @pre Message != null - * @return <tt>true</tt> if the message was properly broadcast - */ - protected synchronized boolean broadcastMessage(Message msg){ - if(msg == null) - return false; - - msg.setSourceID(this.auctioneerID); - msg.setDestinationID(Message.TO_ALL_BIDDERS); - msg.setAuctionID(this.auctionID); - - int tag = -1; - int nBidders = bidders.size(); - if( msg instanceof MessageCallForBids){ - tag = AuctionTags.AUCTION_CFP; - } - else if( msg instanceof MessageInformStart){ - tag = AuctionTags.AUCTION_INFORM_START; - } - else if( msg instanceof MessageInformOutcome){ - tag = AuctionTags.AUCTION_INFORM_OUTCOME; - } - - /* TODO: - * For now, we are assuming that every message has a size of about 100 bytes. - * It would be better to consider some FIPA's encoding schema, for example. - * Please see: www.fipa.org - */ - for(int i=0; i<nBidders; i++){ - int destId = ((Integer)bidders.get(i)).intValue(); - super.sim_schedule(this.outputPort, GridSimTags.SCHEDULE_NOW, - tag, new IO_data(msg, 100, destId)); - } - - return true; - } - - /** - * - */ - public void body(){ - // Process events until END_OF_SIMULATION is received from the - // GridSimShutdown Entity - - Sim_event ev = new Sim_event(); - while ( Sim_system.running() ) - { - super.sim_get_next(ev); - - // if the simulation finishes then exit the loop - if (ev.get_tag() == GridSimTags.END_OF_SIMULATION || - ev.get_tag() == AuctionTags.END_OF_AUCTION){ - break; - } - - // process the received event - processEvent(ev); - } - - // remove I/O entities created during construction of this entity - super.terminateIOEntities(); - } - - protected abstract void processEvent(Sim_event ev); - - /** - * - */ - public abstract void startAuction(); -} +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Copyright (c) 2006, The University of Melbourne, Australia + */ +package gridsim.auction; + +import eduni.simjava.Sim_event; +import eduni.simjava.Sim_port; +import eduni.simjava.Sim_system; +import gridsim.GridSim; +import gridsim.GridSimTags; +import gridsim.IO_data; + +import java.util.Hashtable; +import java.util.LinkedList; + +/** + * This class represents an auction. This is class has generic + * attributes common to all auctions + * + * @author Marcos Dias de Assuncao + * @since GridSim Toolkit 4.0 + * @see gridsim.auction.OneSidedAuction + * @see gridsim.auction.DoubleAuction + * @see gridsim.auction.AuctionTags + */ +public abstract class Auction extends GridSim { + /* + * TODO: Maybe this class does not need to extend GridSim. It could extend + * just Sim_entity. However, to make my experiments easier, I ended up + * extending GridSim. + * + */ + + private int auctionID = -1; + + //starting simulation time + private double startingTime; + + //code of the kind of auction protocol + private int auctionProtocol; + + //additional attributes that need to be assigned to the auction + private Hashtable attributes; + + //list of current bidders engaged in the auction + private LinkedList bidders; + + //used to auto generate auction id + private static int currentID = 0; + + /* The AuctionPolicy will send messages on behalf of the auctioneer, therefore + * it is necessary to specify the auxtioneer's id, so the reply messages + * can be returned to the auctioneer + */ + private int auctioneerID = -1; + + /** + * The Auction output port. This port is mainly used to send + * messages generated by this Auction class. + * This is because an Auction class has to send messages + * on the auctioneer's behalf + */ + protected Sim_port outputPort = null; + + /** + * Default constructor + * @param auctionName name for the auction + * @param auctioneerID the ID of the auctioner because the auction sends messages + * on the auctioneer's behalf + * @param auctionProtocol an int representing the auction protocol + * @param output the auctioneer's output port + * @throws Exception + * @see gridsim.GridSim + */ + public Auction( String auctionName, int auctioneerID, + int auctionProtocol, Sim_port output)throws Exception { + super(auctionName); + this.auctioneerID = auctioneerID; + this.attributes = new Hashtable(); + this.outputPort = output; + setAuctionProtocol(auctionProtocol); + this.auctionID = Auction.genID(); + /* + * TODO: To create a report with information about the auction + */ + } + + /** + * Constructor + * @param auctionName name for the auction + * on the auctioneer's behalf + * @param auctionProtocol an int representing the auction protocol + * @throws Exception + * @see gridsim.GridSim + */ + public Auction( String auctionName, int auctionProtocol)throws Exception { + super(auctionName); + this.attributes = new Hashtable(); + setAuctionProtocol(auctionProtocol); + this.auctionID = Auction.genID(); + /* + * TODO: To create a report with information about the auction + */ + } + + /** + * Returns the auctioneer ID + * @return the ID of a GridSim entity + */ + public int getAuctioneerID(){ + return auctioneerID; + } + + /** + * Sets the id of the auctioneer responsible for this auction + * @param auctioneerID the auctioneer ID + * @return <tt>true</tt> if the id was properly set + */ + public boolean setAuctioneerID(int auctioneerID){ + if(auctioneerID >= 0){ + this.auctioneerID = auctioneerID; + return true; + } + return false; + } + + /** + * Sets the output port to be used by this auction. The output port + * is the auctioneer's output port since the auction sends messages + * on the auctioneer's behalf + * @param output the port to be used + * @return <tt>true</tt> if the output port was properly set + */ + public boolean setOutputPort(Sim_port output){ + if(output!=null){ + this.outputPort = output; + return true; + } + return false; + } + + // Used just to generate a unique ID + //TODO: It might not be necessary, the ID could be the entity's ID + private synchronized static int genID(){ + return currentID++; + } + + /** + * Sets the auction's ID manually + * @param id the id to be used by the auction + * @return <tt>true</tt> if the ID has been set; <tt>false</tt> otherwise. + */ + public boolean setAuctionID(int id) { + if(id < 0) + return false; + + auctionID = id; + return true; + } + + /** + * Returns the ID of this auction + * @return auction ID + */ + public int getAuctionID(){ + return auctionID; + } + + /** + * Sets a list of the bidders associated with this auction + * @param list of bidders. The IDs must be entities' ids + * @pre list != null + * @return <tt>true</tt> if the bidders were correctly set + */ + public boolean setBidders(LinkedList list){ + if(list == null) + return false; + + synchronized(this){ + this.bidders = list; + } + return true; + } + + /** + * Returns the list of bidders + * @return list of GridSim entities' IDs + */ + public LinkedList getBidders(){ + synchronized(this){ + return this.bidders; + } + } + + /** + * Returns the output port used by this auction + * to send messages + * @return the output port + */ + protected Sim_port getOutputPort(){ + return this.outputPort; + } + + /** + * Sets an attribute to this auction. Anything additional has to + * be set as an attribute of the auction. + * @param key the key used to retrieve the value of the attribute + * @param value the value of the attribute + * @pre key != null && value !=null + * @return <tt>true</tt> if the value of the attribute was correctly set + */ + public boolean setAttribute(Object key, Object value){ + if(key == null || value == null) + return false; + + attributes.put(key, value); + return true; + } + + /** + * Returns a Hashtable with the attributes defined in the + * auction. + * @return the attributes defined in this auction + */ + protected Hashtable getAttributes(){ + return attributes; + } + + /** + * Returns a given attribute of the auction + * @param key used to retrieve the attribute + * @return the attribute + */ + public Object getAttribute(Object key){ + return attributes.get(key); + } + + /** + * Sets the auction protocol used by the auction + * @param protocol + * @pre protocol > 0 + * @return <tt>true</tt> if the the auction protocol was properly set + */ + protected boolean setAuctionProtocol(int protocol){ + if(protocol <= 0) + return false; + + auctionProtocol = protocol; + return true; + } + + /** + * Returns the auction protocol + * @return int representing the auction protocol + */ + protected int getAuctionProtocol(){ + return auctionProtocol; + } + + /** + * Sets the initial time of the auction + * @param time is the simulation time + * @pre time >= 0.0D + * @return <tt>true</tt> if the starting time was properly set + */ + protected boolean setStartingTime(double time){ + if(time < 0) + return false; + + startingTime = time; + return true; + } + + /** + * Returns the initial time of the auction + * @return the simulation time in which the auction started + */ + public double getStartingTime(){ + return startingTime; + } + + /** + * Brodcasts a message to all bidders engaged in the auction + * @param msg Message to be broadcast + * @pre Message != null + * @return <tt>true</tt> if the message was properly broadcast + */ + protected synchronized boolean broadcastMessage(Message msg){ + if(msg == null) + return false; + + msg.setSourceID(this.auctioneerID); + msg.setDestinationID(Message.TO_ALL_BIDDERS); + msg.setAuctionID(this.auctionID); + + int tag = -1; + int nBidders = bidders.size(); + if( msg instanceof MessageCallForBids){ + tag = AuctionTags.AUCTION_CFP; + } + else if( msg instanceof MessageInformStart){ + tag = AuctionTags.AUCTION_INFORM_START; + } + else if( msg instanceof MessageInformOutcome){ + tag = AuctionTags.AUCTION_INFORM_OUTCOME; + } + + /* TODO: + * For now, we are assuming that every message has a size of about 100 bytes. + * It would be better to consider some FIPA's encoding schema, for example. + * Please see: www.fipa.org + */ + for(int i=0; i<nBidders; i++){ + int destId = ((Integer)bidders.get(i)).intValue(); + super.sim_schedule(this.outputPort, GridSimTags.SCHEDULE_NOW, + tag, new IO_data(msg, 100, destId)); + } + + return true; + } + + /** + * + */ + public void body(){ + // Process events until END_OF_SIMULATION is received from the + // GridSimShutdown Entity + + Sim_event ev = new Sim_event(); + while ( Sim_system.running() ) + { + super.sim_get_next(ev); + + // if the simulation finishes then exit the loop + if (ev.get_tag() == GridSimTags.END_OF_SIMULATION || + ev.get_tag() == AuctionTags.END_OF_AUCTION){ + break; + } + + // process the received event + processEvent(ev); + } + + // remove I/O entities created during construction of this entity + super.terminateIOEntities(); + } + + protected abstract void processEvent(Sim_event ev); + + /** + * + */ + public abstract void startAuction(); +} Modified: trunk/source/gridsim/auction/AuctionObserver.java =================================================================== --- trunk/source/gridsim/auction/AuctionObserver.java 2008-08-23 06:55:34 UTC (rev 237) +++ trunk/source/gridsim/auction/AuctionObserver.java 2008-08-31 07:16:49 UTC (rev 238) @@ -1,197 +1,197 @@ -/* - * Title: GridSim Toolkit - * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation - * of Parallel and Distributed Systems such as Clusters and Grids - * Licence: GPL - http://www.gnu.org/copyleft/gpl.html - * - * Copyright (c) 2006, The University of Melbourne, Australia - */ -package gridsim.auction; - -import eduni.simjava.Sim_event; -import eduni.simjava.Sim_port; -import eduni.simjava.Sim_system; -import gridsim.GridSim; -import gridsim.GridSimTags; -import gridsim.IO_data; - -/** - * This class is used by entities that want to participate - * as bidders in auctions. - * <p> - * To use this class, you need to redirect the events that - * the entity cannot treat. You need to call - * {@link #processEvent(Sim_event)} passing the event that - * the entity is not able to process. If the event is related - * to the auctions (ie. has a tag code corresponding to an auction event) - * the observer is able to process it by passing the message - * to its Responder. - * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.0 - * @see gridsim.auction.Responder - */ -public class AuctionObserver extends GridSim { - private Responder responder; - private int bidderID; - private Object syncSteps = new Object(); - - /** The Bidder output port. This port is mainly used to send - * messages generated by this AuctionObserver class. - * This is because an AuctionObserver class doesn't have networked - * entities (Input and Output). - */ - protected Sim_port outputPort; - - /** - * Constructor - * @param bidderID the bidder if, since it sends messages on the bidder's behalf - * @param entityName a name for this entity - * @param port the port to be used as output of messages - * @throws Exception - */ - public AuctionObserver(int bidderID, String entityName, Sim_port port) throws Exception { - super(bidderID + "_" + entityName); - this.bidderID = bidderID; - this.outputPort = port; - } - - /** - * Constructor - * @param bidderID the bidder if, since it sends messages on the bidder's behalf - * @param entityName entityName a name for this entity - * @param responder the responder which will deal with the messages - * that this responder receives - * @param port the port to be used as output of messages - * @throws Exception - */ - public AuctionObserver(int bidderID, String entityName, Sim_port port, - Responder responder) throws Exception { - this(bidderID, entityName, port); - this.responder = responder; - } - - /** - * Sets a responder to this observer - * @param responder the responder - * @pre responder != null - * @return <tt>true</tt> if the responder was correctly set - */ - public boolean setResponder(Responder responder){ - if(responder == null) - return false; - - this.responder = responder; - return true; - } - - /** - * Returns the responder that the observer is using - * @return the responder - */ - public Responder getResponder(){ - return responder; - } - - /** - * - */ - public void body(){ - // Process events until END_OF_SIMULATION is received from the - // GridSimShutdown Entity - - Sim_event ev = new Sim_event(); - while ( Sim_system.running() ) - { - super.sim_get_next(ev); - - // if the simulation finishes then exit the loop - if (ev.get_tag() == GridSimTags.END_OF_SIMULATION){ - break; - } - - // process the received event - processEvent(ev); - } - - // remove I/O entities created during construction of this entity - super.terminateIOEntities(); - - } - - - /** - * Process an event. - * @param ev - * @return <tt>true</tt> if the event was treated; <tt>false</tt> otherwise. - */ - public boolean processEvent(Sim_event ev){ - int src_id = -1; - Message msg = null; - Message respMsg = null; - - if (responder == null){ - System.out.println("No responder to deal with auction messages!"); - return false; - } - - switch ( ev.get_tag() ){ - case AuctionTags.AUCTION_INFORM_START: - msg = (Message)ev.get_data(); - src_id = msg.getSourceID(); - synchronized(syncSteps){ - respMsg = responder.onReceiveStartAuction((MessageInformStart)msg); - } - break; - - case AuctionTags.AUCTION_CFP: - msg = (Message)ev.get_data(); - src_id = msg.getSourceID(); - synchronized(syncSteps){ - respMsg = responder.onReceiveCfb((MessageCallForBids)msg); - } - break; - - case AuctionTags.AUCTION_INFORM_OUTCOME: - msg = (Message)ev.get_data(); - src_id = msg.getSourceID(); - synchronized(syncSteps){ - respMsg = responder.onReceiveInformOutcome((MessageInformOutcome)msg); - } - break; - - case AuctionTags.AUCTION_REJECT_PROPOSAL: - msg = (Message)ev.get_data(); - src_id = msg.getSourceID(); - synchronized(syncSteps){ - respMsg = responder.onReceiveRejectProposal((MessageRejectBid)msg); - } - break; - - // other unknown tags are processed by this method - default: - return false; - } - - if(respMsg!=null){ - respMsg.setDestinationID(src_id); - - int tag = - 1; - if(respMsg instanceof MessageBid){ - tag = AuctionTags.AUCTION_PROPOSE; - ((MessageBid)respMsg).setBidder(this.bidderID); - } - else if(respMsg instanceof MessageRejectCallForBid){ - tag = AuctionTags.AUCTION_REJECT_CALL_FOR_BID; - ((MessageRejectCallForBid)respMsg).setBidder(this.bidderID); - } - - double scheduleAt = (respMsg.getScheduleTime() > 0.0) ? - respMsg.getScheduleTime() : GridSimTags.SCHEDULE_NOW; - - super.sim_schedule(this.outputPort, scheduleAt, - tag, new IO_data(respMsg, 100, src_id)); - } - return true; - } -} +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Copyright (c) 2006, The University of Melbourne, Australia + */ +package gridsim.auction; + +import eduni.simjava.Sim_event; +import eduni.simjava.Sim_port; +import eduni.simjava.Sim_system; +import gridsim.GridSim; +import gridsim.GridSimTags; +import gridsim.IO_data; + +/** + * This class is used by entities that want to participate + * as bidders in auctions. + * <p> + * To use this class, you need to redirect the events that + * the entity cannot treat. You need to call + * {@link #processEvent(Sim_event)} passing the event that + * the entity is not able to process. If the event is related + * to the auctions (ie. has a tag code corresponding to an auction event) + * the observer is able to process it by passing the message + * to its Responder. + * + * @author Marcos Dias de Assuncao + * @since GridSim Toolkit 4.0 + * @see gridsim.auction.Responder + */ +public class AuctionObserver extends GridSim { + private Responder responder; + private int bidderID; + private Object syncSteps = new Object(); + + /** The Bidder output port. This port is mainly used to send + * messages generated by this AuctionObserver class. + * This is because an AuctionObserver class doesn't have networked + * entities (Input and Output). + */ + protected Sim_port outputPort; + + /** + * Constructor + * @param bidderID the bidder if, since it sends messages on the bidder's behalf + * @param entityName a name for this entity + * @param port the port to be used as output of messages + * @throws Exception + */ + public AuctionObserver(int bidderID, String entityName, Sim_port port) throws Exception { + super(bidderID + "_" + entityName); + this.bidderID = bidderID; + this.outputPort = port; + } + + /** + * Constructor + * @param bidderID the bidder if, since it sends messages on the bidder's behalf + * @param entityName entityName a name for this entity + * @param responder the responder which will deal with the messages + * that this responder receives + * @param port the port to be used as output of messages + * @throws Exception + */ + public AuctionObserver(int bidderID, String entityName, Sim_port port, + Responder responder) throws Exception { + this(bidderID, entityName, port); + this.responder = responder; + } + + /** + * Sets a responder to this observer + * @param responder the responder + * @pre responder != null + * @return <tt>true</tt> if the responder was correctly set + */ + public boolean setResponder(Responder responder){ + if(responder == null) + return false; + + this.responder = responder; + return true; + } + + /** + * Returns the responder that the observer is using + * @return the responder + */ + public Responder getResponder(){ + return responder; + } + + /** + * + */ + public void body(){ + // Process events until END_OF_SIMULATION is received from the + // GridSimShutdown Entity + + Sim_event ev = new Sim_event(); + while ( Sim_system.running() ) + { + super.sim_get_next(ev); + + // if the simulation finishes then exit the loop + if (ev.get_tag() == GridSimTags.END_OF_SIMULATION){ + break; + } + + // process the received event + processEvent(ev); + } + + // remove I/O entities created during construction of this entity + super.terminateIOEntities(); + + } + + + /** + * Process an event. + * @param ev + * @return <tt>true</tt> if the event was treated; <tt>false</tt> otherwise. + */ + public boolean processEvent(Sim_event ev){ + int src_id = -1; + Message msg = null; + Message respMsg = null; + + if (responder == null){ + System.out.println("No responder to deal with auction messages!"); + return false; + } + + switch ( ev.get_tag() ){ + case AuctionTags.AUCTION_INFORM_START: + msg = (Message)ev.get_data(); + src_id = msg.getSourceID(); + synchronized(syncSteps){ + respMsg = responder.onReceiveStartAuction((MessageInformStart)msg); + } + break; + + case AuctionTags.AUCTION_CFP: + msg = (Message)ev.get_data(); + src_id = msg.getSourceID(); + synchronized(syncSteps){ + respMsg = responder.onReceiveCfb((MessageCallForBids)msg); + } + break; + + case AuctionTags.AUCTION_INFORM_OUTCOME: + msg = (Message)ev.get_data(); + src_id = msg.getSourceID(); + synchronized(syncSteps){ + respMsg = responder.onReceiveInformOutcome((MessageInformOutcome)msg); + } + break; + + case AuctionTags.AUCTION_REJECT_PROPOSAL: + msg = (Message)ev.get_data(); + src_id = msg.getSourceID(); + synchronized(syncSteps){ + respMsg = responder.onReceiveRejectProposal((MessageRejectBid)msg); + } + break; + + // other unknown tags are processed by this method + default: + return false; + } + + if(respMsg!=null){ + respMsg.setDestinationID(src_id); + + int tag = - 1; + if(respMsg instanceof MessageBid){ + tag = AuctionTags.AUCTION_PROPOSE; + ((MessageBid)respMsg).setBidder(this.bidderID); + } + else if(respMsg instanceof MessageRejectCallForBid){ + tag = AuctionTags.AUCTION_REJECT_CALL_FOR_BID; + ((MessageRejectCallForBid)respMsg).setBidder(this.bidderID); + } + + double scheduleAt = (respMsg.getScheduleTime() > 0.0) ? + respMsg.getScheduleTime() : GridSimTags.SCHEDULE_NOW; + + super.sim_schedule(this.outputPort, scheduleAt, + tag, new IO_data(respMsg, 100, src_id)); + } + return true; + } +} Modified: trunk/source/gridsim/auction/AuctionTags.java =================================================================== --- trunk/source/gridsim/auction/AuctionTags.java 2008-08-23 06:55:34 UTC (rev 237) +++ trunk/source/gridsim/auction/AuctionTags.java 2008-08-31 07:16:49 UTC (rev 238) @@ -1,91 +1,91 @@ -/* - * Title: GridSim Toolkit - * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation - * of Parallel and Distributed Systems such as Clusters and Grids - * Licence: GPL - http://www.gnu.org/copyleft/gpl.html - * - * Copyright (c) 2006, The University of Melbourne, Australia - */ -package gridsim.auction; - -/** - * Contains various static command tags that indicate a type of action that - * needs to be undertaken by auction entities when they receive or send events. - * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.0 - * @see gridsim.auction.OneSidedAuction - * @see gridsim.auction.DoubleAuction - * @see gridsim.auction.AuctionTags - */ -public class AuctionTags { - - private static final int BASE = 900; - - /** Event used by messages that inform the start of an auction */ - public static final int AUCTION_INFORM_START = BASE + 1; - - /** Represents the rejects of a proposal */ - public static final int AUCTION_REJECT_CALL_FOR_BID = BASE + 2; - - /** It means a call for bids or proposals */ - public static final int AUCTION_CFP = BASE + 3; - - /** Proposal or bid */ - public static final int AUCTION_PROPOSE = BASE + 4; - - /** Represents an ask sent to an auctioneer */ - public static final int AUCTION_ASK = BASE + 5; - - /** Used to inform that a bid has been accepted */ - public static final int AUCTION_ACCEPT_PROPOSAL = BASE + 6; - - /** It is used to reject a proposal */ - public static final int AUCTION_REJECT_PROPOSAL = BASE + 7; - - /** This code is used to events that inform the final outcome of an auction */ - public static final int AUCTION_INFORM_OUTCOME = BASE + 8; - - /** Used to inform that a match for an ask has been found */ - public static final int AUCTION_MATCH_TO_ASK = BASE + 9; - - /** An auction must be post to an auctioneer. This event has this purpose. */ - public static final int AUCTION_POST = BASE + 10; - - /** Event code used to trigger or start an auction */ - public static final int AUCTION_START = BASE + 11; - - /** Event code used to inform auctioneer that an auction has finished */ - public static final int AUCTION_FINISHED = BASE + 12; - - /** Used to inform the auctioneer that an auction must be deleted */ - public static final int AUCTION_DELETE = BASE + 13; - - /** Used to stop an auction and to stop the execution of its <tt>body()</tt> method. */ - public static final int END_OF_AUCTION = BASE + 14; - - /** Internal event code internally by auctions to control timeout of rounds and auctions */ - public static final int AUCTION_TIMEOUT = BASE + 15; - - //Code for some kinds of auctions - /** This code is used by First-Price Sealed Bid auctions */ - public static final int FIRST_PRICE_SEALED_AUCTION = 1; - - /** This code is used by Reverse First-Price Sealed Bid auctions */ - public static final int REVERSE_FIRST_PRICE_SEALED_AUCTION = 2; - - /** This code is used by English auctions */ - public static final int ENGLISH_AUCTION = 3; - - /** This code is used by Reverse English auctions */ - public static final int REVERSE_ENGLISH_AUCTION = 4; - - /** This code is used by Dutch auctions */ - public static final int DUTCH_AUCTION = 5; - - /** This code is used by Reverse Dutch auctions */ - public static final int REVERSE_DUTCH_AUCTION = 6; - - /** This code is used by Continuous Double auctions */ - public static final int CONTINUOUS_DOUBLE_AUCTION = 7; -} +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Copyright (c) 2006, The University of Melbourne, Australia + */ +package gridsim.auction; + +/** + * Contains various static command tags that indicate a type of action that + * needs to be undertaken by auction entities when they receive or send events. + * + * @author Marcos Dias de Assuncao + * @since GridSim Toolkit 4.0 + * @see gridsim.auction.OneSidedAuction + * @see gridsim.auction.DoubleAuction + * @see gridsim.auction.AuctionTags + */ +public class AuctionTags { + + private static final int BASE = 900; + + /** Event used by messages that inform the start of an auction */ + public static final int AUCTION_INFORM_START = BASE + 1; + + /** Represents the rejects of a proposal */ + public static final int AUCTION_REJECT_CALL_FOR_BID = BASE + 2; + + /** It means a call for bids or proposals */ + public static final int AUCTION_CFP = BASE + 3; + + /** Proposal or bid */ + public static final int AUCTION_PROPOSE = BASE + 4; + + /** Represents an ask sent to an auctioneer */ + public static final int AUCTION_ASK = BASE + 5; + + /** Used to inform that a bid has been accepted */ + public static final int AUCTION_ACCEPT_PROPOSAL = BASE + 6; + + /** It is used to reject a proposal */ + public static final int AUCTION_REJECT_PROPOSAL = BASE + 7; + + /** This code is used to events that inform the final outcome of an auction */ + public static final int AUCTION_INFORM_OUTCOME = BASE + 8; + + /** Used to inform that a match for an ask has been found */ + public static final int AUCTION_MATCH_TO_ASK = BASE + 9; + + /** An auction must be post to an auctioneer. This event has this purpose. */ + public static final int AUCTION_POST = BASE + 10; + + /** Event code used to trigger or start an auction */ + public static final int AUCTION_START = BASE + 11; + + /** Event code used to inform auctioneer that an auction has finished */ + public static final int AUCTION_FINISHED = BASE + 12; + + /** Used to inform the auctioneer that an auction must be deleted */ + public static final int AUCTION_DELETE = BASE + 13; + + /** Used to stop an auction and to stop the execution of its <tt>body()</tt> method. */ + public static final int END_OF_AUCTION = BASE + 14; + + /** Internal event code internally by auctions to control timeout of rounds and auctions */ + public static final int AUCTION_TIMEOUT = BASE + 15; + + //Code for some kinds of auctions + /** This code is used by First-Price Sealed Bid auctions */ + public static final int FIRST_PRICE_SEALED_AUCTION = 1; + + /** This code is used by Reverse First-Price Sealed Bid auctions */ + public static final int REVERSE_FIRST_PRICE_SEALED_AUCTION = 2; + + /** This code is used by English auctions */ + public static final int ENGLISH_AUCTION = 3; + + /** This code is used by Reverse English auctions */ + public static final int REVERSE_ENGLISH_AUCTION = 4; + + /** This code is used by Dutch auctions */ + public static final int DUTCH_AUCTION = 5; + + /** This code is used by Reverse Dutch auctions */ + public static final int REVERSE_DUTCH_AUCTION = 6; + + /** This code is used by Continuous Double auctions */ + public static final int CONTINUOUS_DOUBLE_AUCTION = 7; +} Modified: trunk/source/gridsim/auction/Auctioneer.java =================================================================== --- trunk/source/gridsim/auction/Auctioneer.java 2008-08-23 06:55:34 UTC (rev 237) +++ trunk/source/gridsim/auction/Auctioneer.java 2008-08-31 07:16:49 UTC (rev 238) @@ -1,295 +1,295 @@ -/* - * Title: GridSim Toolkit - * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation - * of Parallel and Distributed Systems such as Clusters and Grids - * Licence: GPL - http://www.gnu.org/copyleft/gpl.html - * - * Copyright (c) 2006, The University of Melbourne, Australia - */ -package gridsim.auction; - -import eduni.simjava.Sim_event; -import eduni.simjava.Sim_system; -import gridsim.GridSim; -import gridsim.GridSimTags; -import gridsim.net.Link; - -import java.util.Hashtable; -import java.util.LinkedList; - -/** - * This class defines the basic behavious of an auctioneer - * - * @author Marcos Dias de Assuncao - * @since GridSim Toolkit 4.0 - * @see gridsim.GridSim - */ -public abstract class Auctioneer extends GridSim { - private Hashtable auctions; - private Object syncSteps = new Object(); - - /** - * Constructor - * @param name - * @throws Exception - */ - public Auctioneer(String name) throws Exception { - super(name); - auctions = new Hashtable(); - } - - /** - * Constructor - * @param name - * @param baudRate - * @throws Exception - */ - public Auctioneer(String name, double baudRate) throws Exception { - super(name, baudRate); - auctions = new Hashtable(); - } - - /** - * @param name - * @param link - * @throws Exception - */ - public Auctioneer(String name, Link link) throws Exception { - super(name, link); - auctions = new Hashtable(); - } - - /** - * Adds an auction to this auctioneer - * @param auction - */ - public void addAuction(Auction auction){ - Integer key = new Integer(auction.getAuctionID()); - synchronized(syncSteps){ - auctions.put(key, auction); - } - } - - /* - * Removes an auction that has finished - * @param auction the auction ID - */ - private void removeAuction(int auctionID){ - Integer key = new Integer(auctionID); - synchronized(syncSteps){ - Auction auc = (Auction)auctions.get(key); - auctions.remove(key); - super.send(auc.get_id(), - GridSimTags.SCHEDULE_NOW, - AuctionTags.END_OF_AUCTION); - } - } - - /** - * Starts a given auction already added to the auctioneer - * @param auctionID The auction's id - */ - public void startAuction(int auctionID){ - Integer key = new Integer(auctionID); - synchronized(syncSteps){ - Auction auction = (Auction)auctions.get(key); - if(auction!=null){ - super.send(auction.get_id(), - GridSimTags.SCHEDULE_NOW, - AuctionTags.AUCTION_START); - } - else - System.err.println("Auctioneer.startAution(): "+ - "This auction does not exist. Auction ID = " + auctionID); - } - } - - /** - * Handles external events that are coming to this Auctioneer entity. - * <p> - * The services or tags available for this resource are: - * <ul> - * <li> {@link gridsim.auction.AuctionTags#AUCTION_POST} </li> - * <li> {@link gridsim.auction.AuctionTags#AUCTION_START} </li> - * <li> {@link gridsim.auction.AuctionTags#AUCTION_DELETE} </li> - * <li> {$link gridsim.auction.AuctionTags#AUCTION_FINISHED} </li> - * <li> {@link gridsim.auction.AuctionTags#AUCTION_PROPOSE} </li> - * <li> {@link gridsim.auction.AuctionTags#AUCTION_REJECT_CALL_FOR_BID} </li> - * <li> {@link gridsim.auction.AuctionTags#AUCTION_ASK} </li> - * <li> {@link gridsim.auction.AuctionTags#AUCTION_MATCH_TO_ASK} </li> - * </ul> - * <br> - * This method also calls these methods in the following order: - * <ol> - * <li> {@link #processOtherEvent(Sim_event)} method - * </ol> - * - * @pre $none - * @post $none - */ - public void body(){ - // Process events until END_OF_SIMULATION is received from the - // GridSimShutdown Entity - - Sim_event ev = new Sim_event(); - while ( Sim_system.running() ) - { - super.sim_get_next(ev); - - // if the simulation finishes then exit the loop - if (ev.get_tag() == GridSimTags.END_OF_SIMULATION){ - break; - } - - // process the received event - processEvent(ev); - } - - // remove I/O entities created during construction of this entity - super.terminateIOEntities(); - } - - /** - * Processes events or services that are available to this Auctioneer - * @param ev a Sim_event object - * @pre ev != null - * @post $none - */ - private void processEvent(Sim_event ev) - { - Auction auc = null; - Message msg = null; - Integer auctionID = null; - - switch ( ev.get_tag() ) - { - case AuctionTags.AUCTION_POST: - auc = (Auction)ev.get_data(); - addAuction(auc); // just adds the auction in the hashtable - break; - - case AuctionTags.AUCTION_START: - auctionID = (Integer)ev.get_data(); - startAuction(auctionID.intValue()); // starts the auction that was previously added - break; - - case AuctionTags.AUCTION_DELETE: - auctionID = (Integer)ev.get_data(); - removeAuction(auctionID.intValue()); - break; - - case AuctionTags.AUCTION_FINISHED: - auc = (Auction)auctions.get((Integer)ev.get_data()); - synchronized(syncSteps){ - this.onAuctionClose(auc); - // trigger the event to delete this auction from the list - super.send(get_id(), GridSimTags.SCHEDULE_NOW, - AuctionTags.AUCTION_DELETE, new Integer(auc.getAuctionID())); - } - break; - - // deal with proposal that has been sent - case AuctionTags.AUCTION_PROPOSE: - Auction auction_p = null; - msg = (Message)ev.get_data(); - MessageBid bid = (MessageBid)msg; - auction_p = (Auction)auctions.get(new Integer(bid.getAuctionID())); - synchronized(syncSteps){ - if(auction_p != null){ - if(auction_p instanceof OneSidedAuction){ - if(((OneSidedAuction)auction_p).currentRound() == bid.getRound()){ - super.send(auction_p.get_id(), GridSimTags.SCHEDULE_NOW, - AuctionTags.AUCTION_PROPOSE, bid); - } - } - else{ - super.send(auction_p.get_id(), GridSimTags.SCHEDULE_NOW, - AuctionTags.AUCTION_PROPOSE, bid); - } - } - } - break; - - case AuctionTags.AUCTION_REJECT_CALL_FOR_BID: - msg = (Message)ev.get_data(); - MessageRejectCallForBid rej = (MessageRejectCallForBid)msg; - auc = (Auction)auctions.get(new Integer(rej.getAuctionID())); - synchronized(syncSteps){ - if(auc != null){ - if(auc instanceof OneSidedAuction) - if(((OneSidedAuction)auc).currentRound() == rej.getRound()){ - super.send(auc.get_id(), GridSimTags.SCHEDULE_NOW, - AuctionTags.AUCTION_REJECT_CALL_FOR_BID, rej); - } - } - } - break; - - // deal with ask that has been sent - case AuctionTags.AUCTION_ASK: - msg = (Message)ev.get_data(); - MessageAsk ask = (MessageAsk)msg; - auc = (Auction)auctions.get(new Integer(ask.getAuctionID())); - if(auc != null){ - if(auc instanceof DoubleAuction){ - super.send(auc.get_id(), GridSimTags.SCHEDULE_NOW, - AuctionTags.AUCTION_ASK, ask); - } - } - break; - - case AuctionTags.AUCTION_MATCH_TO_ASK: - LinkedList mat = (LinkedList)ev.get_data(); - synchronized(syncSteps){ - MessageAsk a = (MessageAsk)mat.get(0); - MessageBid b = (MessageBid)mat.get(1); - double p = ((Double)mat.get(2)).doubleValue(); - // call the method to process match to ask - this.onResponseToAsk(a,b,p); - } - break; - - // other unknown tags are processed by this method - default: - processOtherEvent(ev); - break; - } - } - - /** - * Overrides this method when making a new and different type of auctioneer. - * This method is called by {@link #body()} for incoming unknown tags. - * - * @param ev a Sim_event object - * @pre ev != null - * @post $none - */ - protected void processOtherEvent(Sim_event ev){ - if (ev == null){ - System.out.println("Auctioneer.processEvent(): " + super.get_name() - + " is has asked to process a null event."); - return; - } - } - - /** - * This method should be implemented to perform some auction after - * some auction has been finished. This method will be called whenever - * one of the auctions that were initiated by this Auctionerr has been concluded - * @param auction is the auction that has been concluded - */ - protected abstract void onAuctionClose(Auction auction); - - /** - * This method is called when a match for an ask was found by a double - * auction. The auction passes the ask, the bid that matches it and the - * price that they will use to trade - * @param ask the ask previously sent to the auctioneer - * @param bid the bid that matches the ask - * @param price the price used to trade - * @post the bid can be null if a match was not found - */ - protected abstract void onResponseToAsk(MessageAsk ask, MessageBid bid, double price); - - -} +/* + * Title: GridSim Toolkit + * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation + * of Parallel and Distributed Systems such as Clusters and Grids + * Licence: GPL - http://www.gnu.org/copyleft/gpl.html + * + * Copyright (c) 2006, The University of Melbourne, Australia + */ +package gridsim.auction; + +import eduni.simjava.Sim_event; +import eduni.simjava.Sim_system; +import gridsim.GridSim; +import gridsim.GridSimTags; +import gridsim.net.Link; + +import java.util.Hashtable; +import java.util.LinkedList; + +/** + * This class defines the basic behavious of an auctioneer + * + * @author Marcos Dias de Assuncao + * @since GridSim Toolkit 4.0 + * @see gridsim.GridSim + */ +public abstract class Auctioneer extends GridSim { + private Hashtable auctions; + private Object syncSteps = new Object(); + + /** + * Constructor + * @param name + * @throws Exception + */ + public Auctioneer(String name) throws Exception { + super(name); + auctions = new Hashtable(); + } + + /** + * Constructor + * @param name + * @param baudRate + * @throws Exception + */ + public Auctioneer(String name, double baudRate) throws Exception { + super(name, baudRate); + auctions = new Hashtable(); + } + + /** + * @param name + * @param link + * @throws Exception + */ + public Auctioneer(String name, Link link) throws Exception { + super(name, link); + auctions = new Hashtable(); + } + + /** + * Adds an auction to this auctioneer + * @param auction + */ + public void addAuction(Auction auction){ + Integer key = new Integer(auction.getAuctionID()); + synchronized(syncSteps){ + auctions.put(key, auction); + } + } + + /* + * Removes an auction that has finished + * @param auction the auction ID + */ + private void removeAuction(int auctionID){ + Integer key = new Integer(auctionID); + synchronized(syncSteps){ + Auction auc = (Auction)auctions.get(key); + auctions.remove(key); + super.send(auc.get_id(), + GridSimTags.SCHEDULE_NOW, + AuctionTags.END_OF_AUCTION); + } + } + + /** + * Starts a given auction already added to the auctioneer + * @param auctionID The auction's id + */ + public void startAuction(int auctionID){ + Integer key = new Integer(auctionID); + synchronized(syncSteps){ + Auction auction = (Auction)auctions.get(key); + if(auction!=null){ + super.send(auction.get_id(), + GridSimTags.SCHEDULE_NOW, + AuctionTags.AUCTION_START); + } + else + System.err.println("Auctioneer.startAution(): "+ + "This auction does not exist. Auction ID = " + auctionID); + } + } + + /** + * Handles external events that are coming to this Auctioneer entity. + * <p> + * The services or tags available for this resource are: + * <ul> + * <li> {@link gridsim.auction.AuctionTags#AUCTION_POST} </li> + * <li> {@link gridsim.auction.AuctionTags#AUCTION_START} </li> + * <li> {@link gridsim.auction.AuctionTags#AUCTION_DELETE} </li> + * <li> {$link gridsim.auction.AuctionTags#AUCTION_FINISHED} </li> + * <li> {@link gridsim.auction.AuctionTags#AUCTION_PROPOSE} </li> + * <li> {@link gridsim.auction.AuctionTags#AUCTION_REJECT_CALL_FOR_BID} </li> + * <li> {@link gridsim.auction.AuctionTags#AUCTION_ASK} </li> + * <li> {@link gridsim.auction.AuctionTags#AUCTION_MATCH_TO_ASK} </li> + * </ul> + * <br> + * This method also calls these methods in the following order: + * <ol> + * <li> {@link #processOtherEvent(Sim_event)} method + * </ol> + * + * @pre $none + * @post $none + */ + public void body(){ + // Process events until END_OF_SIMULATION is received from the + // GridSimShutdown Entity + + Sim_event ev = new Sim_event(); + while ( Sim_system.running() ) + { + super.sim_get_next(ev); + + // if the simulation finishes then exit the loop + if (ev.get_tag() == GridSimTags.END_OF_SIMULATION){ + break; + } + + // process the received event + processEvent(ev); + } + + // remove I/O entities created during construction of this entity + super.terminateIOEntities(); + } + + /** + * Processes events or services that are available to this Auctioneer + * @param ev a Sim_event object + * @pre ev != null + * @post $none + */ + private void processEvent(Sim_event ev) + { + Auction auc = null; + Message msg = null; + Integer auctionID = null; + + switch ( ev.get_tag() ) + { + case AuctionTags.AUCTION_POST: + auc = (Auction)ev.get_data(); + addAuction(auc); // just adds the auction in the hashtable + break; + + case AuctionTags.AUCTION_START: + auctionID = (Integer)ev.get_data(); + startAuction(auctionID.intValue()); // starts the auction that was previously added + break; + + case AuctionTags.AUCTION_DELETE: + auctionID = (Integer)ev.get_data(); + removeAuction(auctionID.intValue()); + break; + + case AuctionTags.AUCTION_FINISHED: + auc = (Auction)auctions.get((Integer)ev.get_data()); + synchronized(syncSteps){ + this.onAuctionClose(auc); + // trigger the event to delete this auction from the list + super.send(get_id(), GridSimTags.SCHEDULE_NOW, + AuctionTags.AUCTION_DELETE, new Integer(auc.getAuctionID())); + } + break; + + // deal with proposal that has been sent + case AuctionTags.AUCTION_PROPOSE: + Auction auction_p = null; + msg = (Message)ev.get_data(); + MessageBid bid = (MessageBid)msg; + auction_p = (Auction)auctions.get(new Integer(bid.getAuctionID())); + synchronized(syncSteps){ + if(auction_p != null){ + if(auction_p instanceof OneSidedAuction){ + if(((OneSidedAuction)auction_p).currentRound() == bid.getRound()){ + super.send(auction_p.get_id(), GridSimTags.SCHEDULE_NOW, + AuctionTags.AUCTION_PROPOSE, bid); + } + } + else{ + super.send(auction_p.get_id(), GridSimTags.SCHEDULE_NOW, + AuctionTags.AUCTION_PROPOSE, bid); + } + } + } + break; + + case AuctionTags.AUCTION_REJECT_CALL_FOR_BID: + msg = (Message)ev.get_data(); + MessageRejectCallForBid rej = (MessageRejectCallForBid)msg; + auc = (Auction)auctions.get(new Integer(rej.getAuctionID())); + synchronized(syncSteps){ + if(auc != null){ + if(auc instanceof OneSidedAuction) + if(((OneSidedAuction)auc).currentRound() == rej.getRound()){ + super.send(auc.get_id(), GridSimTags.SCHEDULE_NOW, + AuctionTags.AUCTION_REJECT_CALL_FOR_BID, rej); + } + } + } + break; + + // deal with ask that has been sent + case AuctionTags.AUCTION_ASK: + msg = (Message)ev.get_data(); + MessageAsk ask = (MessageAsk)msg; + auc = (Auction)auctions.get(new Integer(ask.getAuctionID())); + if(auc != null){ + if(auc instanceof DoubleAuction){ + super.send(auc.get_id(), GridSimTags.SCHEDULE_NOW, + AuctionTags.AUCTION_ASK, ask); + } + } + break; + + case AuctionTags.AUCTION_MATCH_TO_ASK: + LinkedList mat = (LinkedList)ev.get_data(); + synchronized(syncSteps){ + MessageAsk a = (MessageAsk)mat.get(0); + MessageBid b = (MessageBid)mat.get(1); + double p = ((Double)mat.get(2)).doubleValue(); + // call the method to process match to ask + this.onResponseToAsk(a,b,p); + } + break; + + // other unknown tags are processed by this method + default: + processOtherEvent(ev); + break; + } + } + + /** + * Overrides this method when making a new and different type of auctioneer. + * This method is called by {@link #body()} for incoming unknown tags. + * + * @param ev a Sim_event object + * @pre ev != null + * @post $none + */ + protected void processOtherEvent(Sim_event ev){ + if (ev == null){ + System.out.println("Auctioneer.processEvent(): " + super.get_name() + + " is has asked to process a null event."); + return; + } + } + + /** + * This method should be implemented to perform some auction after + * some auction h... [truncated message content] |
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. |
From: <sul...@us...> - 2008-08-23 05:40:07
|
Revision: 236 http://gridsim.svn.sourceforge.net/gridsim/?rev=236&view=rev Author: sulistio Date: 2008-08-23 05:40:09 +0000 (Sat, 23 Aug 2008) Log Message: ----------- modify the build file to clean existing class files. Modified Paths: -------------- trunk/build.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2008-08-21 12:58:32 UTC (rev 235) +++ trunk/build.xml 2008-08-23 05:40:09 UTC (rev 236) @@ -63,6 +63,10 @@ <jar destfile="${jar.dir}/new_gridsim.jar" basedir="${class.dir}" /> </target> + <target name="clean" description="clean up" > + <delete dir="${class.dir}/gridsim"/> + </target> + </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mkr...@us...> - 2008-08-21 12:58:32
|
Revision: 235 http://gridsim.svn.sourceforge.net/gridsim/?rev=235&view=rev Author: mkrystek Date: 2008-08-21 12:58:32 +0000 (Thu, 21 Aug 2008) Log Message: ----------- change package for example classes Modified Paths: -------------- branches/gssim/examples/Auction/AuctionEx01/AuctionResource.java branches/gssim/examples/Auction/AuctionEx01/Broker.java branches/gssim/examples/Auction/AuctionEx01/ExampleAuction.java branches/gssim/examples/Auction/AuctionEx01/ResponderImpl.java branches/gssim/examples/Auction/AuctionEx02/AuctionResource.java branches/gssim/examples/Auction/AuctionEx02/Broker.java branches/gssim/examples/Auction/AuctionEx02/ExampleAuction.java branches/gssim/examples/Auction/AuctionEx02/NetUser.java branches/gssim/examples/Auction/AuctionEx02/ResponderImpl.java branches/gssim/examples/Auction/AuctionEx03/AuctionResource.java branches/gssim/examples/Auction/AuctionEx03/Broker.java branches/gssim/examples/Auction/AuctionEx03/ExampleAuction.java branches/gssim/examples/Auction/AuctionEx03/NetUser.java branches/gssim/examples/Auction/AuctionEx03/ResponderImpl.java branches/gssim/examples/DataGrid/example1/DataExample1.java branches/gssim/examples/DataGrid/example1/DummyUser.java branches/gssim/examples/DataGrid/example2/DataExample2.java branches/gssim/examples/DataGrid/example2/FileUser.java branches/gssim/examples/DataGrid/example3/DataGridletExample.java branches/gssim/examples/DataGrid/example3/DataGridletUser.java branches/gssim/examples/DataGrid/example4/DataGridSim.java branches/gssim/examples/DataGrid/example4/FilesReader.java branches/gssim/examples/DataGrid/example4/ParameterReader.java branches/gssim/examples/DataGrid/example4/ResourceReader.java branches/gssim/examples/DataGrid/example4/SimUser.java branches/gssim/examples/DataGrid/example4/UserReader.java branches/gssim/examples/Example01/Example1.java branches/gssim/examples/Example02/Example2.java branches/gssim/examples/Example03/Example3.java branches/gssim/examples/Example03/Test.java branches/gssim/examples/Example04/Example4.java branches/gssim/examples/Example05/Example5.java branches/gssim/examples/Example06/Example6.java branches/gssim/examples/Example07/Test.java branches/gssim/examples/Example07/TestCase1.java branches/gssim/examples/Example07/TestCase2.java branches/gssim/examples/Example07/TestCase3.java branches/gssim/examples/Example07/TestCase4.java branches/gssim/examples/Example07/TestCase5.java branches/gssim/examples/Example07/TestCase6.java branches/gssim/examples/Example07/TestCase7.java branches/gssim/examples/Example07/TestCase8.java branches/gssim/examples/Example08/Example8.java branches/gssim/examples/Example08/NewPolicy.java branches/gssim/examples/Example09/Example9.java branches/gssim/examples/Example09/NewGIS.java branches/gssim/examples/Example09/NewGridResource.java branches/gssim/examples/Example10/ARTest.java branches/gssim/examples/Example10/Example10.java branches/gssim/examples/Network/NetEx01/NetEx01.java branches/gssim/examples/Network/NetEx01/NetUser.java branches/gssim/examples/Network/NetEx01/Test.java branches/gssim/examples/Network/NetEx02/NetEx02.java branches/gssim/examples/Network/NetEx02/NetUser.java branches/gssim/examples/Network/NetEx03/NetEx03.java branches/gssim/examples/Network/NetEx03/NetUser.java branches/gssim/examples/Network/RateExample/NetUser.java branches/gssim/examples/Network/RateExample/RateExample.java branches/gssim/examples/Network/SCFQExample/NetUser.java branches/gssim/examples/Network/SCFQExample/SCFQExample.java branches/gssim/examples/RegionalGIS/ExampleGIS.java branches/gssim/examples/RegionalGIS/NetUserGIS.java branches/gssim/examples/ResFailure/ResFailureEx01/GridUserFailureEx01.java branches/gssim/examples/ResFailure/ResFailureEx01/GridletSubmission.java branches/gssim/examples/ResFailure/ResFailureEx01/ResFailureEx01.java branches/gssim/examples/ResFailure/ResFailureEx02/GridUserFailureEx02.java branches/gssim/examples/ResFailure/ResFailureEx02/GridletSubmission.java branches/gssim/examples/ResFailure/ResFailureEx02/ResFailureEx02.java branches/gssim/examples/ResFailure/ResFailureEx03/GridUserFailureEx03.java branches/gssim/examples/ResFailure/ResFailureEx03/GridletSubmission.java branches/gssim/examples/ResFailure/ResFailureEx03/ResFailureEx03.java branches/gssim/examples/WorkloadTrace/TraceEx01/TraceEx01.java branches/gssim/examples/WorkloadTrace/TraceEx02/TraceEx02.java branches/gssim/examples/WorkloadTrace/TraceEx02/User.java branches/gssim/examples/WorkloadTrace/TraceEx03/NetUser.java branches/gssim/examples/WorkloadTrace/TraceEx03/TraceEx03.java Modified: branches/gssim/examples/Auction/AuctionEx01/AuctionResource.java =================================================================== --- branches/gssim/examples/Auction/AuctionEx01/AuctionResource.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Auction/AuctionEx01/AuctionResource.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * Description: A simple program to demonstrate of how to use GridSim * auction extension package. */ - +package Auction.AuctionEx01; import eduni.simjava.Sim_event; import gridsim.AllocPolicy; import gridsim.GridResource; Modified: branches/gssim/examples/Auction/AuctionEx01/Broker.java =================================================================== --- branches/gssim/examples/Auction/AuctionEx01/Broker.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Auction/AuctionEx01/Broker.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * Description: A simple program to demonstrate of how to use GridSim * auction extension package. */ - +package Auction.AuctionEx01; import eduni.simjava.Sim_event; import eduni.simjava.distributions.Sim_uniform_obj; import gridsim.GridSimTags; Modified: branches/gssim/examples/Auction/AuctionEx01/ExampleAuction.java =================================================================== --- branches/gssim/examples/Auction/AuctionEx01/ExampleAuction.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Auction/AuctionEx01/ExampleAuction.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * Description: A simple program to demonstrate of how to use GridSim * auction extension package. */ - +package Auction.AuctionEx01; import eduni.simjava.Sim_event; import gridsim.GridSim; import gridsim.GridSimRandom; Modified: branches/gssim/examples/Auction/AuctionEx01/ResponderImpl.java =================================================================== --- branches/gssim/examples/Auction/AuctionEx01/ResponderImpl.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Auction/AuctionEx01/ResponderImpl.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,8 +4,8 @@ * Description: A simple program to demonstrate of how to use GridSim * auction extension package. */ +package Auction.AuctionEx01; - import gridsim.AllocPolicy; import gridsim.ResourceCalendar; import gridsim.ResourceCharacteristics; Modified: branches/gssim/examples/Auction/AuctionEx02/AuctionResource.java =================================================================== --- branches/gssim/examples/Auction/AuctionEx02/AuctionResource.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Auction/AuctionEx02/AuctionResource.java 2008-08-21 12:58:32 UTC (rev 235) @@ -8,7 +8,7 @@ * using link and router. * */ - +package Auction.AuctionEx02; import eduni.simjava.Sim_event; import gridsim.AllocPolicy; import gridsim.GridResource; Modified: branches/gssim/examples/Auction/AuctionEx02/Broker.java =================================================================== --- branches/gssim/examples/Auction/AuctionEx02/Broker.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Auction/AuctionEx02/Broker.java 2008-08-21 12:58:32 UTC (rev 235) @@ -8,7 +8,7 @@ * using link and router. * */ - +package Auction.AuctionEx02; import eduni.simjava.Sim_event; import eduni.simjava.Sim_port; import eduni.simjava.distributions.Sim_uniform_obj; Modified: branches/gssim/examples/Auction/AuctionEx02/ExampleAuction.java =================================================================== --- branches/gssim/examples/Auction/AuctionEx02/ExampleAuction.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Auction/AuctionEx02/ExampleAuction.java 2008-08-21 12:58:32 UTC (rev 235) @@ -8,7 +8,7 @@ * using link and router. * */ - +package Auction.AuctionEx02; import eduni.simjava.distributions.Sim_uniform_obj; import gridsim.GridResource; import gridsim.GridSim; Modified: branches/gssim/examples/Auction/AuctionEx02/NetUser.java =================================================================== --- branches/gssim/examples/Auction/AuctionEx02/NetUser.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Auction/AuctionEx02/NetUser.java 2008-08-21 12:58:32 UTC (rev 235) @@ -11,8 +11,8 @@ * package developed by: Anthony Sulistio * */ +package Auction.AuctionEx02; - import eduni.simjava.Sim_event; import eduni.simjava.distributions.Sim_uniform_obj; import gridsim.GridSim; Modified: branches/gssim/examples/Auction/AuctionEx02/ResponderImpl.java =================================================================== --- branches/gssim/examples/Auction/AuctionEx02/ResponderImpl.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Auction/AuctionEx02/ResponderImpl.java 2008-08-21 12:58:32 UTC (rev 235) @@ -8,7 +8,7 @@ * using link and router. * */ - +package Auction.AuctionEx02; import eduni.simjava.distributions.Sim_uniform_obj; import gridsim.AllocPolicy; import gridsim.ResourceCalendar; Modified: branches/gssim/examples/Auction/AuctionEx03/AuctionResource.java =================================================================== --- branches/gssim/examples/Auction/AuctionEx03/AuctionResource.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Auction/AuctionEx03/AuctionResource.java 2008-08-21 12:58:32 UTC (rev 235) @@ -8,7 +8,7 @@ * using link and router. * */ - +package Auction.AuctionEx03; import eduni.simjava.Sim_event; import eduni.simjava.distributions.ContinuousGenerator; import eduni.simjava.distributions.Sim_uniform_obj; Modified: branches/gssim/examples/Auction/AuctionEx03/Broker.java =================================================================== --- branches/gssim/examples/Auction/AuctionEx03/Broker.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Auction/AuctionEx03/Broker.java 2008-08-21 12:58:32 UTC (rev 235) @@ -7,7 +7,7 @@ * and auction entities connected via a network topology, * using link and router. */ - +package Auction.AuctionEx03; import eduni.simjava.Sim_event; import eduni.simjava.Sim_port; import gridsim.GridSimTags; Modified: branches/gssim/examples/Auction/AuctionEx03/ExampleAuction.java =================================================================== --- branches/gssim/examples/Auction/AuctionEx03/ExampleAuction.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Auction/AuctionEx03/ExampleAuction.java 2008-08-21 12:58:32 UTC (rev 235) @@ -8,7 +8,7 @@ * using link and router. * */ - +package Auction.AuctionEx03; import eduni.simjava.distributions.Sim_uniform_obj; import gridsim.GridResource; import gridsim.GridSim; Modified: branches/gssim/examples/Auction/AuctionEx03/NetUser.java =================================================================== --- branches/gssim/examples/Auction/AuctionEx03/NetUser.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Auction/AuctionEx03/NetUser.java 2008-08-21 12:58:32 UTC (rev 235) @@ -11,8 +11,8 @@ * package developed by: Anthony Sulistio * */ +package Auction.AuctionEx03; - import eduni.simjava.Sim_event; import eduni.simjava.Sim_system; import eduni.simjava.distributions.ContinuousGenerator; Modified: branches/gssim/examples/Auction/AuctionEx03/ResponderImpl.java =================================================================== --- branches/gssim/examples/Auction/AuctionEx03/ResponderImpl.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Auction/AuctionEx03/ResponderImpl.java 2008-08-21 12:58:32 UTC (rev 235) @@ -8,7 +8,7 @@ * using link and router. * */ - +package Auction.AuctionEx03; import gridsim.AllocPolicy; import gridsim.ResourceCalendar; import gridsim.ResourceCharacteristics; Modified: branches/gssim/examples/DataGrid/example1/DataExample1.java =================================================================== --- branches/gssim/examples/DataGrid/example1/DataExample1.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/DataGrid/example1/DataExample1.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * of Parallel and Distributed Systems such as Clusters and Grids * Licence: GPL - http://www.gnu.org/copyleft/gpl.html */ - +package DataGrid.example1; import gridsim.*; import gridsim.datagrid.*; import gridsim.datagrid.index.DataGIS; Modified: branches/gssim/examples/DataGrid/example1/DummyUser.java =================================================================== --- branches/gssim/examples/DataGrid/example1/DummyUser.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/DataGrid/example1/DummyUser.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * of Parallel and Distributed Systems such as Clusters and Grids * Licence: GPL - http://www.gnu.org/copyleft/gpl.html */ - +package DataGrid.example1; import gridsim.GridSim; import gridsim.datagrid.DataGridUser; import gridsim.net.SimpleLink; Modified: branches/gssim/examples/DataGrid/example2/DataExample2.java =================================================================== --- branches/gssim/examples/DataGrid/example2/DataExample2.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/DataGrid/example2/DataExample2.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * of Parallel and Distributed Systems such as Clusters and Grids * Licence: GPL - http://www.gnu.org/copyleft/gpl.html */ - +package DataGrid.example2; import gridsim.*; import gridsim.datagrid.*; import gridsim.datagrid.index.DataGIS; Modified: branches/gssim/examples/DataGrid/example2/FileUser.java =================================================================== --- branches/gssim/examples/DataGrid/example2/FileUser.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/DataGrid/example2/FileUser.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * of Parallel and Distributed Systems such as Clusters and Grids * Licence: GPL - http://www.gnu.org/copyleft/gpl.html */ - +package DataGrid.example2; import gridsim.GridSim; import gridsim.IO_data; import gridsim.ParameterException; Modified: branches/gssim/examples/DataGrid/example3/DataGridletExample.java =================================================================== --- branches/gssim/examples/DataGrid/example3/DataGridletExample.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/DataGrid/example3/DataGridletExample.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * of Parallel and Distributed Systems such as Clusters and Grids * Licence: GPL - http://www.gnu.org/copyleft/gpl.html */ - +package DataGrid.example3; import gridsim.*; import gridsim.datagrid.*; import gridsim.datagrid.index.DataGIS; Modified: branches/gssim/examples/DataGrid/example3/DataGridletUser.java =================================================================== --- branches/gssim/examples/DataGrid/example3/DataGridletUser.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/DataGrid/example3/DataGridletUser.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * of Parallel and Distributed Systems such as Clusters and Grids * Licence: GPL - http://www.gnu.org/copyleft/gpl.html */ - +package DataGrid.example3; import eduni.simjava.Sim_event; import eduni.simjava.Sim_type_p; import gridsim.GridSim; Modified: branches/gssim/examples/DataGrid/example4/DataGridSim.java =================================================================== --- branches/gssim/examples/DataGrid/example4/DataGridSim.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/DataGrid/example4/DataGridSim.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * of Parallel and Distributed Systems such as Clusters and Grids * Licence: GPL - http://www.gnu.org/copyleft/gpl.html */ - +package DataGrid.example4; import eduni.simjava.Sim_system; import gridsim.*; import gridsim.datagrid.index.*; Modified: branches/gssim/examples/DataGrid/example4/FilesReader.java =================================================================== --- branches/gssim/examples/DataGrid/example4/FilesReader.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/DataGrid/example4/FilesReader.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * of Parallel and Distributed Systems such as Clusters and Grids * Licence: GPL - http://www.gnu.org/copyleft/gpl.html */ - +package DataGrid.example4; import gridsim.datagrid.File; import java.io.*; import java.util.*; Modified: branches/gssim/examples/DataGrid/example4/ParameterReader.java =================================================================== --- branches/gssim/examples/DataGrid/example4/ParameterReader.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/DataGrid/example4/ParameterReader.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * of Parallel and Distributed Systems such as Clusters and Grids * Licence: GPL - http://www.gnu.org/copyleft/gpl.html */ - +package DataGrid.example4; import java.io.BufferedReader; import java.io.FileReader; import java.util.StringTokenizer; Modified: branches/gssim/examples/DataGrid/example4/ResourceReader.java =================================================================== --- branches/gssim/examples/DataGrid/example4/ResourceReader.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/DataGrid/example4/ResourceReader.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * of Parallel and Distributed Systems such as Clusters and Grids * Licence: GPL - http://www.gnu.org/copyleft/gpl.html */ - +package DataGrid.example4; import gridsim.*; import gridsim.datagrid.DataGridResource; import gridsim.datagrid.File; Modified: branches/gssim/examples/DataGrid/example4/SimUser.java =================================================================== --- branches/gssim/examples/DataGrid/example4/SimUser.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/DataGrid/example4/SimUser.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * of Parallel and Distributed Systems such as Clusters and Grids * Licence: GPL - http://www.gnu.org/copyleft/gpl.html */ - +package DataGrid.example4; import gridsim.GridSim; import gridsim.datagrid.DataGridUser; import gridsim.datagrid.File; Modified: branches/gssim/examples/DataGrid/example4/UserReader.java =================================================================== --- branches/gssim/examples/DataGrid/example4/UserReader.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/DataGrid/example4/UserReader.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * of Parallel and Distributed Systems such as Clusters and Grids * Licence: GPL - http://www.gnu.org/copyleft/gpl.html */ - +package DataGrid.example4; import gridsim.net.*; import gridsim.util.NetworkReader; import java.io.BufferedReader; Modified: branches/gssim/examples/Example01/Example1.java =================================================================== --- branches/gssim/examples/Example01/Example1.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example01/Example1.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,7 +9,7 @@ * http://www.gridbus.org/gridsim/ * $Id: Example1.java,v 1.6 2004/05/29 05:24:00 anthony Exp $ */ - +package Example01; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example02/Example2.java =================================================================== --- branches/gssim/examples/Example02/Example2.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example02/Example2.java 2008-08-21 12:58:32 UTC (rev 235) @@ -11,7 +11,7 @@ * http://www.gridbus.org/gridsim/ * $Id: Example2.java,v 1.4 2003/05/19 13:17:49 anthony Exp $ */ - +package Example02; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example03/Example3.java =================================================================== --- branches/gssim/examples/Example03/Example3.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example03/Example3.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,7 +9,7 @@ * http://www.gridbus.org/gridsim/ * $Id: Example3.java,v 1.6 2005/09/16 07:02:15 anthony Exp $ */ - +package Example03; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example03/Test.java =================================================================== --- branches/gssim/examples/Example03/Test.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example03/Test.java 2008-08-21 12:58:32 UTC (rev 235) @@ -6,7 +6,7 @@ * other. * $Id: Test.java,v 1.5 2005/09/16 07:02:15 anthony Exp $ */ - +package Example03; import java.util.*; import gridsim.*; import eduni.simjava.Sim_event; Modified: branches/gssim/examples/Example04/Example4.java =================================================================== --- branches/gssim/examples/Example04/Example4.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example04/Example4.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,7 +9,7 @@ * http://www.gridbus.org/gridsim/ * $Id: Example4.java,v 1.10 2005/09/19 06:04:21 anthony Exp $ */ - +package Example04; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example05/Example5.java =================================================================== --- branches/gssim/examples/Example05/Example5.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example05/Example5.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,7 +9,7 @@ * http://www.gridbus.org/gridsim/ * $Id: Example5.java,v 1.7 2005/09/19 08:29:10 anthony Exp $ */ - +package Example05; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example06/Example6.java =================================================================== --- branches/gssim/examples/Example06/Example6.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example06/Example6.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,7 +9,7 @@ * http://www.gridbus.org/gridsim/ * $Id: Example6.java,v 1.7 2005/09/20 07:01:24 anthony Exp $ */ - +package Example06; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example07/Test.java =================================================================== --- branches/gssim/examples/Example07/Test.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example07/Test.java 2008-08-21 12:58:32 UTC (rev 235) @@ -3,7 +3,7 @@ * Date: Dec 2003 * $Id: Test.java,v 1.3 2004/05/06 04:31:36 anthony Exp $ */ - +package Example07; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example07/TestCase1.java =================================================================== --- branches/gssim/examples/Example07/TestCase1.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example07/TestCase1.java 2008-08-21 12:58:32 UTC (rev 235) @@ -3,7 +3,7 @@ * Date: December 2003 * $Id: TestCase1.java,v 1.4 2004/10/31 05:31:54 anthony Exp $ */ - +package Example07; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example07/TestCase2.java =================================================================== --- branches/gssim/examples/Example07/TestCase2.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example07/TestCase2.java 2008-08-21 12:58:32 UTC (rev 235) @@ -3,7 +3,7 @@ * Date: December 2003 * $Id: TestCase2.java,v 1.4 2004/10/31 05:31:54 anthony Exp $ */ - +package Example07; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example07/TestCase3.java =================================================================== --- branches/gssim/examples/Example07/TestCase3.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example07/TestCase3.java 2008-08-21 12:58:32 UTC (rev 235) @@ -3,7 +3,7 @@ * Date: December 2003 * $Id: TestCase3.java,v 1.4 2004/10/31 05:31:54 anthony Exp $ */ - +package Example07; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example07/TestCase4.java =================================================================== --- branches/gssim/examples/Example07/TestCase4.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example07/TestCase4.java 2008-08-21 12:58:32 UTC (rev 235) @@ -3,7 +3,7 @@ * Date: December 2003 * $Id: TestCase4.java,v 1.4 2004/10/31 05:31:54 anthony Exp $ */ - +package Example07; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example07/TestCase5.java =================================================================== --- branches/gssim/examples/Example07/TestCase5.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example07/TestCase5.java 2008-08-21 12:58:32 UTC (rev 235) @@ -3,7 +3,7 @@ * Date: December 2003 * $Id: TestCase5.java,v 1.4 2004/10/31 05:31:55 anthony Exp $ */ - +package Example07; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example07/TestCase6.java =================================================================== --- branches/gssim/examples/Example07/TestCase6.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example07/TestCase6.java 2008-08-21 12:58:32 UTC (rev 235) @@ -3,7 +3,7 @@ * Date: December 2003 * $Id: TestCase6.java,v 1.4 2004/10/31 05:31:55 anthony Exp $ */ - +package Example07; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example07/TestCase7.java =================================================================== --- branches/gssim/examples/Example07/TestCase7.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example07/TestCase7.java 2008-08-21 12:58:32 UTC (rev 235) @@ -3,7 +3,7 @@ * Date: December 2003 * $Id: TestCase7.java,v 1.4 2004/10/31 05:31:55 anthony Exp $ */ - +package Example07; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example07/TestCase8.java =================================================================== --- branches/gssim/examples/Example07/TestCase8.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example07/TestCase8.java 2008-08-21 12:58:32 UTC (rev 235) @@ -3,7 +3,7 @@ * Date: December 2003 * $Id: TestCase8.java,v 1.4 2004/10/31 05:31:55 anthony Exp $ */ - +package Example07; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example08/Example8.java =================================================================== --- branches/gssim/examples/Example08/Example8.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example08/Example8.java 2008-08-21 12:58:32 UTC (rev 235) @@ -8,7 +8,7 @@ * http://www.gridbus.org/gridsim/ * $Id: Example8.java,v 1.3 2004/05/29 05:53:28 anthony Exp $ */ - +package Example08; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example08/NewPolicy.java =================================================================== --- branches/gssim/examples/Example08/NewPolicy.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example08/NewPolicy.java 2008-08-21 12:58:32 UTC (rev 235) @@ -1,4 +1,5 @@ +package Example08; import gridsim.*; import eduni.simjava.*; Modified: branches/gssim/examples/Example09/Example9.java =================================================================== --- branches/gssim/examples/Example09/Example9.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example09/Example9.java 2008-08-21 12:58:32 UTC (rev 235) @@ -21,7 +21,7 @@ * * $Id: Example9.java,v 1.2 2004/05/29 06:53:33 anthony Exp $ */ - +package Example09; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Example09/NewGIS.java =================================================================== --- branches/gssim/examples/Example09/NewGIS.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example09/NewGIS.java 2008-08-21 12:58:32 UTC (rev 235) @@ -8,7 +8,7 @@ * NOTE: GridSim version 3.0 or above is needed to run this example. * $Id: NewGIS.java,v 1.3 2004/05/29 07:44:30 anthony Exp $ */ - +package Example09; import gridsim.*; import eduni.simjava.*; // Need to include SimJava libraries Modified: branches/gssim/examples/Example09/NewGridResource.java =================================================================== --- branches/gssim/examples/Example09/NewGridResource.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example09/NewGridResource.java 2008-08-21 12:58:32 UTC (rev 235) @@ -8,8 +8,8 @@ * NOTE: GridSim version 3.0 or above is needed to run this example. * $Id: NewGridResource.java,v 1.2 2004/05/29 07:44:47 anthony Exp $ */ +package Example09; - import gridsim.*; import eduni.simjava.*; // Need to include SimJava libraries Modified: branches/gssim/examples/Example10/ARTest.java =================================================================== --- branches/gssim/examples/Example10/ARTest.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example10/ARTest.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,7 +9,7 @@ * http://www.gridbus.org/gridsim/ * $Id: ARTest.java,v 1.3 2007/08/10 02:35:40 anthony Exp $ */ - +package Example10; import java.util.*; import gridsim.*; import eduni.simjava.*; Modified: branches/gssim/examples/Example10/Example10.java =================================================================== --- branches/gssim/examples/Example10/Example10.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Example10/Example10.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,7 +9,7 @@ * http://www.gridbus.org/gridsim/ * $Id: Example10.java,v 1.2 2004/05/31 04:53:33 anthony Exp $ */ - +package Example10; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Network/NetEx01/NetEx01.java =================================================================== --- branches/gssim/examples/Network/NetEx01/NetEx01.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Network/NetEx01/NetEx01.java 2008-08-21 12:58:32 UTC (rev 235) @@ -7,7 +7,7 @@ * connect them via a link. NetUser entity sends messages to * Test entity and Test entity sends back these messages. */ -package NetEx01; +package Network.NetEx01; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/Network/NetEx01/NetUser.java =================================================================== --- branches/gssim/examples/Network/NetEx01/NetUser.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Network/NetEx01/NetUser.java 2008-08-21 12:58:32 UTC (rev 235) @@ -7,7 +7,7 @@ * connect them via a link. NetUser entity sends messages to * Test entity and Test entity sends back these messages. */ -package NetEx01; +package Network.NetEx01; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/Network/NetEx01/Test.java =================================================================== --- branches/gssim/examples/Network/NetEx01/Test.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Network/NetEx01/Test.java 2008-08-21 12:58:32 UTC (rev 235) @@ -7,7 +7,7 @@ * connect them via a link. NetUser entity sends messages to * Test entity and Test entity sends back these messages. */ -package NetEx01; +package Network.NetEx01; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Network/NetEx02/NetEx02.java =================================================================== --- branches/gssim/examples/Network/NetEx02/NetEx02.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Network/NetEx02/NetEx02.java 2008-08-21 12:58:32 UTC (rev 235) @@ -8,7 +8,7 @@ * and router. * */ -package NetEx02; +package Network.NetEx02; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/Network/NetEx02/NetUser.java =================================================================== --- branches/gssim/examples/Network/NetEx02/NetUser.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Network/NetEx02/NetUser.java 2008-08-21 12:58:32 UTC (rev 235) @@ -8,7 +8,7 @@ * and router. * */ -package NetEx02; +package Network.NetEx02; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Network/NetEx03/NetEx03.java =================================================================== --- branches/gssim/examples/Network/NetEx03/NetEx03.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Network/NetEx03/NetEx03.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,7 +9,7 @@ * In addition, background traffic functionality is explained * in this example. */ -package NetEx03; +package Network.NetEx03; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/Network/NetEx03/NetUser.java =================================================================== --- branches/gssim/examples/Network/NetEx03/NetUser.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Network/NetEx03/NetUser.java 2008-08-21 12:58:32 UTC (rev 235) @@ -8,7 +8,7 @@ * and router. * */ -package NetEx03; +package Network.NetEx03; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Network/RateExample/NetUser.java =================================================================== --- branches/gssim/examples/Network/RateExample/NetUser.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Network/RateExample/NetUser.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * Description: A simple program to demonstrate of how to use GridSim * network extension package. */ -package RateExample; +package Network.RateExample; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Network/RateExample/RateExample.java =================================================================== --- branches/gssim/examples/Network/RateExample/RateExample.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Network/RateExample/RateExample.java 2008-08-21 12:58:32 UTC (rev 235) @@ -7,7 +7,7 @@ * scheduler. In addition, this example shows how to read a network * topology from a given file. */ -package RateExample; +package Network.RateExample; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/Network/SCFQExample/NetUser.java =================================================================== --- branches/gssim/examples/Network/SCFQExample/NetUser.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Network/SCFQExample/NetUser.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * Description: A simple program to demonstrate of how to use GridSim * network extension package. */ -package SCFQExample; +package Network.SCFQExample; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Network/SCFQExample/SCFQExample.java =================================================================== --- branches/gssim/examples/Network/SCFQExample/SCFQExample.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/Network/SCFQExample/SCFQExample.java 2008-08-21 12:58:32 UTC (rev 235) @@ -7,7 +7,7 @@ * In addition, this example shows how to read a network * topology from a given file. */ -package SCFQExample; +package Network.SCFQExample; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/RegionalGIS/ExampleGIS.java =================================================================== --- branches/gssim/examples/RegionalGIS/ExampleGIS.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/RegionalGIS/ExampleGIS.java 2008-08-21 12:58:32 UTC (rev 235) @@ -12,7 +12,7 @@ * * $Id: ExampleGIS.java,v 1.1 2005/03/29 02:13:08 anthony Exp $ */ - +package RegionalGIS; import gridsim.*; import gridsim.index.*; import gridsim.net.*; Modified: branches/gssim/examples/RegionalGIS/NetUserGIS.java =================================================================== --- branches/gssim/examples/RegionalGIS/NetUserGIS.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/RegionalGIS/NetUserGIS.java 2008-08-21 12:58:32 UTC (rev 235) @@ -6,7 +6,7 @@ * regional GIS entity. Sending jobs or Gridlets are not important in this * example, hence, they are excluded. */ - +package RegionalGIS; import java.util.*; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/ResFailure/ResFailureEx01/GridUserFailureEx01.java =================================================================== --- branches/gssim/examples/ResFailure/ResFailureEx01/GridUserFailureEx01.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/ResFailure/ResFailureEx01/GridUserFailureEx01.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,7 +9,7 @@ * Organization: UCLM (Spain) * Created on: August 2007 */ - +package ResFailure.ResFailureEx01; import gridsim.*; import gridsim.index.AbstractGIS; import gridsim.net.Link; Modified: branches/gssim/examples/ResFailure/ResFailureEx01/GridletSubmission.java =================================================================== --- branches/gssim/examples/ResFailure/ResFailureEx01/GridletSubmission.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/ResFailure/ResFailureEx01/GridletSubmission.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,8 +9,8 @@ * Organization: UCLM (Spain) * Created on: August 2007 */ +package ResFailure.ResFailureEx01; - import gridsim.Gridlet; /** Modified: branches/gssim/examples/ResFailure/ResFailureEx01/ResFailureEx01.java =================================================================== --- branches/gssim/examples/ResFailure/ResFailureEx01/ResFailureEx01.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/ResFailure/ResFailureEx01/ResFailureEx01.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,7 +9,7 @@ * Organization: UCLM (Spain) * Created on: August 2007 */ - +package ResFailure.ResFailureEx01; import gridsim.resFailure.*; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/ResFailure/ResFailureEx02/GridUserFailureEx02.java =================================================================== --- branches/gssim/examples/ResFailure/ResFailureEx02/GridUserFailureEx02.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/ResFailure/ResFailureEx02/GridUserFailureEx02.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,7 +9,7 @@ * Organization: UCLM (Spain) * Created on: August 2007 */ - +package ResFailure.ResFailureEx02; import gridsim.*; import gridsim.index.AbstractGIS; import gridsim.net.Link; Modified: branches/gssim/examples/ResFailure/ResFailureEx02/GridletSubmission.java =================================================================== --- branches/gssim/examples/ResFailure/ResFailureEx02/GridletSubmission.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/ResFailure/ResFailureEx02/GridletSubmission.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,8 +9,8 @@ * Organization: UCLM (Spain) * Created on: August 2007 */ +package ResFailure.ResFailureEx02; - import gridsim.Gridlet; /** Modified: branches/gssim/examples/ResFailure/ResFailureEx02/ResFailureEx02.java =================================================================== --- branches/gssim/examples/ResFailure/ResFailureEx02/ResFailureEx02.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/ResFailure/ResFailureEx02/ResFailureEx02.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,7 +9,7 @@ * Organization: UCLM (Spain) * Created on: August 2007 */ - +package ResFailure.ResFailureEx02; import gridsim.resFailure.*; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/ResFailure/ResFailureEx03/GridUserFailureEx03.java =================================================================== --- branches/gssim/examples/ResFailure/ResFailureEx03/GridUserFailureEx03.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/ResFailure/ResFailureEx03/GridUserFailureEx03.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,7 +9,7 @@ * Organization: UCLM (Spain) * Created on: August 2007 */ - +package ResFailure.ResFailureEx03; import gridsim.*; import gridsim.index.AbstractGIS; import gridsim.net.Link; Modified: branches/gssim/examples/ResFailure/ResFailureEx03/GridletSubmission.java =================================================================== --- branches/gssim/examples/ResFailure/ResFailureEx03/GridletSubmission.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/ResFailure/ResFailureEx03/GridletSubmission.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,8 +9,8 @@ * Organization: UCLM (Spain) * Created on: August 2007 */ +package ResFailure.ResFailureEx03; - import gridsim.Gridlet; /** Modified: branches/gssim/examples/ResFailure/ResFailureEx03/ResFailureEx03.java =================================================================== --- branches/gssim/examples/ResFailure/ResFailureEx03/ResFailureEx03.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/ResFailure/ResFailureEx03/ResFailureEx03.java 2008-08-21 12:58:32 UTC (rev 235) @@ -9,7 +9,7 @@ * Organization: UCLM (Spain) * Created on: August 2007 */ - +package ResFailure.ResFailureEx03; import gridsim.resFailure.*; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/WorkloadTrace/TraceEx01/TraceEx01.java =================================================================== --- branches/gssim/examples/WorkloadTrace/TraceEx01/TraceEx01.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/WorkloadTrace/TraceEx01/TraceEx01.java 2008-08-21 12:58:32 UTC (rev 235) @@ -30,7 +30,7 @@ * You are welcome to write your own scheduler that incorporates this * QoS (Quality of Service) requirement. */ - +package WorkloadTrace.TraceEx01; import java.util.*; import gridsim.*; import gridsim.util.*; Modified: branches/gssim/examples/WorkloadTrace/TraceEx02/TraceEx02.java =================================================================== --- branches/gssim/examples/WorkloadTrace/TraceEx02/TraceEx02.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/WorkloadTrace/TraceEx02/TraceEx02.java 2008-08-21 12:58:32 UTC (rev 235) @@ -30,7 +30,7 @@ * You are welcome to write your own scheduler that incorporates this * QoS (Quality of Service) requirement. */ - +package WorkloadTrace.TraceEx02; import java.util.*; import gridsim.*; import gridsim.util.*; Modified: branches/gssim/examples/WorkloadTrace/TraceEx02/User.java =================================================================== --- branches/gssim/examples/WorkloadTrace/TraceEx02/User.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/WorkloadTrace/TraceEx02/User.java 2008-08-21 12:58:32 UTC (rev 235) @@ -4,7 +4,7 @@ * Description: A simple program to demonstrate of how to use GridSim * workload trace functionality. */ - +package WorkloadTrace.TraceEx02; import java.util.*; import eduni.simjava.*; import gridsim.*; Modified: branches/gssim/examples/WorkloadTrace/TraceEx03/NetUser.java =================================================================== --- branches/gssim/examples/WorkloadTrace/TraceEx03/NetUser.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/WorkloadTrace/TraceEx03/NetUser.java 2008-08-21 12:58:32 UTC (rev 235) @@ -5,7 +5,7 @@ * workload trace functionality. * */ - +package WorkloadTrace.TraceEx03; import java.util.*; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/WorkloadTrace/TraceEx03/TraceEx03.java =================================================================== --- branches/gssim/examples/WorkloadTrace/TraceEx03/TraceEx03.java 2008-08-21 12:24:20 UTC (rev 234) +++ branches/gssim/examples/WorkloadTrace/TraceEx03/TraceEx03.java 2008-08-21 12:58:32 UTC (rev 235) @@ -30,7 +30,7 @@ * You are welcome to write your own scheduler that incorporates this * QoS (Quality of Service) requirement. */ - +package WorkloadTrace.TraceEx03; import gridsim.*; import gridsim.net.*; import gridsim.util.Workload; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mkr...@us...> - 2008-08-21 12:24:11
|
Revision: 234 http://gridsim.svn.sourceforge.net/gridsim/?rev=234&view=rev Author: mkrystek Date: 2008-08-21 12:24:20 +0000 (Thu, 21 Aug 2008) Log Message: ----------- changing package in network example classes Modified Paths: -------------- branches/gssim/examples/Network/NetEx01/NetEx01.java branches/gssim/examples/Network/NetEx01/NetUser.java branches/gssim/examples/Network/NetEx01/Test.java branches/gssim/examples/Network/NetEx02/NetEx02.java branches/gssim/examples/Network/NetEx02/NetUser.java branches/gssim/examples/Network/NetEx03/NetEx03.java branches/gssim/examples/Network/NetEx03/NetUser.java branches/gssim/examples/Network/RateExample/NetUser.java branches/gssim/examples/Network/RateExample/RateExample.java branches/gssim/examples/Network/SCFQExample/NetUser.java branches/gssim/examples/Network/SCFQExample/SCFQExample.java Modified: branches/gssim/examples/Network/NetEx01/NetEx01.java =================================================================== --- branches/gssim/examples/Network/NetEx01/NetEx01.java 2008-08-21 12:07:08 UTC (rev 233) +++ branches/gssim/examples/Network/NetEx01/NetEx01.java 2008-08-21 12:24:20 UTC (rev 234) @@ -7,7 +7,8 @@ * connect them via a link. NetUser entity sends messages to * Test entity and Test entity sends back these messages. */ - +package NetEx01; + import gridsim.*; import gridsim.net.*; import java.util.*; Modified: branches/gssim/examples/Network/NetEx01/NetUser.java =================================================================== --- branches/gssim/examples/Network/NetEx01/NetUser.java 2008-08-21 12:07:08 UTC (rev 233) +++ branches/gssim/examples/Network/NetEx01/NetUser.java 2008-08-21 12:24:20 UTC (rev 234) @@ -7,6 +7,7 @@ * connect them via a link. NetUser entity sends messages to * Test entity and Test entity sends back these messages. */ +package NetEx01; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/Network/NetEx01/Test.java =================================================================== --- branches/gssim/examples/Network/NetEx01/Test.java 2008-08-21 12:07:08 UTC (rev 233) +++ branches/gssim/examples/Network/NetEx01/Test.java 2008-08-21 12:24:20 UTC (rev 234) @@ -7,7 +7,8 @@ * connect them via a link. NetUser entity sends messages to * Test entity and Test entity sends back these messages. */ - +package NetEx01; + import java.util.*; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/Network/NetEx02/NetEx02.java =================================================================== --- branches/gssim/examples/Network/NetEx02/NetEx02.java 2008-08-21 12:07:08 UTC (rev 233) +++ branches/gssim/examples/Network/NetEx02/NetEx02.java 2008-08-21 12:24:20 UTC (rev 234) @@ -8,6 +8,7 @@ * and router. * */ +package NetEx02; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/Network/NetEx02/NetUser.java =================================================================== --- branches/gssim/examples/Network/NetEx02/NetUser.java 2008-08-21 12:07:08 UTC (rev 233) +++ branches/gssim/examples/Network/NetEx02/NetUser.java 2008-08-21 12:24:20 UTC (rev 234) @@ -8,6 +8,7 @@ * and router. * */ +package NetEx02; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Network/NetEx03/NetEx03.java =================================================================== --- branches/gssim/examples/Network/NetEx03/NetEx03.java 2008-08-21 12:07:08 UTC (rev 233) +++ branches/gssim/examples/Network/NetEx03/NetEx03.java 2008-08-21 12:24:20 UTC (rev 234) @@ -9,6 +9,7 @@ * In addition, background traffic functionality is explained * in this example. */ +package NetEx03; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/Network/NetEx03/NetUser.java =================================================================== --- branches/gssim/examples/Network/NetEx03/NetUser.java 2008-08-21 12:07:08 UTC (rev 233) +++ branches/gssim/examples/Network/NetEx03/NetUser.java 2008-08-21 12:24:20 UTC (rev 234) @@ -8,6 +8,7 @@ * and router. * */ +package NetEx03; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Network/RateExample/NetUser.java =================================================================== --- branches/gssim/examples/Network/RateExample/NetUser.java 2008-08-21 12:07:08 UTC (rev 233) +++ branches/gssim/examples/Network/RateExample/NetUser.java 2008-08-21 12:24:20 UTC (rev 234) @@ -4,6 +4,7 @@ * Description: A simple program to demonstrate of how to use GridSim * network extension package. */ +package RateExample; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Network/RateExample/RateExample.java =================================================================== --- branches/gssim/examples/Network/RateExample/RateExample.java 2008-08-21 12:07:08 UTC (rev 233) +++ branches/gssim/examples/Network/RateExample/RateExample.java 2008-08-21 12:24:20 UTC (rev 234) @@ -7,6 +7,7 @@ * scheduler. In addition, this example shows how to read a network * topology from a given file. */ +package RateExample; import gridsim.*; import gridsim.net.*; Modified: branches/gssim/examples/Network/SCFQExample/NetUser.java =================================================================== --- branches/gssim/examples/Network/SCFQExample/NetUser.java 2008-08-21 12:07:08 UTC (rev 233) +++ branches/gssim/examples/Network/SCFQExample/NetUser.java 2008-08-21 12:24:20 UTC (rev 234) @@ -4,6 +4,7 @@ * Description: A simple program to demonstrate of how to use GridSim * network extension package. */ +package SCFQExample; import java.util.*; import gridsim.*; Modified: branches/gssim/examples/Network/SCFQExample/SCFQExample.java =================================================================== --- branches/gssim/examples/Network/SCFQExample/SCFQExample.java 2008-08-21 12:07:08 UTC (rev 233) +++ branches/gssim/examples/Network/SCFQExample/SCFQExample.java 2008-08-21 12:24:20 UTC (rev 234) @@ -7,6 +7,7 @@ * In addition, this example shows how to read a network * topology from a given file. */ +package SCFQExample; import gridsim.*; import gridsim.net.*; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mkr...@us...> - 2008-08-21 12:06:58
|
Revision: 233 http://gridsim.svn.sourceforge.net/gridsim/?rev=233&view=rev Author: mkrystek Date: 2008-08-21 12:07:08 +0000 (Thu, 21 Aug 2008) Log Message: ----------- Removed Paths: ------------- branches/gssim/trunk/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mkr...@us...> - 2008-08-21 12:06:09
|
Revision: 232 http://gridsim.svn.sourceforge.net/gridsim/?rev=232&view=rev Author: mkrystek Date: 2008-08-21 12:06:17 +0000 (Thu, 21 Aug 2008) Log Message: ----------- Added Paths: ----------- branches/gssim/.project Removed Paths: ------------- branches/gssim/trunk/.project Copied: branches/gssim/.project (from rev 231, branches/gssim/trunk/.project) =================================================================== --- branches/gssim/.project (rev 0) +++ branches/gssim/.project 2008-08-21 12:06:17 UTC (rev 232) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>gridsiim_svn</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Deleted: branches/gssim/trunk/.project =================================================================== --- branches/gssim/trunk/.project 2008-08-21 12:04:53 UTC (rev 231) +++ branches/gssim/trunk/.project 2008-08-21 12:06:17 UTC (rev 232) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>gridsiim_svn</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mkr...@us...> - 2008-08-21 12:04:43
|
Revision: 231 http://gridsim.svn.sourceforge.net/gridsim/?rev=231&view=rev Author: mkrystek Date: 2008-08-21 12:04:53 +0000 (Thu, 21 Aug 2008) Log Message: ----------- Added Paths: ----------- branches/gssim/.classpath Removed Paths: ------------- branches/gssim/trunk/.classpath Copied: branches/gssim/.classpath (from rev 230, branches/gssim/trunk/.classpath) =================================================================== --- branches/gssim/.classpath (rev 0) +++ branches/gssim/.classpath 2008-08-21 12:04:53 UTC (rev 231) @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="source"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="lib" path="jars/simjava2.jar"/> + <classpathentry kind="output" path="bin"/> +</classpath> Deleted: branches/gssim/trunk/.classpath =================================================================== --- branches/gssim/trunk/.classpath 2008-08-20 13:16:33 UTC (rev 230) +++ branches/gssim/trunk/.classpath 2008-08-21 12:04:53 UTC (rev 231) @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="source"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="lib" path="jars/simjava2.jar"/> - <classpathentry kind="output" path="bin"/> -</classpath> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mkr...@us...> - 2008-08-20 13:16:23
|
Revision: 230 http://gridsim.svn.sourceforge.net/gridsim/?rev=230&view=rev Author: mkrystek Date: 2008-08-20 13:16:33 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Added Paths: ----------- branches/gssim/release_note.txt Removed Paths: ------------- branches/gssim/trunk/release_note.txt Copied: branches/gssim/release_note.txt (from rev 229, branches/gssim/trunk/release_note.txt) =================================================================== --- branches/gssim/release_note.txt (rev 0) +++ branches/gssim/release_note.txt 2008-08-20 13:16:33 UTC (rev 230) @@ -0,0 +1,56 @@ + + Gridbus Project to Release GridSim Toolkit 4.1 + September 2007 + + +The Gridbus Project at The University of Melbourne, Australia has released the +next-version of Grid simulation software, the GridSim Toolkit 4.1. + +The new version of GridSim adds a new functionality that supports +resource failures and failure detection of Grid resources. This work was done +in collaboration with Agustin Caminero, a Phd student from +Universidad de Castilla La Mancha (UCLM), Spain. + +All components developed as part of the GridSim Toolkit are released as +"open source" under the GPL license to encourage innovation and pass full +freedom to our users. In addition, we have decided to use +SourceForge (http://sourceforge.net/projects/gridsim) for hosting +our future releases and developments. This allows us to share and +and to collaborate further on new functionalities. +Therefore, contributions to the GridSim Toolkit are greatly appreciated. + +The early version of our GridSim toolkit has been used/dowloaded by several +academic and commercial organizations around the world including: +University of Southern California (USA), California Institute of Technology (USA), +Argonne National Labs (USA), University of Manchester (UK), CERN, +Universidad de Santiago de Compostela (Spain), Indian Institute of Technology, +Tsinghua University (China), Sun Microsystems, IBM Research, Unisys, HP, +Northrop Grumman Information Technology, British Telecom and EMC Corp. + +The GridSim software has been used for modeling and simulating many +interesting systems and ideas. For example, IBM Research uses our DataGrid +package to simulate a grid meta-scheduler that tightly integrates +the compute and data transfer times of each job. +Another example is Universidad de Santiago de Compostela's extension of GridSim +to optimize execution of parallel applications on a Grid. +Our own uses include simulating economic Grid scheduler in a competitive +economy model, economic based cluster scheduler and cooperative Grid federation. + +The contributors to the GridSim software (from early to new version) are: +* Rajkumar Buyya, GRIDS Lab @ The University of Melbourne. +* Manzur Murshed, GSCIT @ Monash University, Australia. +* Anthony Sulistio, GRIDS Lab @ The University of Melbourne. +* Gokul Poduval and Chen-Khong Tham, + Dept. of Electrical & Computer Engineering @ National University of Singapore. +* Marcos Dias de Assuncao, GRIDS Lab @ The University of Melbourne. +* Uros Cibej and Borut Robic, Faculty of Computer and Information Service, + The University of Ljubljana, Slovenia. +* Agustin Caminero, Department of Computing Systems, + Universidad de Castilla La Mancha (UCLM), Spain. + + +To download the GridSim software, please visit the Gridbus Project web site at +http://www.gridbus.org/gridsim/ + +Join the GridSim mailing lists at +http://sourceforge.net/projects/gridsim Deleted: branches/gssim/trunk/release_note.txt =================================================================== --- branches/gssim/trunk/release_note.txt 2008-08-20 13:15:11 UTC (rev 229) +++ branches/gssim/trunk/release_note.txt 2008-08-20 13:16:33 UTC (rev 230) @@ -1,56 +0,0 @@ - - Gridbus Project to Release GridSim Toolkit 4.1 - September 2007 - - -The Gridbus Project at The University of Melbourne, Australia has released the -next-version of Grid simulation software, the GridSim Toolkit 4.1. - -The new version of GridSim adds a new functionality that supports -resource failures and failure detection of Grid resources. This work was done -in collaboration with Agustin Caminero, a Phd student from -Universidad de Castilla La Mancha (UCLM), Spain. - -All components developed as part of the GridSim Toolkit are released as -"open source" under the GPL license to encourage innovation and pass full -freedom to our users. In addition, we have decided to use -SourceForge (http://sourceforge.net/projects/gridsim) for hosting -our future releases and developments. This allows us to share and -and to collaborate further on new functionalities. -Therefore, contributions to the GridSim Toolkit are greatly appreciated. - -The early version of our GridSim toolkit has been used/dowloaded by several -academic and commercial organizations around the world including: -University of Southern California (USA), California Institute of Technology (USA), -Argonne National Labs (USA), University of Manchester (UK), CERN, -Universidad de Santiago de Compostela (Spain), Indian Institute of Technology, -Tsinghua University (China), Sun Microsystems, IBM Research, Unisys, HP, -Northrop Grumman Information Technology, British Telecom and EMC Corp. - -The GridSim software has been used for modeling and simulating many -interesting systems and ideas. For example, IBM Research uses our DataGrid -package to simulate a grid meta-scheduler that tightly integrates -the compute and data transfer times of each job. -Another example is Universidad de Santiago de Compostela's extension of GridSim -to optimize execution of parallel applications on a Grid. -Our own uses include simulating economic Grid scheduler in a competitive -economy model, economic based cluster scheduler and cooperative Grid federation. - -The contributors to the GridSim software (from early to new version) are: -* Rajkumar Buyya, GRIDS Lab @ The University of Melbourne. -* Manzur Murshed, GSCIT @ Monash University, Australia. -* Anthony Sulistio, GRIDS Lab @ The University of Melbourne. -* Gokul Poduval and Chen-Khong Tham, - Dept. of Electrical & Computer Engineering @ National University of Singapore. -* Marcos Dias de Assuncao, GRIDS Lab @ The University of Melbourne. -* Uros Cibej and Borut Robic, Faculty of Computer and Information Service, - The University of Ljubljana, Slovenia. -* Agustin Caminero, Department of Computing Systems, - Universidad de Castilla La Mancha (UCLM), Spain. - - -To download the GridSim software, please visit the Gridbus Project web site at -http://www.gridbus.org/gridsim/ - -Join the GridSim mailing lists at -http://sourceforge.net/projects/gridsim This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mkr...@us...> - 2008-08-20 13:15:02
|
Revision: 229 http://gridsim.svn.sourceforge.net/gridsim/?rev=229&view=rev Author: mkrystek Date: 2008-08-20 13:15:11 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Added Paths: ----------- branches/gssim/README.txt Removed Paths: ------------- branches/gssim/trunk/README.txt Copied: branches/gssim/README.txt (from rev 228, branches/gssim/trunk/README.txt) =================================================================== --- branches/gssim/README.txt (rev 0) +++ branches/gssim/README.txt 2008-08-20 13:15:11 UTC (rev 229) @@ -0,0 +1,188 @@ + +README file +Author: Anthony Sulistio (September 2007) + + +Directory Structure of GridSim Toolkit +-------------------------------------- + +$GRIDSIM/ -- the current GridSim directory (top level) + classes/ -- The GridSim class files + doc/ -- GridSim and SimJava API Documentation + eduni/ + gridsim/ + examples/ -- GridSim examples, see examples/README.txt for details + jars/ -- jar archives + source/ -- The GridSim Java source code + gridsim/*.java + gridsim/auction/*.java -- framework for the auction model + gridsim/datagrid/*.java -- framework for the Data Grids model + gridsim/filter/*.java -- filters incoming events + gridsim/index/*.java -- framework for the Grid Info Service model + gridsim/net/*.java -- framework for the network model + gridsim/resFailure/*.java -- framework for the resource failure model + gridsim/util/*.java -- includes some statistics classes. + +GridSim APIs and examples are also available on the GridSim website. +If you are looking for applications or programs built on top of GridSim, +such as gridbroker or Visual Modeler, they can be found below: +http://www.gridbus.org/gridsim/release.html + + +Software Requirements : Java version 1.4.2 or newer +--------------------- +GridSim has been tested and ran on Sun's Java version 1.4.2 or newer. +Older versions of Java are not compatible. +If you have non-Sun Java version, such as gcj or J++, they may not be compatible. +You also need to install Ant to compile GridSim (explained in more details later). + + +Installation and Running GridSim Toolkit +---------------------------------------- +There is no special program to install GridSim. You just need to +unzip the GridSim file to install. +If you want to remove GridSim, then remove the whole $GRIDSIM directory. + +NOTE: You do not need to compile GridSim source code. The JAR file is + provided to compile and to run GridSim applications. + +Description of the following jar files: +* gridsim.jar -- contains both GridSim and SimJava v2.0 class files +* simjava2.jar -- contains SimJava v2.0 class files only + +To compile and run GridSim applications, do the following step: +1) Go the directory where the GridSim's Example1 reside + In Unix or Linux: cd $GRIDSIM/examples/Example01 + In Windows: cd %GRIDSIM%\examples\Example01 + +2) Compile the Java source file + In Unix or Linux: javac -classpath $GRIDSIM/jars/gridsim.jar:. Example1.java + In Windows: javac -classpath %GRIDSIM%\jars\gridsim.jar;. Example1.java + +3) Running the Java class file + In Unix or Linux: java -classpath $GRIDSIM/jars/gridsim.jar:. Example1 + In Windows: java -classpath %GRIDSIM%\jars\gridsim.jar;. Example1 + +NOTE: +* $GRIDSIM or %GRIDSIM% is the location of the GridSim Toolkit package. +* If you are using Java IDEs, such as Eclipse, JBuilder and JCreator, + their instructions (with screenshots) are found on the GridSim website. +* Running GridSim of this version requires a lot of memory since there are many + objects to be created. Therefore, it is recommended to have at least 512MB RAM + or increase JVM heap size when running Java for large simulation experiments. + For example: java -Xmx300m -classpath $GRIDSIM/jars/gridsim.jar:. Example1 + (max. heap size is 300MB). + + +Learning GridSim +---------------- +To understand on how to use GridSim, please go through the examples provided +in the $GRIDSIM/examples/ directory. Example 1 - 6 are mainly for beginners, +whereas the rest describes more complex GridSim functionalities. +The same examples are also hosted in the GridSim website. + +At the moment, GridSim has two allocation policies or scheduling algorithms, +i.e. First Come First Service (as described in SpaceShared.java) and Round +Robin (as described in TimeShared.java). +If you are interested in writing a new scheduling algorithm of a resource, +then look closely on $GRIDSIM/examples/Example08/ directory. +We are certainly welcomed new additions of allocation policies into GridSim. + + +Compiling GridSim : Using Ant +----------------- +This release contains a simple buildfile for compiling GridSim classes. +You need to have ant installed (http://ant.apache.org/). +Ant can be used in both Windows and Unix/Linux environment. + +Usage: +* type 'ant' to compile all gridsim source files and put them into + classes/ directory +* type 'ant makejar' to compile the source files (if necessary) and to create + a new jar file called "new_gridsim.jar" into jars/ directory. + The "new_gridsim.jar" however only contains GridSim classes not SimJava2. + +NOTE: +* You need to set up PATH for ant in Windows and/or Unix. +* rule for javadoc is not included yet. Use javadoc.sh script on Unix instead. + Alternatively, the GridSim API can be found below: + http://www.gridbus.org/gridsim/doc/ + + +Contacting Us : subscribe to Mailing Lists at SourceForge.net +------------- +Please read FAQ, examples, API and other documents in the GridSim website +before contacting us. + +GridSim mailing lists can be found below: +http://sourceforge.net/projects/gridsim/ then click on the "Mailing Lists" tab. + +Please subscribe to the following mailing lists: +gridsim-users (at) lists.sourceforge.net - for any queries and feedbacks +gridsim-developers (at) lists.sourceforge.net - for contributing to GridSim + +Contributors are always needed to improve and maintain GridSim. +Another option is to integrate your work/project into future GridSim releases. +If you want to contribute, advertise yourself to us. +Benefits of your contributions: +- you help future Grid researchers and students like you and us; +- you can proudly write your contributions in the resume or CV; +- you gain knowledge and skills in using SVN version control, Java, and OO; and +- more importantly, you are dealing with a real software engineering development + and working with collaborators or developers from other parts of the world + (at the moment, they are from "down under"). + You can not get this kind of unique experience by doing it yourself or + in university assignments or projects. + +NOTE: +* If you experience some problems when compiling/running GridSim, + write a detailed email. The more information you provide, the better + we analyze your problem. Hence, the sooner we can reply. +* Please send your questions to these mailing lists so that other people can + read and reply them. +* We have hectic schedules, so do not expect an instant reply. + + +Bugs Reporting +-------------- +If you found any bugs, please report them to: +http://sourceforge.net/projects/gridsim/ then click on the "Tracker" tab. + +To prevent any false reports, it is recommended that you email us first on +gridsim-developers (at) lists.sourceforge.net +to identify whether the problem is caused by bugs in the GridSim code +or something else, such as using Java version 1.3. + +Please be specific when you report a bug. We need information such as +GridSim version number, Java version number, detailed descriptions, +snippets of the (buggy) code and any exception errors. +A 'nobody' report in the tracker will probably be ignored. + + +Requesting New Features +----------------------- +If you decide to implement any new features, we will try our best to help you +with directions on where to start and how to design and implement without +breaking the existing design and code respectively. + + +Acknowledgement +--------------- + +For their outstanding contributions to GridSim : +* Agustin Caminero from The University of Castilla La Mancha, Spain + for his work on the gridsim.resFailure package. + +* Uros Cibej from The University of Ljubljana, Slovenia + for providing build.xml file and instruction on how to + use ant. In addition, he worked on the gridsim.datagrid package. + +* Gokul Poduval from National University of Singapore + for his work on the gridsim.net package. + +* Marcos Dias de Assuncao from Grids Lab, The University of Melbourne, Australia + for his work on the gridsim.auction package + +We also thank the following people for finding bugs in GridSim : +Gokul Poduval, Uros Cibej, Agustin Caminero, Sai Rahul Reddy, Jakub Milkiewicz, +Mads Mbuso Sibeko, Felipe Ramos. Deleted: branches/gssim/trunk/README.txt =================================================================== --- branches/gssim/trunk/README.txt 2008-08-20 13:13:52 UTC (rev 228) +++ branches/gssim/trunk/README.txt 2008-08-20 13:15:11 UTC (rev 229) @@ -1,188 +0,0 @@ - -README file -Author: Anthony Sulistio (September 2007) - - -Directory Structure of GridSim Toolkit --------------------------------------- - -$GRIDSIM/ -- the current GridSim directory (top level) - classes/ -- The GridSim class files - doc/ -- GridSim and SimJava API Documentation - eduni/ - gridsim/ - examples/ -- GridSim examples, see examples/README.txt for details - jars/ -- jar archives - source/ -- The GridSim Java source code - gridsim/*.java - gridsim/auction/*.java -- framework for the auction model - gridsim/datagrid/*.java -- framework for the Data Grids model - gridsim/filter/*.java -- filters incoming events - gridsim/index/*.java -- framework for the Grid Info Service model - gridsim/net/*.java -- framework for the network model - gridsim/resFailure/*.java -- framework for the resource failure model - gridsim/util/*.java -- includes some statistics classes. - -GridSim APIs and examples are also available on the GridSim website. -If you are looking for applications or programs built on top of GridSim, -such as gridbroker or Visual Modeler, they can be found below: -http://www.gridbus.org/gridsim/release.html - - -Software Requirements : Java version 1.4.2 or newer ---------------------- -GridSim has been tested and ran on Sun's Java version 1.4.2 or newer. -Older versions of Java are not compatible. -If you have non-Sun Java version, such as gcj or J++, they may not be compatible. -You also need to install Ant to compile GridSim (explained in more details later). - - -Installation and Running GridSim Toolkit ----------------------------------------- -There is no special program to install GridSim. You just need to -unzip the GridSim file to install. -If you want to remove GridSim, then remove the whole $GRIDSIM directory. - -NOTE: You do not need to compile GridSim source code. The JAR file is - provided to compile and to run GridSim applications. - -Description of the following jar files: -* gridsim.jar -- contains both GridSim and SimJava v2.0 class files -* simjava2.jar -- contains SimJava v2.0 class files only - -To compile and run GridSim applications, do the following step: -1) Go the directory where the GridSim's Example1 reside - In Unix or Linux: cd $GRIDSIM/examples/Example01 - In Windows: cd %GRIDSIM%\examples\Example01 - -2) Compile the Java source file - In Unix or Linux: javac -classpath $GRIDSIM/jars/gridsim.jar:. Example1.java - In Windows: javac -classpath %GRIDSIM%\jars\gridsim.jar;. Example1.java - -3) Running the Java class file - In Unix or Linux: java -classpath $GRIDSIM/jars/gridsim.jar:. Example1 - In Windows: java -classpath %GRIDSIM%\jars\gridsim.jar;. Example1 - -NOTE: -* $GRIDSIM or %GRIDSIM% is the location of the GridSim Toolkit package. -* If you are using Java IDEs, such as Eclipse, JBuilder and JCreator, - their instructions (with screenshots) are found on the GridSim website. -* Running GridSim of this version requires a lot of memory since there are many - objects to be created. Therefore, it is recommended to have at least 512MB RAM - or increase JVM heap size when running Java for large simulation experiments. - For example: java -Xmx300m -classpath $GRIDSIM/jars/gridsim.jar:. Example1 - (max. heap size is 300MB). - - -Learning GridSim ----------------- -To understand on how to use GridSim, please go through the examples provided -in the $GRIDSIM/examples/ directory. Example 1 - 6 are mainly for beginners, -whereas the rest describes more complex GridSim functionalities. -The same examples are also hosted in the GridSim website. - -At the moment, GridSim has two allocation policies or scheduling algorithms, -i.e. First Come First Service (as described in SpaceShared.java) and Round -Robin (as described in TimeShared.java). -If you are interested in writing a new scheduling algorithm of a resource, -then look closely on $GRIDSIM/examples/Example08/ directory. -We are certainly welcomed new additions of allocation policies into GridSim. - - -Compiling GridSim : Using Ant ------------------ -This release contains a simple buildfile for compiling GridSim classes. -You need to have ant installed (http://ant.apache.org/). -Ant can be used in both Windows and Unix/Linux environment. - -Usage: -* type 'ant' to compile all gridsim source files and put them into - classes/ directory -* type 'ant makejar' to compile the source files (if necessary) and to create - a new jar file called "new_gridsim.jar" into jars/ directory. - The "new_gridsim.jar" however only contains GridSim classes not SimJava2. - -NOTE: -* You need to set up PATH for ant in Windows and/or Unix. -* rule for javadoc is not included yet. Use javadoc.sh script on Unix instead. - Alternatively, the GridSim API can be found below: - http://www.gridbus.org/gridsim/doc/ - - -Contacting Us : subscribe to Mailing Lists at SourceForge.net -------------- -Please read FAQ, examples, API and other documents in the GridSim website -before contacting us. - -GridSim mailing lists can be found below: -http://sourceforge.net/projects/gridsim/ then click on the "Mailing Lists" tab. - -Please subscribe to the following mailing lists: -gridsim-users (at) lists.sourceforge.net - for any queries and feedbacks -gridsim-developers (at) lists.sourceforge.net - for contributing to GridSim - -Contributors are always needed to improve and maintain GridSim. -Another option is to integrate your work/project into future GridSim releases. -If you want to contribute, advertise yourself to us. -Benefits of your contributions: -- you help future Grid researchers and students like you and us; -- you can proudly write your contributions in the resume or CV; -- you gain knowledge and skills in using SVN version control, Java, and OO; and -- more importantly, you are dealing with a real software engineering development - and working with collaborators or developers from other parts of the world - (at the moment, they are from "down under"). - You can not get this kind of unique experience by doing it yourself or - in university assignments or projects. - -NOTE: -* If you experience some problems when compiling/running GridSim, - write a detailed email. The more information you provide, the better - we analyze your problem. Hence, the sooner we can reply. -* Please send your questions to these mailing lists so that other people can - read and reply them. -* We have hectic schedules, so do not expect an instant reply. - - -Bugs Reporting --------------- -If you found any bugs, please report them to: -http://sourceforge.net/projects/gridsim/ then click on the "Tracker" tab. - -To prevent any false reports, it is recommended that you email us first on -gridsim-developers (at) lists.sourceforge.net -to identify whether the problem is caused by bugs in the GridSim code -or something else, such as using Java version 1.3. - -Please be specific when you report a bug. We need information such as -GridSim version number, Java version number, detailed descriptions, -snippets of the (buggy) code and any exception errors. -A 'nobody' report in the tracker will probably be ignored. - - -Requesting New Features ------------------------ -If you decide to implement any new features, we will try our best to help you -with directions on where to start and how to design and implement without -breaking the existing design and code respectively. - - -Acknowledgement ---------------- - -For their outstanding contributions to GridSim : -* Agustin Caminero from The University of Castilla La Mancha, Spain - for his work on the gridsim.resFailure package. - -* Uros Cibej from The University of Ljubljana, Slovenia - for providing build.xml file and instruction on how to - use ant. In addition, he worked on the gridsim.datagrid package. - -* Gokul Poduval from National University of Singapore - for his work on the gridsim.net package. - -* Marcos Dias de Assuncao from Grids Lab, The University of Melbourne, Australia - for his work on the gridsim.auction package - -We also thank the following people for finding bugs in GridSim : -Gokul Poduval, Uros Cibej, Agustin Caminero, Sai Rahul Reddy, Jakub Milkiewicz, -Mads Mbuso Sibeko, Felipe Ramos. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |