[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/directory
TraceAnalyser.java, 1.14, 1.15
Chien-Liang Fok
chien-liang at users.sourceforge.net
Wed Apr 12 13:57:36 PDT 2006
Update of /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/directory
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3229/edu/wustl/mobilab/directory
Modified Files:
TraceAnalyser.java
Log Message:
Index: TraceAnalyser.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/directory/TraceAnalyser.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** TraceAnalyser.java 12 Apr 2006 19:31:26 -0000 1.14
--- TraceAnalyser.java 12 Apr 2006 20:57:34 -0000 1.15
***************
*** 11,15 ****
static int NUM_INTRUDER_AGENTS = 10; // the number of intruder agents within the system
! static int MAX_AGENT_NUM = 2; // max number of agents within a GetAgentsResults message.
private boolean debug;
--- 11,15 ----
static int NUM_INTRUDER_AGENTS = 10; // the number of intruder agents within the system
! static final int MAX_AGENT_NUM = 2; // max number of agents within a GetAgentsResults message.
private boolean debug;
***************
*** 34,40 ****
Collections.sort(trace);
! log("Sorted trace: ");
! for (int i = 0; i < trace.size(); i++)
! log(trace.get(i).toString());
analyze();
}
--- 34,40 ----
Collections.sort(trace);
! // log("Sorted trace: ");
! // for (int i = 0; i < trace.size(); i++)
! // log(trace.get(i).toString());
analyze();
}
***************
*** 196,200 ****
if (result.numResults() == 0)
numFailedQueries++;
! else if (result.numResults() != NUM_INTRUDER_AGENTS) {
numBadQueries++;
} else
--- 196,200 ----
if (result.numResults() == 0)
numFailedQueries++;
! else if (result.numResults() != NUM_INTRUDER_AGENTS || result.errorSum() != 0) {
numBadQueries++;
} else
***************
*** 357,392 ****
public TraceLineGetAgents(String line)
{
int sIndex = line.indexOf(" ");
int 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);
timeStamp = Long.valueOf(line.substring(sIndex+1, eIndex));
! //log("timeStamp = " + timeStamp);
action = "QUERY_GET_AGENTS_RESULT_RECEIVED_DATA";
! //log("action = " + action);
sIndex = eIndex;
eIndex = line.indexOf(" ", sIndex+1);
qid = Integer.valueOf(line.substring(sIndex+1, eIndex));
! //log("qid = " + qid);
sIndex = eIndex;
eIndex = line.indexOf(" ", sIndex+1);
numAgents = Integer.valueOf(line.substring(sIndex+1, eIndex));
! //log("numAgents = " + numAgents);
int count = numAgents;
! if (numAgents > MAX_AGENT_NUM)
count = MAX_AGENT_NUM;
for (int i = 0; i < count; i++)
{
--- 357,396 ----
public TraceLineGetAgents(String line)
{
+ System.out.println("TraceLineGetAgents: " + line);
+
int sIndex = line.indexOf(" ");
int 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);
timeStamp = Long.valueOf(line.substring(sIndex+1, eIndex));
! log("timeStamp = " + timeStamp);
action = "QUERY_GET_AGENTS_RESULT_RECEIVED_DATA";
! log("action = " + action);
sIndex = eIndex;
eIndex = line.indexOf(" ", sIndex+1);
qid = Integer.valueOf(line.substring(sIndex+1, eIndex));
! log("qid = " + qid);
sIndex = eIndex;
eIndex = line.indexOf(" ", sIndex+1);
numAgents = Integer.valueOf(line.substring(sIndex+1, eIndex));
! log("numAgents = " + numAgents);
int count = numAgents;
! if (count > MAX_AGENT_NUM)
count = MAX_AGENT_NUM;
+ log("count = " + count);
+
for (int i = 0; i < count; i++)
{
***************
*** 401,409 ****
sIndex = eIndex;
! if (i+1 < count) {
! eIndex = line.indexOf(" ", sIndex+1);
! y = Integer.valueOf(line.substring(sIndex+1, eIndex));
! } else
y = Integer.valueOf(line.substring(sIndex+1));
agentids.add(new AgillaAgentID(id));
agentLocs.add(new AgillaLocation(x,y));
--- 405,414 ----
sIndex = eIndex;
! eIndex = line.indexOf(" ", sIndex+1);
! System.out.println("sIndex = " + sIndex + ", eIndex = " + eIndex);
! if (eIndex < 0)
y = Integer.valueOf(line.substring(sIndex+1));
+ else
+ y = Integer.valueOf(line.substring(sIndex+1, eIndex));
agentids.add(new AgillaAgentID(id));
agentLocs.add(new AgillaLocation(x,y));
***************
*** 470,474 ****
QUERIER_AGENT_ID = Integer.valueOf(args[++index]);
} else if (arg.equals("-n")) {
! MAX_AGENT_NUM = Integer.valueOf(args[++index]);
} else {
System.err.println("Unknown argument \"" + arg + "\"");
--- 475,479 ----
QUERIER_AGENT_ID = Integer.valueOf(args[++index]);
} else if (arg.equals("-n")) {
! NUM_INTRUDER_AGENTS = Integer.valueOf(args[++index]);
} else {
System.err.println("Unknown argument \"" + arg + "\"");
More information about the Tinyos-contrib-commits
mailing list