public abstract class Tracer
A superclass that should be extended by tracers. This class provides basic functionality to collate events and compute statistics. A subclass must provide the methods to appopriately format the data in the trace file.
Modifiers | Name | Description |
---|---|---|
protected static int |
DROP |
Event indicating that a packet has been dropped. |
protected static int |
ENQUEUE |
Event indicating a packet has been queued. |
protected static int |
RECEIVE |
Event indicating that a packet has been received. |
protected static int |
SEND |
Event indicating that a packet has been sent. |
protected PrintStream |
out |
The output stream to write trace file output to. |
Type | Name and description |
---|---|
double |
warmup |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
begin(String msg) Marks the beginning of a simulation. |
|
void |
close() Closes the trace file. |
|
void |
comment(String msg) Logs a comment to the trace file. |
|
void |
dropped(int node, Transmission rx, String msg) Indicates that a packet has been dropped. |
|
void |
end(String msg) Marks the end of a simulation. |
|
void |
enqueued(Transmission tx, String msg) Indicates that a packet has been queued for transmission. |
|
protected void |
finalize() |
|
int |
getDropCount() Gets the number of packets dropped since warmup. |
|
int |
getEnqueueCount() Gets the number of packets queued since warmup. |
|
double |
getLoad() Gets the normalized actual network load. |
|
double |
getMeanDelay() Gets the mean delay between queuing and reception. |
|
double |
getOfferedLoad() Gets the normalized offered network load. |
|
int |
getRxCount() Gets the number of packets received since warmup. |
|
double |
getThroughput() Gets the normalized network throughput. |
|
protected double |
getTime() Gets the current time as per the timestamp provider. |
|
int |
getTxCount() Gets the number of packets sent since warmup. |
|
double |
getWarmup() Gets the amount of time in seconds to ignore (for statistics computation) at the beginning of each simulation. |
|
boolean |
isOpen() Check if trace file is open. |
|
void |
moved(int node, double[] location, String msg) Indicates that a node has moved to a new location. |
|
void |
open(String filename) Opens a trace file to write to. |
|
void |
open(File file) Opens a trace file to write to. |
|
protected void |
print(String msg) Log a comment. |
|
void |
received(int node, Reception rx, String msg) Indicates that a packet has been received. |
|
void |
resetStats() Resets all statistics. |
|
void |
sent(Transmission tx, String msg) Indicates that a packet has been sent. |
|
void |
setTimestampProvider(TimestampProvider platform) Sets the time provider used to get current time for logging. |
|
void |
setWarmup(double seconds) Sets the amount of time in seconds to ignore (for statistics computation) at the beginning of each simulation. |
|
protected void |
trace(int event, int node, Transmission tx, String msg) Log a trace event. |
|
protected void |
track(int node, double[] location, String msg) Log a location of a node. |
Event indicating that a packet has been dropped.
Event indicating a packet has been queued.
Event indicating that a packet has been received.
Event indicating that a packet has been sent.
The output stream to write trace file output to.
Marks the beginning of a simulation.
msg
- message to logCloses the trace file.
Logs a comment to the trace file.
msg
- comment to logIndicates that a packet has been dropped.
node
- node address at which the drop occurredrx
- details of the packetmsg
- message to logMarks the end of a simulation.
msg
- message to logIndicates that a packet has been queued for transmission.
tx
- details of the packetmsg
- message to logGets the number of packets dropped since warmup.
Gets the number of packets queued since warmup.
Gets the normalized actual network load.
Gets the mean delay between queuing and reception.
Gets the normalized offered network load.
Gets the number of packets received since warmup.
Gets the normalized network throughput.
Gets the current time as per the timestamp provider. This method should be used by subclasses to determine timestamp for logging.
Gets the number of packets sent since warmup.
Gets the amount of time in seconds to ignore (for statistics computation) at the beginning of each simulation.
Check if trace file is open.
Indicates that a node has moved to a new location.
node
- node addresslocation
- array of 2-3 coordinates (x,y or x,y,z) in metersmsg
- message to logOpens a trace file to write to.
filename
- name of trace fileOpens a trace file to write to.
file
- trace fileLog a comment. This method should be overridden by a subclass to provide appropriate formatting.
msg
- message to logIndicates that a packet has been received.
node
- receiving node's addressrx
- details of the packetmsg
- message to logResets all statistics.
Indicates that a packet has been sent.
tx
- details of the packetmsg
- message to logSets the time provider used to get current time for logging.
platform
- time provider.Sets the amount of time in seconds to ignore (for statistics computation) at the beginning of each simulation.
seconds
- warmup timeLog a trace event. This method should be overridden by a subclass to provide appropriate formatting.
event
- type of event (ENQUEUE/SEND/RECEIVE/DROP)node
- node address where the event occurredtx
- details of the packet related to the eventmsg
- message to log along with the eventLog a location of a node. This method should be overridden by a subclass to provide appropriate formatting.
node
- node addresslocation
- array of 2-3 coordinates (x,y or x,y,z) denoting the location of the nodemsg
- message to log along with the location