diff scripts/log.rb @ 40:20616fe4d28a

add log viewer
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Tue, 31 Jan 2012 15:19:35 +0900
parents
children 92aeb6e34683
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/log.rb	Tue Jan 31 15:19:35 2012 +0900
@@ -0,0 +1,32 @@
+log_file = ARGV[0]
+puts "digraph test {"
+open(log_file) { |io|
+  while line = io.gets
+    data = line.split("\t")
+    header = data[0].split(" ")
+    if header[2] != "DEBUG" then
+      next
+    end
+    if header[3] == "alice.codesegment.CodeSegmentManager" then
+      next
+    end
+    if header[5] == "TAKE" || header[5] == "PEEK" then
+      puts '"' + data[4].split(" ")[0].split("=")[1].split(".")[-1] + '"' + ' [shape="box", fontname="Ricty"]'
+      print '"' + header[3] + "." + data[1] + '"' + ' [shape="box", fontname="Ricty"]'
+      print '"' + header[3] + "." + data[1] + '"'
+      print " -> "
+      print '"' + data[4].split(" ")[0].split("=")[1].split(".")[-1] + '"'
+
+      puts ' [label="' + header[5] + '", fontname="Ricty"]'
+    end
+    if header[5] == "PUT" || header[5] == "UPDATE" then
+      puts '"' + data[4].split(" ")[0].split("=")[1].split(".")[-1] + '"' + ' [shape="box", fontname="Ricty"]'
+      puts '"' + header[3] + "." + data[1] + '"' + ' [shape="box", fontname="Ricty"]'
+      print '"' + data[4].split(" ")[0].split("=")[1].split(".")[-1] + '"'
+      print " -> "
+      print '"' + header[3] + "." + data[1] + '"'
+      puts ' [label="' + header[5] + '", fontname="Ricty"]'
+    end
+  end
+}
+puts "}"