From: <bro...@us...> - 2008-02-21 06:06:30
|
Revision: 119 http://gridsim.svn.sourceforge.net/gridsim/?rev=119&view=rev Author: brobergj Date: 2008-02-20 22:06:35 -0800 (Wed, 20 Feb 2008) Log Message: ----------- *Made tracking of bottleneck easier via addLink() *Track bottleneck Link ID at all times *Track remaining flow size Modified Paths: -------------- branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowPacket.java Modified: branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowPacket.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowPacket.java 2008-02-21 05:35:52 UTC (rev 118) +++ branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowPacket.java 2008-02-21 06:06:35 UTC (rev 119) @@ -31,10 +31,11 @@ private int destID; // where the packet wants to go private int srcID; // sender ID private long size; // packet size (for calculating transmission time) - private long origSize; // original packet size + private long remSize; // remaining packet size private Object obj; // the actual object, the type depends on context private double bandwidth_; // Bottleneck baud rate + private int bottleneckID; // Bottleneck link ID private Vector baudRates_; // list of entity's baud rate @@ -43,6 +44,12 @@ // Sum of latency (delay) on path private double latency; + // Packet start time + private double startTime; + + // Packet last size update time + private double updateTime; + // original tag with which the encapsulated object was submitted private int tag; @@ -74,7 +81,9 @@ { this.obj = data ; this.size = size ; - this.origSize = size ; + this.remSize = size ; + this.startTime = -1.0; + this.updateTime = -1.0; this.tag = tag ; this.destID = destID; this.srcID = srcID ; @@ -87,6 +96,7 @@ this.latency = 0.0; this.bandwidth_ = Double.MAX_VALUE; this.baudRates_ = new Vector(); + this.bottleneckID = -1; } @@ -118,6 +128,9 @@ { this.obj = data; this.size = size; + this.remSize = size ; + this.startTime = -1.0; + this.updateTime = -1.0; this.tag = tag; this.destID = destID; this.srcID = srcID; @@ -130,6 +143,8 @@ this.latency = 0.0; this.bandwidth_ = -1; this.baudRates_ = new Vector(); + this.links_ = new Vector(); + this.bottleneckID = -1; } @@ -227,16 +242,6 @@ } /** - * Gets the original size of this packet - * @return the packet size - * @pre $none - * @post $none - */ - public long getOrigSize() { - return origSize; - } - - /** * Sets the packet size * @param size the packet size * @return <tt>true</tt> if it is successful, <tt>false</tt> otherwise @@ -365,15 +370,18 @@ this.latency += latency; } - public void addBaudRate(double baudRate) + public synchronized void addBaudRate(Link link) { + double baudRate = link.getBaudRate(); + if (baudRates_ == null) { return; } baudRates_.add( new Double(baudRate) ); if (bandwidth_ < 0 || baudRate < this.bandwidth_) { - this.bandwidth_ = baudRate; + this.setBandwidth_(baudRate); + this.setBottleneckID(link.get_id()); } } @@ -381,18 +389,56 @@ return bandwidth_; } - public void setBandwidth_(double bandwidth_) { + public synchronized void setBandwidth_(double bandwidth_) { this.bandwidth_ = bandwidth_; } - public void addLink(Link link) + public synchronized void addLink(Link link) { if (links_ == null) { return; } links_.add( link ); + this.addBaudRate(link); + this.addLatency(link.getDelay()); } + public double getStartTime() { + return startTime; + } + + public void setStartTime(double startTime) { + this.startTime = startTime; + } + + public double getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(double updateTime) { + this.updateTime = updateTime; + } + + public long getRemSize() { + return remSize; + } + + public void setRemSize(long remSize) { + this.remSize = remSize; + } + + public Vector getLinks_() { + return links_; + } + + public int getBottleneckID() { + return bottleneckID; + } + + public void setBottleneckID(int bottleneckID) { + this.bottleneckID = bottleneckID; + } + } // end class This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |