# HG changeset patch # User timothy.murphy@nokia.com # Date 1260095935 0 # Node ID 01cb4707f979f5b5b5e88b07c94b6f146c24c0a5 # Parent 32f524d09c94e72ff0c638b94ab61a4a5a20e2f0 Added a script for finding out how time each class of recipes took in the build diff -r 32f524d09c94 -r 01cb4707f979 sbsv2/raptor/bin/recipestats.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sbsv2/raptor/bin/recipestats.py Sun Dec 06 10:38:55 2009 +0000 @@ -0,0 +1,111 @@ +# +# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# display summary information about recipes from raptor logs +# e.g. total times and so on. + +import time + +class RecipeStats(object): + STAT_OK = 0 + + + def __init__(self): + self.stats = {} + self.failcount = 0 + self.failtime = 0.0 + self.failtypes = {} + self.retryfails = 0 + + def add(self, starttime, duration, name, status): + if status != RecipeStats.STAT_OK: + self.failcount += 1 + if name in self.failtypes: + self.failtypes[name] += 1 + else: + self.failtypes[name] = 1 + + if status == 128: + self.retryfails += 1 + return + + if name in self.stats: + (count, time) = self.stats[name] + self.stats[name] = (count + 1, time + duration) + else: + self.stats[name] = (1,duration) + + def recipe_csv(self): + s = "# name, time, count\n" + for (name,(count,time)) in self.stats.iteritems(): + s += '"%s",%s,%d\n' % (name, str(time), count) + return s + + + +import sys +import re + +def main(): + + f = sys.stdin + st = RecipeStats() + + recipe_re = re.compile(".*