GridSim 5.0 beta

gridsim.net
Class InfoPacket

Object
  extended by InfoPacket
All Implemented Interfaces:
Packet

public class InfoPacket
extends Object
implements Packet

InfoPacket class can be used to gather information from the network layer. An InfoPacket traverses the network topology similar to a NetPacket, but it collects information like bandwidths, and Round Trip Time etc. It is the equivalent of ICMP in physical networks.

You can set all the parameters to an InfoPacket that can be applied to a NetPacket. So if you want to find out the kind of information that a particular type of NetPacket is experiencing, set the size and network class of an InfoPacket to the same as the NetPacket, and send it to the same destination from the same source.

Since:
GridSim Toolkit 3.1
Author:
Gokul Poduval & Chen-Khong Tham, National University of Singapore
Invariant:
$none

Constructor Summary
InfoPacket(String name, int packetID, long size, int srcID, int destID, int netServiceType)
          Constructs a new Information packet.
 
Method Summary
 void addBaudRate(double baudRate)
          Every entity that the InfoPacket traverses should add the baud rate of the link on which this packet will be sent out next.
 void addEntryTime(double time)
          This method should be called by routers and other entities when this InfoPacket reaches them along with the current simulation time.
 void addExitTime(double time)
          This method should be called by routers and other entities when this InfoPacket is leaving them.
 void addHop(int id)
          This method should be called by network entities that count as hops, for e.g.
 double getBaudRate()
          Returns the bottleneck bandwidth between the source and the destination
 int getDestID()
          Gets the id of the entity to which the packet is destined.
 Object[] getDetailBaudRate()
          Returns the list of all the bandwidths that this packet has traversed
 Object[] getDetailEntryTimes()
          Returns the list of all entry time that this packet has traversed.
 Object[] getDetailExitTimes()
          Returns the list of all exit time that this packet has traversed.
 Object[] getDetailHops()
          Returns the list of all the hops that this packet has traversed.
 int getID()
          Returns the ID of this packet
 int getLast()
          Gets an entity ID from the last hop that this packet has traversed.
 int getNetServiceType()
          Gets the network service type of this packet
 int getNumHop()
          Returns the number of hops that this packet has traversed.
 long getOriginalPingSize()
          Gets original size of ping request
 long getSize()
          Gets the size of this packet.
 int getSrcID()
          Gets the id of the entity that sent out this packet
 int getTag()
          Gets this packet tag
 double getTotalResponseTime()
          Gets the total time that this packet has spent in the network.
 void setDestID(int id)
          Sets the destination ID for this packet
 void setLast(int last)
          Sets an entity ID from the last hop that this packet has traversed.
 void setNetServiceType(int netServiceType)
          Sets the network service type of this packet
 void setOriginalPingSize(long size)
          Sets original size of ping request
 boolean setSize(long size)
          Sets the size of this packet
 boolean setTag(int tag)
          Sets the tag of this packet
 String toString()
          Returns a human-readable information of this packet.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InfoPacket

public InfoPacket(String name,
                  int packetID,
                  long size,
                  int srcID,
                  int destID,
                  int netServiceType)
Constructs a new Information packet.

Parameters:
name - Name of this packet
packetID - The ID of this packet
size - size of the packet
srcID - The ID of the entity that sends out this packet
destID - The ID of the entity to which this packet is destined
netServiceType - the class of traffic this packet belongs to
Pre Condition:
name != null
Post Condition:
$none
Method Detail

getID

public int getID()
Returns the ID of this packet

Specified by:
getID in interface Packet
Returns:
packet ID
Pre Condition:
$none
Post Condition:
$none

setOriginalPingSize

public void setOriginalPingSize(long size)
Sets original size of ping request

Parameters:
size - ping data size (in bytes)
Pre Condition:
size >= 0
Post Condition:
$none

getOriginalPingSize

public long getOriginalPingSize()
Gets original size of ping request

Returns:
original size
Pre Condition:
$none
Post Condition:
$none

toString

public String toString()
Returns a human-readable information of this packet.

Specified by:
toString in interface Packet
Overrides:
toString in class Object
Returns:
description of this packet
Pre Condition:
$none
Post Condition:
$none

getSize

public long getSize()
Gets the size of this packet.

Specified by:
getSize in interface Packet
Returns:
size of the packet.
Pre Condition:
$none
Post Condition:
$none

setSize

public boolean setSize(long size)
Sets the size of this packet

Specified by:
setSize in interface Packet
Parameters:
size - size of the packet
Returns:
true if it is successful, false otherwise
Pre Condition:
size >= 0
Post Condition:
$none

