sbsv2/raptor/bin/timelines.py
author timothy.murphy@nokia.com
Sun, 06 Dec 2009 08:59:11 +0000
branchwip
changeset 85 d82b03c7df17
child 100 55250667c668
permissions -rw-r--r--
A build log visualisation tool
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
     1
#
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
     2
# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
     3
# All rights reserved.
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
     4
# This component and the accompanying materials are made available
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
     6
# which accompanies this distribution, and is available
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
     8
#
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
     9
# Initial Contributors:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    11
#
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    12
# Contributors:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    13
#
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    14
# Description: 
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    15
# 
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    16
# Raptor log visualisation program. Takes a raptor log as standard input
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    17
# and displays timelines that represent build progress and 
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    18
# how much actual parallelism there is in the build.
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    19
# This program requires the pygame and PyOpenGL modules.
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    20
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    21
from OpenGL.GL import *
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    22
from OpenGL.GLU import *
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    23
import pygame
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    24
from pygame.locals import *
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    25
import time
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    26
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    27
class Timeline(object):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    28
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    29
	globalmax = 2.0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    30
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    31
	def __init__(self,ylevel):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    32
		self.maxtime = 0.0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    33
		self.recipes = []
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    34
		self.ylevel = ylevel
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    35
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    36
	def append(self, recipe):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    37
		if recipe.starttime + recipe.duration > self.maxtime:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    38
			self.maxtime = recipe.starttime + recipe.duration
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    39
			if self.maxtime > Timeline.globalmax:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    40
				Timeline.globalmax = self.maxtime 
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    41
			#print "maxtime:",self.maxtime
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    42
			#print "xscale:",self.xscale
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    43
		else:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    44
			pass
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    45
			#print "bob",self.maxtime
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    46
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    47
		self.recipes.append(recipe)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    48
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    49
	def draw(self):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    50
		glLoadIdentity()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    51
		self.xscale = 4.0 / Timeline.globalmax
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    52
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    53
    		glTranslatef(-2.0, -1.5, -6.0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    54
		count = 0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    55
		for r in self.recipes:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    56
			if count % 2 == 0:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    57
				coloff=0.8
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    58
			else:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    59
				coloff = 1.0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    60
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    61
			count += 1
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    62
			r.draw(self.xscale, self.ylevel, coloff)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    63
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    64
class Recipe(object):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    65
	STAT_OK = 0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    66
	colours = {
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    67
		'compile': (0.5,0.5,1.0),
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    68
		'compile2object': (0.5,0.5,1.0),
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    69
		'win32compile2object': (0.5,0.5,1.0),
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    70
		'tools2linkexe': (0.5,1.0,0.5),
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    71
		'link': (0.5,1.0,0.5),
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    72
		'win32stageonelink': (0.5,1.0,0.5),
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    73
		'tools2lib': (0.5,1.0,1.0),
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    74
		'win32stagetwolink': (1.0,0.1,1.0),
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    75
		'postlink': (1.0,0.5,1.0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    76
		}
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    77
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    78
	def __init__(self, starttime, duration, name, status):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    79
		self.starttime = starttime
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    80
		self.duration = duration
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    81
		self.status = status
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    82
		self.colour = (1.0, 1.0, 1.0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    83
		if name in Recipe.colours:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    84
			self.colour = Recipe.colours[name]
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    85
		else:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    86
			self.colour = (1.0,1.0,1.0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    87
		self.name = name 
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    88
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    89
	def draw(self, scale, ylevel, coloff):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    90
		if self.status == Recipe.STAT_OK:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    91
			glColor4f(self.colour[0]*coloff, self.colour[1]*coloff, self.colour[2]*coloff,0.2)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    92
		else:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    93
			glColor4f(1.0*coloff, 0.6*coloff, 0.6*coloff,0.2)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    94
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    95
		print "ylevel: %s %f " % (self.name, ylevel)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    96
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    97
		x = self.starttime * scale
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    98
		y = ylevel
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    99
		x2 = x + self.duration * scale
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   100
		y2 = ylevel + 0.2
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   101
		glBegin(GL_QUADS)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   102
		glVertex3f(x, y, 0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   103
		glVertex3f(x, y2, 0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   104
		glVertex3f(x2, y2, 0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   105
		glVertex3f(x2, y, 0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   106
		glEnd()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   107
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   108
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   109
def resize((width, height)):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   110
	if height==0:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   111
		height=1
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   112
	glViewport(0, 0, width, height)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   113
	glMatrixMode(GL_PROJECTION)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   114
	glLoadIdentity()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   115
	gluPerspective(45, 1.0*width/height, 0.1, 100.0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   116
	glMatrixMode(GL_MODELVIEW)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   117
	glLoadIdentity()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   118
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   119
def init():
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   120
	glShadeModel(GL_SMOOTH)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   121
	glClearColor(0.0, 0.0, 0.0, 0.0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   122
	glClearDepth(1.0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   123
	glEnable(GL_DEPTH_TEST)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   124
	glDepthFunc(GL_LEQUAL)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   125
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   126
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   127
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   128
import sys
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   129
import re
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   130
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   131
def main():
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   132
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   133
	video_flags = OPENGL|DOUBLEBUF
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   134
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   135
	pygame.init()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   136
	pygame.display.set_mode((800,600), video_flags)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   137
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   138
	resize((800,600))
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   139
	init()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   140
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   141
	frames = 0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   142
	ticks = pygame.time.get_ticks()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   143
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   144
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   145
	lines = 4
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   146
	timelines = []
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   147
	ylevel = 0.0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   148
	for i in xrange(0,4):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   149
		ylevel += 0.6 
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   150
		timelines.append(Timeline(ylevel))
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   151
		print "TIMELINE", ylevel
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   152
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   153
	f = sys.stdin
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   154
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   155
	recipe_re = re.compile(".*<recipe name='([^']+)'.*")
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   156
	time_re = re.compile(".*<time start='([0-9]+\.[0-9]+)' *elapsed='([0-9]+\.[0-9]+)'.*")
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   157
	status_re = re.compile(".*<status exit='([^']*)'.*")
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   158
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   159
	alternating = 0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   160
	start_time = 0.0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   161
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   162
	
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   163
	for l in f.xreadlines():
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   164
		l2 = l.rstrip("\n")
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   165
		rm = recipe_re.match(l2)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   166
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   167
		if rm is not None:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   168
			rname = rm.groups()[0]
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   169
			continue
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   170
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   171
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   172
		tm = time_re.match(l2)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   173
		if tm is not None:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   174
			s = float(tm.groups()[0])
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   175
			elapsed = float(tm.groups()[1])
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   176
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   177
			if start_time == 0.0:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   178
				start_time = s
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   179
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   180
			s -= start_time
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   181
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   182
			#print s,elapsed
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   183
			continue
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   184
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   185
		sm = status_re.match(l2)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   186
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   187
		if sm is None:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   188
			continue
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   189
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   190
		if sm.groups()[0] == 'ok':
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   191
			status = 0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   192
		else:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   193
			status = int(sm.groups()[0])
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   194
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   195
		olddiff = 999999999.0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   196
		tnum = 0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   197
		for t in timelines:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   198
			newdiff = s - t.maxtime
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   199
			if newdiff < 0.0:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   200
				continue
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   201
			#print "diff: %f" % (newdiff)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   202
			if olddiff > newdiff:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   203
				dest_timeline = t
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   204
				olddiff = newdiff
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   205
				#print "timeline selected: %d diff: %f" % (tnum,newdiff)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   206
			tnum += 1
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   207
		#print "----------"
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   208
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   209
		dest_timeline.append(Recipe(s, elapsed, rname, status))
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   210
		event = pygame.event.poll()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   211
		if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   212
			break
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   213
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   214
		glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   215
		for t in timelines:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   216
			t.draw()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   217
		pygame.display.flip()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   218
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   219
		frames = frames+1
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   220
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   221
	print "fps:  %de" % ((frames*1000)/(pygame.time.get_ticks()-ticks))
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   222
	event = pygame.event.wait()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   223
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   224
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   225
if __name__ == '__main__': main()