sbsv2/raptor/bin/timelines.py
author Stefan Karlsson <stefan.karlsson@nokia.com>
Mon, 15 Mar 2010 11:38:03 +0000
branchwip
changeset 367 28419e56ee8a
parent 100 55250667c668
permissions -rwxr-xr-x
Add support for MMP keyword EPOCNESTEDEXCEPTIONS
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):
100
55250667c668 apply review comments:
timothy.murphy@nokia.com
parents: 85
diff changeset
    28
	"""A bar representing a number of recipes which were executed in 
55250667c668 apply review comments:
timothy.murphy@nokia.com
parents: 85
diff changeset
    29
	   time sequence.  There is no guarantee about what host but in 
55250667c668 apply review comments:
timothy.murphy@nokia.com
parents: 85
diff changeset
    30
	   theory they could have been executed on the same host."""
85
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    31
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    32
	globalmax = 2.0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    33
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    34
	def __init__(self,ylevel):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    35
		self.maxtime = 0.0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    36
		self.recipes = []
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    37
		self.ylevel = ylevel
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    38
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    39
	def append(self, recipe):
100
55250667c668 apply review comments:
timothy.murphy@nokia.com
parents: 85
diff changeset
    40
		"" add this recipe to this timeline if it happens after the latest recipe already in the timeline ""