getDestID

public int getDestID()
Gets the id of the entity to which the packet is destined.

Specified by:
getDestID in interface Packet
Returns:
the desination ID
Pre Condition:
$none
Post Condition:
$none

getSrcID

public int getSrcID()
Gets the id of the entity that sent out this packet

Specified by:
getSrcID in interface Packet
Returns:
the source ID
Pre Condition:
$none
Post Condition:
$none

getNumHop

public int getNumHop()
Returns the number of hops that this packet has traversed. Since the packet takes a round trip, the same router may have been traversed twice.

Returns:
the number of hops this packet has traversed
Pre Condition:
$none
Post Condition:
$none

getTotalResponseTime

public double getTotalResponseTime()
Gets the total time that this packet has spent in the network. This is basically the RTT. Dividing this by half should be the approximate latency.

RTT is taken as the final entry time - first exit time.

Returns:
total round time
Pre Condition:
$none
Post Condition:
$none

getBaudRate

public double getBaudRate()
Returns the bottleneck bandwidth between the source and the destination

Returns:
the bottleneck bandwidth
Pre Condition:
$none
Post Condition:
$none

addHop

public void addHop(int id)
This method should be called by network entities that count as hops, for e.g. Routers or GridResources. It should not be called by links etc.

Parameters:
id - the id of the hop that this InfoPacket is traversing
Pre Condition:
id > 0
Post Condition:
$none

addEntryTime

public void addEntryTime(double time)
This method should be called by routers and other entities when this InfoPacket reaches them along with the current simulation time.

Parameters:
time - current simulation time, use GridSim.clock() to obtain this
Pre Condition:
time >= 0
Post Condition:
$none

addExitTime

public void addExitTime(double time)
This method should be called by routers and other entities when this InfoPacket is leaving them. It should also supply the current simulation time.

Parameters:
time - current simulation time, use GridSim.clock() to obtain this
Pre Condition:
time >= 0
Post Condition:
$none

addBaudRate

public void addBaudRate(double baudRate)
Every entity that the InfoPacket traverses should add the baud rate of the link on which this packet will be sent out next.

Parameters:
baudRate - the entity's baud rate in bits/s
Pre Condition:
baudRate > 0
Post Condition:
$none

getDetailBaudRate

public Object[] getDetailBaudRate()
Returns the list of all the bandwidths that this packet has traversed

Returns:
a Double Array of links bandwidths
Pre Condition:
$none
Post Condition:
$none

getDetailHops

public Object[] getDetailHops()
Returns the list of all the hops that this packet has traversed.

Returns:
an Integer Array of hop ids
Pre Condition:
$none
Post Condition:
$none

getDetailEntryTimes

public Object[] getDetailEntryTimes()
Returns the list of all entry time that this packet has traversed.

Returns:
an Integer Array of entry time
Pre Condition:
$none
Post Condition:
$none

getDetailExitTimes

public Object[] getDetailExitTimes()
Returns the list of all exit time that this packet has traversed.

Returns:
an Integer Array of exit time
Pre Condition:
$none
Post Condition:
$none

getLast

public int getLast()
Gets an entity ID from the last hop that this packet has traversed.

Specified by:
getLast in interface Packet
Returns:
an entity ID
Pre Condition:
$none
Post Condition:
$none

setLast

public void setLast(int last)
Sets an entity ID from the last hop that this packet has traversed.

Specified by:
setLast in interface Packet
Parameters:
last - an entity ID from the last hop
Pre Condition:
last > 0
Post Condition:
$none

getNetServiceType

public int getNetServiceType()
Gets the network service type of this packet

Specified by:
getNetServiceType in interface Packet
Returns:
the network service type
Pre Condition:
$none
Post Condition:
$none

setNetServiceType

public void setNetServiceType(int netServiceType)
Sets the network service type of this packet

Specified by:
setNetServiceType in interface Packet
Parameters:
netServiceType - the packet's network service type
Pre Condition:
netServiceType >= 0
Post Condition:
$none

getTag

public int getTag()
Gets this packet tag

Specified by:
getTag in interface Packet
Returns:
this packet tag
Pre Condition:
$none
Post Condition:
$none

setTag

public boolean setTag(int tag)
Sets the tag of this packet

Parameters:
tag - the packet's tag
Returns:
true if successful, false otherwise
Pre Condition:
tag > 0
Post Condition:
$none

setDestID

public void setDestID(int id)
Sets the destination ID for this packet

Parameters:
id - this packet's destination ID
Pre Condition:
id > 0
Post Condition:
$none

GridSim 5.0 beta

The University of Melbourne, Australia, 2009