[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/directory ExperimentDataCollector.java, 1.15, 1.16 TraceAnalyser.java, 1.9, 1.10

Chien-Liang Fok chien-liang at users.sourceforge.net
Mon Apr 10 23:06:14 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-serv13865/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.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** ExperimentDataCollector.java	11 Apr 2006 04:49:34 -0000	1.15
--- ExperimentDataCollector.java	11 Apr 2006 06:06:11 -0000	1.16
***************
*** 195,199 ****
  						+ trace.get_loc_x()+ " " + trace.get_loc_y());
  				
! 				// once MAX_NUM_QUERIES has been performed, stop the experiment
  				if (trace.get_action() == QUERY_GET_LOCATION_RESULTS_RECEIVED
  						|| trace.get_action() == QUERY_GET_CLOSEST_AGENT_RESULTS_RECEIVED) {
--- 195,199 ----
  						+ trace.get_loc_x()+ " " + trace.get_loc_y());
  				
! 				// Stop the experiment after MAX_NUM_QUERIES has been performed
  				if (trace.get_action() == QUERY_GET_LOCATION_RESULTS_RECEIVED
  						|| trace.get_action() == QUERY_GET_CLOSEST_AGENT_RESULTS_RECEIVED) {

Index: TraceAnalyser.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/directory/TraceAnalyser.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** TraceAnalyser.java	11 Apr 2006 04:49:43 -0000	1.9
--- TraceAnalyser.java	11 Apr 2006 06:06:11 -0000	1.10
***************
*** 23,26 ****
--- 23,28 ----
  			if (nextLine.startsWith("TRACE:"))
  				trace.add(new TraceLine(nextLine));
+ 			else if (nextLine.startsWith("TRACE_GET_AGENTS"))
+ 				trace.add(new TraceLineGetAgents(nextLine));
  			nextLine = reader.readLine();
  		}
