r7468 - dumbhippo/trunk/firehose/firehose



Author: walters
Date: 2008-05-06 11:39:53 -0500 (Tue, 06 May 2008)
New Revision: 7468

Added:
   dumbhippo/trunk/firehose/firehose/logstats.groovy
Log:
Quick script to analyze firehose log


Added: dumbhippo/trunk/firehose/firehose/logstats.groovy
===================================================================
--- dumbhippo/trunk/firehose/firehose/logstats.groovy	2008-05-01 22:31:11 UTC (rev 7467)
+++ dumbhippo/trunk/firehose/firehose/logstats.groovy	2008-05-06 16:39:53 UTC (rev 7468)
@@ -0,0 +1,28 @@
+#!/usr/bin/env groovy
+
+import java.text.SimpleDateFormat
+
+def updatePattern = ~/splitting ([0-9]+) tasks into messages/
+
+def asctimeFormat = new SimpleDateFormat('yyyy-MM-dd HH:mm:ss,SSS')
+
+def logf = new File(args[0])
+def firstDate = null
+def lastDate = null
+def total = 0
+logf.eachLine { line ->
+    def elts = line.split(' ', 5)
+    def msg = elts[4]
+	def matcher = updatePattern.matcher(msg)
+	if (!matcher.matches())
+		return
+	def count = Integer.parseInt(matcher.group(1))
+	total += count
+	
+    def date = asctimeFormat.parse(elts[0] + ' ' + elts[1])
+	if (firstDate == null)
+		firstDate = date
+	lastDate = date
+}
+def overSeconds = (lastDate.getTime() - firstDate.getTime()) / 1000
+println "total: ${total} in ${overSeconds} seconds"


Property changes on: dumbhippo/trunk/firehose/firehose/logstats.groovy
___________________________________________________________________
Name: svn:executable
   + *



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