[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r15157: Divide publication time into a) time to download enough dire (projects/hidserv/trunk)



Author: kloesing
Date: 2008-06-11 20:43:24 -0400 (Wed, 11 Jun 2008)
New Revision: 15157

Modified:
   projects/hidserv/trunk/LogFileParser.java
Log:
Divide publication time into a) time to download enough directory information to build circuits and b) time to establish introduction points until uploading the first rendezvous service descriptor.

Modified: projects/hidserv/trunk/LogFileParser.java
===================================================================
--- projects/hidserv/trunk/LogFileParser.java	2008-06-12 00:13:35 UTC (rev 15156)
+++ projects/hidserv/trunk/LogFileParser.java	2008-06-12 00:43:24 UTC (rev 15157)
@@ -63,12 +63,19 @@
 							+ "publtime.csv", false));
 			bw.write("# testid contains a unique test identifier that matches "
 					+ "with the identifiers \n# used in the other output "
-					+ "files, publtime is the time in millis that it \n# "
-					+ "takes to publish the first rendezvous service "
-					+ "descriptor.\n");
-			bw.write("testid,publtime\n");
-			for (Map.Entry<String, Long> e : publicationTimes.entrySet()) {
-				bw.write(e.getKey() + "," + e.getValue() + "\n");
+					+ "files, inittime is the time in millis that it \n# "
+					+ "takes to download enough dir info to build circuits, "
+					+ "and publtime is the \n# time in millis that it takes "
+					+ "afterwards to publish the first rendezvous \n# "
+					+ "service descriptor.\n");
+			bw.write("testid,inittime,publtime\n");
+			for (Map.Entry<String, Long> e : initializationTimes.entrySet()) {
+				if (publicationTimes.containsKey(e.getKey())) {
+					bw.write(e.getKey() + "," + e.getValue() + ","
+							+ publicationTimes.get(e.getKey()) + "\n");
+				} else {
+					bw.write(e.getKey() + "," + e.getValue() + ",NA\n");
+				}
 			}
 			bw.close();
 		} catch (IOException e) {
@@ -207,10 +214,12 @@
 		}
 	}
 
+	static SortedMap<String, Long> initializationTimes = new TreeMap<String, Long>();
 	static SortedMap<String, Long> publicationTimes = new TreeMap<String, Long>();
 
 	static Pattern torLogPattern = Pattern
-			.compile("now have enough directory information|Uploaded rendezvous descriptor");
+			.compile("opening new log file|now have enough directory information|"
+					+ "Uploaded rendezvous descriptor");
 
 	static void parseServerTorLog(File testcaseDirectory) throws IOException {
 		File torLog = new File(testcaseDirectory.getAbsolutePath()
@@ -223,6 +232,7 @@
 		BufferedReader br = new BufferedReader(new FileReader(torLog));
 		String line = null;
 		long started = 0L;
+		long enoughDirInfo = 0L;
 		long firstDescriptorUploaded = 0L;
 		while ((line = br.readLine()) != null) {
 			if (!torLogPattern.matcher(line).find())
@@ -236,19 +246,28 @@
 			c.setTimeInMillis(logTime.getTime());
 			c.set(Calendar.YEAR, currentYear);
 			long t = c.getTimeInMillis();
-			if (started == 0L
+			if (started == 0L && line.contains("opening new log file")) {
+				started = t;
+			} else if (enoughDirInfo == 0L
 					&& line.contains("now have enough directory information")) {
-				started = t;
+				enoughDirInfo = t;
 			} else if (firstDescriptorUploaded == 0L
 					&& line.contains("Uploaded rendezvous descriptor")) {
 				firstDescriptorUploaded = t;
 			}
-			if (started > 0L && firstDescriptorUploaded > 0L) {
+			if (started > 0L && enoughDirInfo > 0L
+					&& firstDescriptorUploaded > 0L) {
 				break;
 			}
 		}
-		long time = firstDescriptorUploaded - started;
-		publicationTimes.put(testcaseDirectory.getName(), time);
+		if (enoughDirInfo > 0L && started > 0L) {
+			initializationTimes.put(testcaseDirectory.getName(), enoughDirInfo
+					- started);
+		}
+		if (firstDescriptorUploaded > 0L && enoughDirInfo > 0L) {
+			publicationTimes.put(testcaseDirectory.getName(),
+					firstDescriptorUploaded - enoughDirInfo);
+		}
 	}
 
 	static SortedMap<String, PuppeTorEvent> puppeTorEvents = new TreeMap<String, PuppeTorEvent>();