***************
*** 49,63 ****
  			{
  				numQueryMessages++;
! 			} else if (line.action.equals("QUERY_GET_LOCATION_RESULTS_FORWARDED") ||
  					line.action.equals("QUERY_GET_LOCATION_RESULTS_RECEIVED") ||
  					line.action.equals("QUERY_GET_CLOSEST_AGENT_RESULTS_FORWARDED") ||
! 					line.action.equals("QUERY_GET_CLOSEST_AGENT_RESULTS_RECEIVED")) 
  			{
  				numResultsMessages++;
  				
! 			} else if (line.action.equals("AGENT_LOCATION_SENT")) 
  			{
  				numLocationUpdateMessages++;
! 			} else if (line.action.equals("AGENT_MOVED")) {						
  				AgillaAgentID key = new AgillaAgentID(line.agentID);
  				if (agentLocTable.containsKey(key))
--- 51,74 ----
  			{
  				numQueryMessages++;
! 			}
! 			
! 			if (line.action.equals("QUERY_GET_LOCATION_RESULTS_FORWARDED") ||
  					line.action.equals("QUERY_GET_LOCATION_RESULTS_RECEIVED") ||
  					line.action.equals("QUERY_GET_CLOSEST_AGENT_RESULTS_FORWARDED") ||
! 					line.action.equals("QUERY_GET_CLOSEST_AGENT_RESULTS_RECEIVED") ||
! 					line.action.equals("QUERY_GET_AGENTS_RESULT_RECEIVED") ||
! 					line.action.equals("QUERY_GET_AGENTS_RESULTS_FORWARDED")) 
  			{
  				numResultsMessages++;
  				
! 			}
! 			
! 			if (line.action.equals("AGENT_LOCATION_SENT")) 
  			{
  				numLocationUpdateMessages++;
! 			}
! 			
! 			if (line.action.equals("AGENT_MOVED")) 
! 			{						
  				AgillaAgentID key = new AgillaAgentID(line.agentID);
  				if (agentLocTable.containsKey(key))
***************
*** 103,108 ****
  			if (line.action.equals("QUERY_GET_CLOSEST_AGENT_RESULTS_RECEIVED")) {
  				if (line.agentID == QUERIER_AGENT_ID) {	
! 					if (line.success) {
! 						
  						// Check to see whether there is an agent at the specified location
  						if (agentLocTable.containsValue(line.loc)) {
--- 114,118 ----
  			if (line.action.equals("QUERY_GET_CLOSEST_AGENT_RESULTS_RECEIVED")) {
  				if (line.agentID == QUERIER_AGENT_ID) {	
! 					if (line.success) {						
  						// Check to see whether there is an agent at the specified location
  						if (agentLocTable.containsValue(line.loc)) {
***************
*** 135,138 ****
--- 145,155 ----
  				}
  			}
+ 			
+ 			if (line.action.equals("QUERY_GET_CLOSEST_AGENT_RESULTS_RECEIVED")) {
+ 				if (line.agentID == QUERIER_AGENT_ID) {
+ 					
+ 				}
+ 			}				
+ 			
  		}
  		
***************
*** 153,156 ****
--- 170,176 ----
  		AgillaLocation loc;
  		
+ 		public TraceLine() {		
+ 		}
+ 		
  		public TraceLine(String line) {
  			int sIndex = line.indexOf(" ");
***************
*** 177,181 ****
  			eIndex = line.indexOf(" ", sIndex+1);
  			qid = Integer.valueOf(line.substring(sIndex+1, eIndex));
! 			//log("success = " + success);
  			
  			sIndex = eIndex;
--- 197,201 ----
  			eIndex = line.indexOf(" ", sIndex+1);
  			qid = Integer.valueOf(line.substring(sIndex+1, eIndex));
! 			//log("qid = " + qid);
  			
  			sIndex = eIndex;
***************
*** 212,215 ****
--- 232,315 ----
  	} // TraceLine
  	
+ 	private class TraceLineGetAgents extends TraceLine 
+ 	{
+ 		int numAgents;
+ 		Vector<AgillaAgentID> agentids = new Vector<AgillaAgentID>();
+ 		Vector<AgillaLocation> agentLocs = new Vector<AgillaLocation>();
+ 		
+ 		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";
+ 			//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);
+ 			
+ 			for (int i = 0; i < numAgents; i++) 
+ 			{
+ 				int id, x, y;
+ 				sIndex = eIndex;
+ 				eIndex = line.indexOf(" ", sIndex+1);
+ 				id = Integer.valueOf(line.substring(sIndex+1, eIndex));
+ 				
+ 				sIndex = eIndex;
+ 				eIndex = line.indexOf(" ", sIndex+1);
+ 				x = Integer.valueOf(line.substring(sIndex+1, eIndex));
+ 				
+ 				sIndex = eIndex;
+ 				eIndex = line.indexOf(" ", sIndex+1);
+ 				y = Integer.valueOf(line.substring(sIndex+1, eIndex));
+ 				agentids.add(new AgillaAgentID(id));
+ 				agentLocs.add(new AgillaLocation(x,y));
+ 			}
+ //			int x, y;
+ //			sIndex = eIndex;
+ //			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");
+ 			
+ //			String logme = ("TRACE_GET_AGENTS: " + trace.get_agentID() + " " + trace.get_nodeID() + " "
+ //					+ trace.get_timestamp_high32() + "" + trace.get_timestamp_low32() + " "
+ //					+ trace.get_qid() + " " + trace.get_num_agents() + " ");
+ //			for (int i = 0; i < trace.get_num_agents(); i++) {
+ //				logme += trace.getElement_agent_id_id(i) + " " + trace.getElement_loc_x(i) + " " + trace.getElement_loc_y(i);
+ //			}
+ 		}
+ 		
+ 		public String toString() {
+ 			String result = "TRACE: " + agentID + " " + nodeID + " " + timeStamp + " " +  action + " " + qid + " " + numAgents;
+ 			for (int i = 0; i < agentids.size(); i++) {				
+ 				result += " " + agentids.get(i).getID() + " " + agentLocs.get(i).getx() + " " + agentLocs.get(i).gety(); 
+ 			}
+ 			return result;
+ 		}
+ 	}
  	private void log(String msg) {
  		if (debug)



More information about the Tinyos-contrib-commits mailing list