85
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    41
		if recipe.starttime + recipe.duration > self.maxtime:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    42
			self.maxtime = recipe.starttime + recipe.duration
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    43
			if self.maxtime > Timeline.globalmax:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    44
				Timeline.globalmax = self.maxtime 
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    45
		else:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    46
			pass
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    47
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    48
		self.recipes.append(recipe)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    49
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    50
	def draw(self):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    51
		glLoadIdentity()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    52
		self.xscale = 4.0 / Timeline.globalmax
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    53
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    54
    		glTranslatef(-2.0, -1.5, -6.0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    55
		count = 0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    56
		for r in self.recipes:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    57
			if count % 2 == 0:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    58
				coloff=0.8
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    59
			else:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    60
				coloff = 1.0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    61
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    62
			count += 1
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    63
			r.draw(self.xscale, self.ylevel, coloff)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    64
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    65
class Recipe(object):
100
55250667c668 apply review comments:
timothy.murphy@nokia.com
parents: 85
diff changeset
    66
	"""Represents a task completed in a raptor build. 
55250667c668 apply review comments:
timothy.murphy@nokia.com
parents: 85
diff changeset
    67
	   Drawn as a colour-coded bar with different 
55250667c668 apply review comments:
timothy.murphy@nokia.com
parents: 85
diff changeset
    68
	   colours for the various recipe types."""
85
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    69
	STAT_OK = 0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    70
	colours = {
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    71
		'compile': (0.5,0.5,1.0),
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    72
		'compile2object': (0.5,0.5,1.0),
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    73
		'win32compile2object': (0.5,0.5,1.0),
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    74
		'tools2linkexe': (0.5,1.0,0.5),
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    75
		'link': (0.5,1.0,0.5),
100
55250667c668 apply review comments:
timothy.murphy@nokia.com
parents: 85
diff changeset
    76
		'linkandpostlink': (0.5,1.0,0.5),
85
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    77
		'win32stageonelink': (0.5,1.0,0.5),
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    78
		'tools2lib': (0.5,1.0,1.0),
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    79
		'win32stagetwolink': (1.0,0.1,1.0),
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    80
		'postlink': (1.0,0.5,1.0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    81
		}
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    82
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    83
	def __init__(self, starttime, duration, name, status):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    84
		self.starttime = starttime
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    85
		self.duration = duration
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    86
		self.status = status
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    87
		self.colour = (1.0, 1.0, 1.0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    88
		if name in Recipe.colours:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    89
			self.colour = Recipe.colours[name]
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    90
		else:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    91
			self.colour = (1.0,1.0,1.0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    92
		self.name = name 
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    93
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    94
	def draw(self, scale, ylevel, coloff):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    95
		if self.status == Recipe.STAT_OK:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    96
			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
    97
		else:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
    98
			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
    99
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   100
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   101
		x = self.starttime * scale
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   102
		y = ylevel
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   103
		x2 = x + self.duration * scale
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   104
		y2 = ylevel + 0.2
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   105
		glBegin(GL_QUADS)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   106
		glVertex3f(x, y, 0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   107
		glVertex3f(x, y2, 0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   108
		glVertex3f(x2, y2, 0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   109
		glVertex3f(x2, y, 0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   110
		glEnd()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   111
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   112
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   113
def resize((width, height)):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   114
	if height==0:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   115
		height=1
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   116
	glViewport(0, 0, width, height)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   117
	glMatrixMode(GL_PROJECTION)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   118
	glLoadIdentity()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   119
	gluPerspective(45, 1.0*width/height, 0.1, 100.0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   120
	glMatrixMode(GL_MODELVIEW)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   121
	glLoadIdentity()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   122
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   123
def init():
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   124
	glShadeModel(GL_SMOOTH)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   125
	glClearColor(0.0, 0.0, 0.0, 0.0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   126
	glClearDepth(1.0)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   127
	glEnable(GL_DEPTH_TEST)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   128
	glDepthFunc(GL_LEQUAL)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   129
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)
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
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   132
import sys
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   133
import re
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
def main():
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   136
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   137
	video_flags = OPENGL|DOUBLEBUF
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   138
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   139
	pygame.init()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   140
	pygame.display.set_mode((800,600), video_flags)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   141
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   142
	resize((800,600))
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   143
	init()
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
	frames = 0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   146
	ticks = pygame.time.get_ticks()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   147
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   148
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   149
	lines = 4
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   150
	timelines = []
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   151
	ylevel = 0.0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   152
	for i in xrange(0,4):
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   153
		ylevel += 0.6 
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   154
		timelines.append(Timeline(ylevel))
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   155
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   156
	f = sys.stdin
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   157
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   158
	recipe_re = re.compile(".*<recipe name='([^']+)'.*")
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   159
	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
   160
	status_re = re.compile(".*<status exit='([^']*)'.*")
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
	alternating = 0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   163
	start_time = 0.0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   164
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   165
	
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   166
	for l in f.xreadlines():
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   167
		l2 = l.rstrip("\n")
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   168
		rm = recipe_re.match(l2)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   169
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   170
		if rm is not None:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   171
			rname = rm.groups()[0]
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   172
			continue
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   173
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   174
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   175
		tm = time_re.match(l2)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   176
		if tm is not None:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   177
			s = float(tm.groups()[0])
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   178
			elapsed = float(tm.groups()[1])
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
			if start_time == 0.0:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   181
				start_time = s
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   182
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   183
			s -= start_time
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
			continue
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
		sm = status_re.match(l2)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   188
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   189
		if sm is None:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   190
			continue
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   191
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   192
		if sm.groups()[0] == 'ok':
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   193
			status = 0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   194
		else:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   195
			status = int(sm.groups()[0])
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   196
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   197
		olddiff = 999999999.0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   198
		tnum = 0
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   199
		for t in timelines:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   200
			newdiff = s - t.maxtime
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   201
			if newdiff < 0.0:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   202
				continue
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   203
			if olddiff > newdiff:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   204
				dest_timeline = t
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   205
				olddiff = 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
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   208
		dest_timeline.append(Recipe(s, elapsed, rname, status))
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   209
		event = pygame.event.poll()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   210
		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
   211
			break
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   212
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   213
		glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   214
		for t in timelines:
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   215
			t.draw()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   216
		pygame.display.flip()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   217
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   218
		frames = frames+1
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   219
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   220
	print "fps:  %de" % ((frames*1000)/(pygame.time.get_ticks()-ticks))
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   221
	event = pygame.event.wait()
d82b03c7df17 A build log visualisation tool
timothy.murphy@nokia.com
parents:
diff changeset
   222
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
if __name__ == '__main__': main()