[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/directory
ExperimentDataCollector.java, 1.1, 1.2 TraceAnalyser.java, 1.1, 1.2
Chien-Liang Fok
chien-liang at users.sourceforge.net
Wed Apr 5 16:56:22 PDT 2006
- Previous message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/sf
MultiSerialForwarder.java, NONE, 1.1
- Next message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla
QueryNeighborList.java, NONE, 1.1 Example of agilla.properties,
NONE, 1.1 Makefile, 1.7, 1.8 AgillaProperties.java, 1.8, 1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/directory
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22793/edu/wustl/mobilab/directory
Modified Files:
ExperimentDataCollector.java TraceAnalyser.java
Log Message:
Index: ExperimentDataCollector.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/directory/ExperimentDataCollector.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ExperimentDataCollector.java 5 Apr 2006 18:33:59 -0000 1.1
--- ExperimentDataCollector.java 5 Apr 2006 23:56:11 -0000 1.2
***************
*** 20,26 ****
--- 20,30 ----
public static final int QUERY_RESULTS_RECEIVED = 2;
+ public static final int MAX_NUM_QUERIES = 100; // how many queries to wait for before stopping experiment
+
private boolean debug;
private Vector<Mote> motes = new Vector<Mote>();
private TraceReceiver traceRcvr = new TraceReceiver();
+ private int numQs = 0;
+ private JFrame frame;
public ExperimentDataCollector(int[] ports, boolean debug) {
***************
*** 79,83 ****
}
});
! JFrame frame = new JFrame();
frame.setTitle("Exp Data Collector");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
--- 83,87 ----
}
});
! frame = new JFrame();
frame.setTitle("Exp Data Collector");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
***************
*** 108,111 ****
--- 112,123 ----
+ trace.get_agentID() + " " + trace.get_nodeID() + " " + convString(trace.get_action()) + " "
+ trace.get_success() + " " + trace.get_loc_x()+ " " + trace.get_loc_y());
+
+ // once MAX_NUM_QUERIES has been performed, stop the experiment
+ if (trace.get_action() == QUERY_RESULTS_RECEIVED) {
+ if (++numQs == MAX_NUM_QUERIES) {
+ frame.setVisible(false);
+ doFinish();
+ }
+ }
}
}
***************
*** 155,159 ****
public void fetchResults() {
gotResults = false;
! while (!gotResults) {
try {
synchronized(lock) {
--- 167,172 ----
public void fetchResults() {
gotResults = false;
! int numTries = 0;
! while (!gotResults && numTries++ < 5) {
try {
synchronized(lock) {
***************
*** 173,176 ****
--- 186,193 ----
}
}
+ if (!gotResults) {
+ System.out.println("Failed to get results from TCP Port " + tcpPort + ".");
+ numQueries = numUpdates = 0;
+ }
}
Index: TraceAnalyser.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/directory/TraceAnalyser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TraceAnalyser.java 5 Apr 2006 18:33:59 -0000 1.1
--- TraceAnalyser.java 5 Apr 2006 23:56:11 -0000 1.2
***************
*** 23,33 ****
nextLine = reader.readLine();
}
analyze();
}
private void analyze() {
! AgillaLocation intruderLoc = null;
! int numGoodQueries = 0, numBadQueries = 0, numFailedQueries = 0;
// Find out the number of erroneous location lookups
--- 23,34 ----
nextLine = reader.readLine();
}
+ Collections.sort(trace);
analyze();
}
private void analyze() {
! AgillaLocation intruderLoc = null, querierLoc = null;
! int numGoodQueries = 0, numBadQueries = 0, numFailedQueries = 0, numErrors = 0;
// Find out the number of erroneous location lookups
***************
*** 37,42 ****
if (line.action.equals("AGENT_MOVED")) {
if (line.agentID == INTRUDER_AGENT_ID) {
intruderLoc = line.loc;
! }
}
else if (line.action.equals("QUERY_RESULTS_RECEIVED")) {
--- 38,58 ----
if (line.action.equals("AGENT_MOVED")) {
if (line.agentID == INTRUDER_AGENT_ID) {
+ if (intruderLoc != null) {
+ if (Math.abs(intruderLoc.getx() - line.loc.getx()) > 1 || Math.abs(intruderLoc.gety() - line.loc.gety()) > 1) {
+ System.err.println("ERROR: intruder made an illegal move from (" + intruderLoc.getx() + ", " + intruderLoc.gety() + ") to (" + line.loc.getx() + ", " + line.loc.gety() + ")");
+ numErrors++;
+ }
+ }
+
intruderLoc = line.loc;
! } else {
! if (querierLoc != null) {
! if (Math.abs(querierLoc.getx() - line.loc.getx()) > 1 || Math.abs(querierLoc.gety() - line.loc.gety()) > 1) {
! System.err.println("ERROR: querier made an illegal move from (" + querierLoc.getx() + ", " + querierLoc.gety() + ") to (" + line.loc.getx() + ", " + line.loc.gety() + ")");
! numErrors++;
! }
! }
! querierLoc = line.loc;
! }
}
else if (line.action.equals("QUERY_RESULTS_RECEIVED")) {
***************
*** 45,50 ****
if (line.loc.equals(intruderLoc))
numGoodQueries++;
! else
numBadQueries++;
} else
numFailedQueries++;
--- 61,68 ----
if (line.loc.equals(intruderLoc))
numGoodQueries++;
! else {
! log("Bad Result: returned " + line.loc + ", intruder at " + intruderLoc);
numBadQueries++;
+ }
} else
numFailedQueries++;
***************
*** 54,60 ****
System.out.println("Query Statistics: Good: " + numGoodQueries + ", Bad: " + numBadQueries + ", Failed: " + numFailedQueries);
}
! private class TraceLine {
long timeStamp;
int agentID, nodeID;
--- 72,80 ----
System.out.println("Query Statistics: Good: " + numGoodQueries + ", Bad: " + numBadQueries + ", Failed: " + numFailedQueries);
+ System.out.println("Total Number of Queries: " + (numGoodQueries + numBadQueries + numFailedQueries));
+ System.out.println("Number of Errors: " + numErrors);
}
! private class TraceLine implements Comparable<TraceLine> {
long timeStamp;
int agentID, nodeID;
***************
*** 67,91 ****
int eIndex = line.indexOf(" ", sIndex+1);
timeStamp = Long.valueOf(line.substring(sIndex+1, eIndex));
! log("timeStamp = " + timeStamp);
sIndex = eIndex;
eIndex = line.indexOf(" ", sIndex+1);
agentID = Integer.valueOf(line.substring(sIndex+1, eIndex));
! log("agentID = " + agentID);
sIndex = eIndex;
eIndex = line.indexOf(" ", sIndex+1);
nodeID = Integer.valueOf(line.substring(sIndex+1, eIndex));
! log("nodeID = " + nodeID);
sIndex = eIndex;
eIndex = line.indexOf(" ", sIndex+1);
action = line.substring(sIndex+1, eIndex);
! log("action = " + action);
sIndex = eIndex;
eIndex = line.indexOf(" ", sIndex+1);
success = (Integer.valueOf(line.substring(sIndex+1, eIndex)) == 1);
! log("success = " + success);
int x, y;
--- 87,111 ----
int eIndex = line.indexOf(" ", sIndex+1);
timeStamp = Long.valueOf(line.substring(sIndex+1, eIndex));
! //log("timeStamp = " + timeStamp);
sIndex = eIndex;
eIndex = line.indexOf(" ", sIndex+1);
agentID = Integer.valueOf(line.substring(sIndex+1, eIndex));
! //log("agentID = " + agentID);
sIndex = eIndex;
eIndex = line.indexOf(" ", sIndex+1);
nodeID = Integer.valueOf(line.substring(sIndex+1, eIndex));
! //log("nodeID = " + nodeID);
sIndex = eIndex;
eIndex = line.indexOf(" ", sIndex+1);
action = line.substring(sIndex+1, eIndex);
! //log("action = " + action);
sIndex = eIndex;
eIndex = line.indexOf(" ", sIndex+1);
success = (Integer.valueOf(line.substring(sIndex+1, eIndex)) == 1);
! //log("success = " + success);
int x, y;
***************
*** 93,102 ****
eIndex = line.indexOf(" ", sIndex+1);
x = Integer.valueOf(line.substring(sIndex+1, eIndex));
! log("x = " + x);
sIndex = eIndex;
y = Integer.valueOf(line.substring(sIndex+1));
loc = new AgillaLocation(x,y);
! log("y = " + y);
}
}
--- 113,131 ----
eIndex = line.indexOf(" ", sIndex+1);
x = Integer.valueOf(line.substring(sIndex+1, eIndex));
! //log("x = " + x);
sIndex = eIndex;
y = Integer.valueOf(line.substring(sIndex+1));
loc = new AgillaLocation(x,y);
! //log("y = " + y + "\n");
! }
!
! public int compareTo(TraceLine o) {
! if (this.timeStamp < o.timeStamp)
! return -1;
! else if (this.timeStamp == o.timeStamp)
! return 0;
! else
! return 1;
}
}
- Previous message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/sf
MultiSerialForwarder.java, NONE, 1.1
- Next message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla
QueryNeighborList.java, NONE, 1.1 Example of agilla.properties,
NONE, 1.1 Makefile, 1.7, 1.8 AgillaProperties.java, 1.8, 1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-contrib-commits
mailing list