[haizea-commit] r440 - in trunk: bin src/haizea/analysis src/haizea/cli src/haizea/common src/haizea/resourcemanager

haizea-commit at mailman.cs.uchicago.edu haizea-commit at mailman.cs.uchicago.edu
Wed Jul 16 12:21:36 CDT 2008


Author: borja
Date: 2008-07-16 12:21:36 -0500 (Wed, 16 Jul 2008)
New Revision: 440

Added:
   trunk/bin/haizea-convert-data
Removed:
   trunk/src/haizea/analysis/graph.py
   trunk/src/haizea/analysis/main.py
   trunk/src/haizea/analysis/misc.py
   trunk/src/haizea/analysis/report.css
   trunk/src/haizea/analysis/report.py
   trunk/src/haizea/analysis/traces.py
Modified:
   trunk/src/haizea/cli/commands.py
   trunk/src/haizea/common/constants.py
   trunk/src/haizea/common/utils.py
   trunk/src/haizea/resourcemanager/scheduler.py
   trunk/src/haizea/resourcemanager/stats.py
Log:
- Added haizea-convert-data command to convert Haizea's data file to more useable formats (barebones for now)
- Fix: actual starting and end times were not being saved (which did not allow waiting time and slowdown to be computed)
- Removed painfully old analysis modules.

Added: trunk/bin/haizea-convert-data
===================================================================
--- trunk/bin/haizea-convert-data	                        (rev 0)
+++ trunk/bin/haizea-convert-data	2008-07-16 17:21:36 UTC (rev 440)
@@ -0,0 +1,6 @@
+#!/usr/bin/python
+
+from haizea.cli import commands
+import sys
+	
+commands.haizea_convert_data(sys.argv)
\ No newline at end of file


Property changes on: trunk/bin/haizea-convert-data
___________________________________________________________________
Name: svn:executable
   + *

Deleted: trunk/src/haizea/analysis/graph.py
===================================================================
--- trunk/src/haizea/analysis/graph.py	2008-07-16 17:17:54 UTC (rev 439)
+++ trunk/src/haizea/analysis/graph.py	2008-07-16 17:21:36 UTC (rev 440)
@@ -1,246 +0,0 @@
-# -------------------------------------------------------------------------- #
-# Copyright 2006-2008, University of Chicago                                 #
-# Copyright 2008, Distributed Systems Architecture Group, Universidad        #
-# Complutense de Madrid (dsa-research.org)                                   #
-#                                                                            #
-# Licensed under the Apache License, Version 2.0 (the "License"); you may    #
-# not use this file except in compliance with the License. You may obtain    #
-# a copy of the License at                                                   #
-#                                                                            #
-# http://www.apache.org/licenses/LICENSE-2.0                                 #
-#                                                                            #
-# Unless required by applicable law or agreed to in writing, software        #
-# distributed under the License is distributed on an "AS IS" BASIS,          #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
-# See the License for the specific language governing permissions and        #
-# limitations under the License.                                             #
-# -------------------------------------------------------------------------- #
-
-import pylab
-from matplotlib.ticker import FormatStrFormatter
-import matplotlib.mlab as mlab
-import Image
-
-class Graph(object):
-    def __init__(self, xlabel="", ylabel=""):
-        self.xlabel=xlabel
-        self.ylabel=ylabel
-        self.colors = ['blue', 'green', 'red','cyan', 'magenta','yellow', 
-          'indigo', 'gold', 'firebrick', 'indianred', 'darkolivegreen', 
-          'darkseagreen', 'mediumvioletred', 'mediumorchid', 'chartreuse', 
-          'mediumslateblue', 'springgreen', 'crimson', 'lightsalmon', 
-          'brown', 'turquoise', 'olivedrab', 'skyblue', 
-          'darkturquoise', 'goldenrod', 'darkgreen', 'darkviolet', 
-          'darkgray', 'lightpink', 'teal', 'darkmagenta', 
-          'lightgoldenrodyellow', 'lavender', 'yellowgreen', 'thistle', 
-          'violet', 'navy', 'orchid', 'blue', 'ghostwhite', 'honeydew', 
-          'cornflowerblue', 'darkblue', 'darkkhaki', 'mediumpurple', 
-          'cornsilk', 'red', 'bisque', 'slategray', 'darkcyan', 'khaki', 
-          'wheat', 'deepskyblue', 'darkred', 'steelblue', 'aliceblue']
-    
-    def plot(self):
-        pylab.xlabel(self.xlabel)
-        pylab.ylabel(self.ylabel)
-    
-    def show(self):
-        pass
-    
-class LineGraph(Graph):
-    def __init__(self, data, xlabel="", ylabel="", legends=[]):
-        Graph.__init__(self,xlabel,ylabel)
-        self.data = data
-        self.legends = legends
-
-    def plotToFile(self, graphfile, thumbfile=None):
-        print "Generating graph %s" % graphfile
-        Graph.plot(self)        
-        largestY = None
-        for dataset in self.data:
-            x = [p[0] for p in dataset]
-            y = [p[1] for p in dataset]
-            if len(y) == 0:
-                largestY = 0
-            else:
-                largestY = max(largestY,max(y))
-            pylab.plot(x,y)
-        
-
-        pylab.ylim(0, largestY * 1.05)            
-        pylab.gca().xaxis.set_major_formatter(FormatStrFormatter('%d'))
-        pylab.legend(self.legends, loc='lower right')
-        
-        pylab.savefig(graphfile)
-        pylab.gcf().clear()
-        
-        if thumbfile != None:
-            print "Generating thumbnail %s" % thumbfile
-            im = Image.open(graphfile)
-            im.thumbnail((640, 480), Image.ANTIALIAS)
-            im.save(thumbfile)
-    
-    def show(self):
-        pylab.show()
-        
-class StepGraph(Graph):
-    def __init__(self, data, xlabel="", ylabel="", legends=[]):
-        Graph.__init__(self,xlabel,ylabel)
-        self.data = data
-        self.legends = legends
-
-    def plotToFile(self, graphfile, thumbfile=None):
-        print "Generating graph %s" % graphfile
-        Graph.plot(self)
-        largestY = None
-        for dataset in self.data:
-            x = [p[0] for p in dataset]
-            y = [p[1] for p in dataset]
-            if len(y) == 0:
-                largestY = 0
-            else:
-                largestY = max(largestY,max(y))
-            pylab.plot(x,y, linestyle="steps")
-        
-
-        pylab.ylim(0, largestY * 1.05)
-        pylab.gca().xaxis.set_major_formatter(FormatStrFormatter('%d'))
-        pylab.legend(self.legends, loc='lower right')
-        
-        pylab.savefig(graphfile)
-        pylab.gcf().clear()
-        
-        if thumbfile != None:
-            print "Generating thumbnail %s" % thumbfile
-            im = Image.open(graphfile)
-            im.thumbnail((640, 480), Image.ANTIALIAS)
-            im.save(thumbfile)
-    
-    def show(self):
-        pylab.show()
-        
-        
-class PointAndLineGraph(Graph):
-    def __init__(self, data, xlabel="", ylabel="", legends=[]):
-        Graph.__init__(self,xlabel,ylabel)
-        self.data = data
-        self.legends = legends
-
-    def plotToFile(self, graphfile, thumbfile=None):
-        print "Generating graph %s" % graphfile
-        Graph.plot(self)        
-        largestY = None
-        colors = iter(self.colors)
-        for dataset in self.data:
-            x = [p[0] for p in dataset]
-            y1 = [p[1] for p in dataset]
-            y2 = [p[2] for p in dataset]
-            largestY = max(largestY,max(y1),max(y2))
-            color = colors.next()
-            pylab.plot(x,y1, 'o', color=color)
-            pylab.plot(x,y2, color=color)
-        
-        pylab.ylim(0, largestY * 1.05)            
-        pylab.gca().xaxis.set_major_formatter(FormatStrFormatter('%d'))
-        pylab.legend(self.legends, loc='lower right')
-        
-        pylab.savefig(graphfile)
-        pylab.gcf().clear()
-        
-        if thumbfile != None:
-            print "Generating thumbnail %s" % thumbfile
-            im = Image.open(graphfile)
-            im.thumbnail((640, 480), Image.ANTIALIAS)
-            im.save(thumbfile)
-    
-    def show(self):
-        pylab.show()
-        
-class CumulativeGraph(Graph):
-    def __init__(self, data, xlabel="", ylabel="", legends=[]):
-        Graph.__init__(self,"Percentile",ylabel)
-        self.data = data
-        self.legends = legends
-
-    def plotToFile(self, graphfile, thumbfile=None):
-        print "Generating graph %s" % graphfile
-        Graph.plot(self)
-        largestY = None
-        for dataset in self.data:
-            values = [p[1] for p in dataset]
-            n, bins = mlab.hist(values, len(values))
-            xaccum = [0]
-            for m in n:
-                xaccum.append(xaccum[-1] + m)
-            xaccum = [ (float(x) / len(xaccum)) * 100 for x in xaccum]
-            y = [0] + list(bins)
-            largestY = max(largestY,max(y))
-            pylab.plot(xaccum,y)
-        
-
-        pylab.xlim(0, 105)
-        pylab.ylim(0, largestY * 1.05)
-        pylab.gca().yaxis.set_major_formatter(FormatStrFormatter('%d'))
-        pylab.gca().xaxis.set_major_formatter(FormatStrFormatter('%d'))
-        pylab.legend(self.legends, loc='best')
-        
-        pylab.savefig(graphfile)
-        pylab.gcf().clear()
-        
-        if thumbfile != None:
-            print "Generating thumbnail %s" % thumbfile
-            im = Image.open(graphfile)
-            im.thumbnail((640, 480), Image.ANTIALIAS)
-            im.save(thumbfile)
-    
-    def show(self):
-        pylab.show()
-
-        
-class ScatterGraph(Graph):
-    def __init__(self, data, xlabel="", ylabel="", legends=None, limx=None, limy=None):
-        Graph.__init__(self,xlabel,ylabel)
-        self.data = data
-        self.legends = legends
-        self.limx = limx
-        self.limy = limy
-        if self.limx==None:
-            smallestX = min([min([p[0] for p in l]) for l in self.data])
-            largestX = max([max([p[0] for p in l]) for l in self.data])
-            self.limx=(smallestX,largestX)
-        if limy==None:
-            smallestY = min([min([p[1] for p in l]) for l in self.data])
-            largestY = max([max([p[1] for p in l]) for l in self.data])
-            self.limy=(smallestY,largestY)
-
-    def plotToFile(self, graphfile, thumbfile=None):
-        print "Generating graph %s" % graphfile
-        Graph.plot(self)
-        
-        colors = iter(self.colors)
-        legendpolys = []
-        for dataset in self.data:
-            pylab.gca().set_xscale('log')
-            x = [p[0] for p in dataset]
-            y = [p[1] for p in dataset]
-            size = [p[2] for p in dataset]
-            color=colors.next()
-            poly = pylab.scatter(x,y,s=size, c=color, linewidths=(0.4,), alpha=0.75)
-            # kluge suggested on matplotlib mailing list, since scatter does not
-            # support having legends
-            legendpolys.append(pylab.Rectangle( (0,0), 1,1, facecolor=color))
-
-        pylab.xlim(self.limx[0] - 5, self.limx[1] + 5)
-        pylab.ylim(self.limy[0] - 5, self.limy[1] + 5)
-        if self.legends != None:
-            pylab.legend(legendpolys, self.legends, loc='lower right')
-        
-        pylab.savefig(graphfile)
-        pylab.clf()
-        
-        if thumbfile != None:
-            print "Generating thumbnail %s" % thumbfile
-            im = Image.open(graphfile)
-            im.thumbnail((640, 480), Image.ANTIALIAS)
-            im.save(thumbfile)
-    
-    def show(self):
-        pylab.show()
\ No newline at end of file

Deleted: trunk/src/haizea/analysis/main.py
===================================================================
--- trunk/src/haizea/analysis/main.py	2008-07-16 17:17:54 UTC (rev 439)
+++ trunk/src/haizea/analysis/main.py	2008-07-16 17:21:36 UTC (rev 440)
@@ -1,35 +0,0 @@
-# -------------------------------------------------------------------------- #
-# Copyright 2006-2008, University of Chicago                                 #
-# Copyright 2008, Distributed Systems Architecture Group, Universidad        #
-# Complutense de Madrid (dsa-research.org)                                   #
-#                                                                            #
-# Licensed under the Apache License, Version 2.0 (the "License"); you may    #
-# not use this file except in compliance with the License. You may obtain    #
-# a copy of the License at                                                   #
-#                                                                            #
-# http://www.apache.org/licenses/LICENSE-2.0                                 #
-#                                                                            #
-# Unless required by applicable law or agreed to in writing, software        #
-# distributed under the License is distributed on an "AS IS" BASIS,          #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
-# See the License for the specific language governing permissions and        #
-# limitations under the License.                                             #
-# -------------------------------------------------------------------------- #
-
-from haizea.common.config import RMMultiConfig
-from haizea.analysis.report import Report
-from haizea.common.utils import genDataDirName, genTraceInjName
-
-def report(multiconfig, statsdir, htmlonly=False):
-    r = Report(multiconfig, statsdir, htmlonly)
-    r.generate()
-
-
-if __name__ == "__main__":
-    multiconfigfile="../configfiles/test_multiple.conf"
-    multiconfig = MultiConfig(multiconfigfile)
-    tracefile="../traces/examples/test_besteffort.csv"
-    injectedfile=None
-    statsdir="/home/borja/docs/uchicago/research/ipdps/results"
-    reportdir="/home/borja/docs/uchicago/research/ipdps/results/report"
-    report(multiconfig, tracefile, injectedfile, statsdir, reportdir)
\ No newline at end of file

Deleted: trunk/src/haizea/analysis/misc.py
===================================================================
--- trunk/src/haizea/analysis/misc.py	2008-07-16 17:17:54 UTC (rev 439)
+++ trunk/src/haizea/analysis/misc.py	2008-07-16 17:21:36 UTC (rev 440)
@@ -1,98 +0,0 @@
-# -------------------------------------------------------------------------- #
-# Copyright 2006-2008, University of Chicago                                 #
-# Copyright 2008, Distributed Systems Architecture Group, Universidad        #
-# Complutense de Madrid (dsa-research.org)                                   #
-#                                                                            #
-# Licensed under the Apache License, Version 2.0 (the "License"); you may    #
-# not use this file except in compliance with the License. You may obtain    #
-# a copy of the License at                                                   #
-#                                                                            #
-# http://www.apache.org/licenses/LICENSE-2.0                                 #
-#                                                                            #
-# Unless required by applicable law or agreed to in writing, software        #
-# distributed under the License is distributed on an "AS IS" BASIS,          #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
-# See the License for the specific language governing permissions and        #
-# limitations under the License.                                             #
-# -------------------------------------------------------------------------- #
-
-import math
-import os
-from haizea.common.utils import genDataDirName, genTraceInjName
-from pickle import Unpickler
-import haizea.common.constants as constants
-
-def percentile(N, percent, key=lambda x:x):
-    """
-    Find the percentile of a list of values.
-
-    @parameter N - is a list of values. Note N MUST BE already sorted.
-    @parameter percent - a float value from 0.0 to 1.0.
-    @parameter key - optional key function to compute value from each element of N.
-
-    @return - the percentile of the values
-    """
-    if not N:
-        return None
-    k = (len(N)-1) * percent
-    f = math.floor(k)
-    c = math.ceil(k)
-    if f == c:
-        return key(N[int(k)])
-    d0 = key(N[int(f)]) * (c-k)
-    d1 = key(N[int(c)]) * (k-f)
-    return d0+d1
-
-
-# TODO integrate this in report.py
-
-
-def genpercentiles(config, statsdir):
-    confs = config.getConfigsToReport()
-
-    profiles = list(set([c.getProfile() for c in confs]))
-    profiles.sort()
-
-    tracefiles = set([c.getTracefile() for c in confs])
-    injectfiles = set([c.getInjectfile() for c in confs])
-    traces = []
-    for t in tracefiles:
-        for i in injectfiles:
-            traces.append((t,i,genTraceInjName(t,i)))        
-
-    outdir = config.getReportDir()
-
-    datafiles = [ constants.EXECWAITFILE ]
-    percentiles = [0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.30, 0.35,
-                   0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75,
-                   0.8, 0.85, 0.9, 0.95, 0.99, 1.0]
-        
-    if not os.path.exists(outdir):
-        os.makedirs(outdir)
-        
-    for datafile in datafiles:
-        for p in profiles:
-            print "Generating %s percentiles for profile %s" % (datafile,p)
-            csv = open(outdir + "%s_%s_percentiles.csv" % (p,datafile), "w")
-            headers = ["profiles"] + [`pct` for pct in percentiles]
-            csv.write(",".join(headers) + "\n")
-            tracesdirs = [(t[2], statsdir + "/" + genDataDirName(p,t[0],t[1])) for t in traces]
-            tracesdirs = dict([(t,d) for t,d in tracesdirs if os.path.exists(d)])
-            if len(tracesdirs) > 0:
-                keys = tracesdirs.keys()
-                keys.sort()
-                for k in keys:
-                    dir = tracesdirs[k]
-                    file = open (dir + "/" + datafile, "r")
-                    u = Unpickler(file)
-                    data = u.load()
-                    file.close()
-                    sorted = [v[2] for v in data]
-                    sorted.sort()
-                    
-                    line = [k]
-                    for pct in percentiles:
-                        line.append("%.3f" % percentile(sorted,pct))
-                    csv.write(",".join(line) + "\n")
-            csv.close()
-                
\ No newline at end of file

Deleted: trunk/src/haizea/analysis/report.css
===================================================================
--- trunk/src/haizea/analysis/report.css	2008-07-16 17:17:54 UTC (rev 439)
+++ trunk/src/haizea/analysis/report.css	2008-07-16 17:21:36 UTC (rev 440)
@@ -1,195 +0,0 @@
-html
-{
-	font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
-	font-size: 10pt;
-}
-
-a  
-{
-	color : #0000AA;
-}	
-
-.bold
-{
-	text-decoration: none;
-	font-weight: bold;
-}
-
-.image
-{
-	text-align: center;
-	border: none;
-}
-
-h1
-{
-	font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
-}
-
-h2
-{
-	font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
-}
-
-hr
-{
-	border : 2px solid #A9A9A9;
-}
-
-table
-{
-	font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
-	font-size: 10pt;
-}
-
-.small
-{
-	font-size: 8pt;
-}
-
-pre.programlisting
-{
-	border : thin solid #696969;
-	background-color : #F0FFFF;
-	padding : 10px 10px 10px 10px;
-	font-family : monospace;
-	font-size: 9pt;
-	margin-left : 50px;
-	margin-right : 50px;
-}
-
-.defaultconfig
-{
-	border : thin solid #CCCCCC;
-	background-color : #F5F5F5;
-	font-size: 10pt;
-	padding : 5px 10px 10px 10px;
-	margin-left : 50px;
-	width: 250px;
-}
-
-.tip
-{
-	border : thin solid #CCCCCC;
-	background-color : #DDDDDD;
-	font-size: 10pt;
-	padding : 10px 10px 10px 10px;
-	margin-left : 75px;
-	margin-right : 75px;
-}
-
-.caution
-{
-	border : thin solid #CCCCCC;
-	background-color : #FFFFCC;
-	font-size: 10pt;
-	padding : 10px 10px 10px 10px;
-	margin-left : 100px;
-	margin-right : 100px;
-}
-
-
-.warning
-{
-	border : thin solid #696969;
-	background-color : #FFFFCC;
-	font-size: 10pt;
-	padding : 10px 10px 10px 10px;
-	margin-left : 100px;
-	margin-right : 100px;
-}
-
-p.todo
-{
-	border : thin solid #696969;
-	background-color : #FFCCCC;
-	font-size: 10pt;
-	padding : 10px 10px 10px 10px;
-	margin-left : 100px;
-	margin-right : 100px;
-}
-
-
-.informalexample p
-{
-	font-size: 8pt;
-	margin-left : 50px;
-	margin-right : 50px;
-}
-
-
-pre.screen
-{
-	padding : 10px 10px 10px 10px;
-	font-family : monospace;
-	font-weight: bold;
-	margin-left : 50px;
-	margin-right : 50px;
-}
-
-
-.toc ul
-{
-	list-style-type : square;
-	font-size : 17px;
-	font-weight : bold;
-	margin-bottom : 10px;
-}
-
-.toc ul a
-{
-	text-decoration: none;
-	color : Navy;
-}
-
-.toc ul a:hover
-{
-	text-decoration: underline;
-	color : Blue;
-}
-
-
-.toc ul ul
-{
-	list-style-type : circle;
-	font-size : 14px;
-	font-weight : normal;
-}
-
-.toc ul ul li
-{
-	margin-bottom: 3px;
-}
-
-.toc ul ul a
-{
-	text-decoration: underline;
-	color : #0000AA;
-}
-
-.center
-{
-	text-align: center;
-}
-
-.informalfigure
-{
-	text-align: center;
-}
-
-.figure
-{
-	text-align: center;
-}
-
-.noborder
-{
-	border: none;
-}
-
-.literal {
-        font-family : monospace;
-        font-weight: bold;
-        color : #006600;
-}
-

Deleted: trunk/src/haizea/analysis/report.py
===================================================================
--- trunk/src/haizea/analysis/report.py	2008-07-16 17:17:54 UTC (rev 439)
+++ trunk/src/haizea/analysis/report.py	2008-07-16 17:21:36 UTC (rev 440)
@@ -1,577 +0,0 @@
-# -------------------------------------------------------------------------- #
-# Copyright 2006-2008, University of Chicago                                 #
-# Copyright 2008, Distributed Systems Architecture Group, Universidad        #
-# Complutense de Madrid (dsa-research.org)                                   #
-#                                                                            #
-# Licensed under the Apache License, Version 2.0 (the "License"); you may    #
-# not use this file except in compliance with the License. You may obtain    #
-# a copy of the License at                                                   #
-#                                                                            #
-# http://www.apache.org/licenses/LICENSE-2.0                                 #
-#                                                                            #
-# Unless required by applicable law or agreed to in writing, software        #
-# distributed under the License is distributed on an "AS IS" BASIS,          #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
-# See the License for the specific language governing permissions and        #
-# limitations under the License.                                             #
-# -------------------------------------------------------------------------- #
-
-import os
-import haizea.common.constants as constants
-import haizea.resourcemanager.datastruct as ds
-import haizea.analysis.graph as graphs
-from haizea.common.config import RMMultiConfig
-from haizea.common.utils import genDataDirName, genTraceInjName, generateCondorHeader, generateCondorQueueEntry
-from cPickle import load
-from mx.DateTime import now
-from operator import itemgetter, or_
-import shutil
-
-leasescache = {}
-
-def getleases(dir):
-    if not leasescache.has_key(dir):
-        print "Loading lease data from %s" % dir
-        file = open (dir + "/" + constants.LEASESFILE, "r")
-        leases = load(file)
-        file.close()
-        leasescache[dir] = leases
-    return leasescache[dir]
-
-class Section(object):
-    def __init__(self, title, datafile, graphtype, tablefinal = None, clip = None, slideshow = False):
-        self.title = title
-        self.filename = datafile
-        self.graphtype = graphtype
-        self.tablefinal = tablefinal
-        self.profiles = None
-        self.final = {}
-        self.data = {}
-        self.clip = clip
-        self.leases = {}
-        self.slideshow = slideshow
-        if clip != None: clipstr = "clip"
-        else: clipstr = "noclip"
-        self.graphfile = self.filename + "_" + str(graphtype) + "_" + clipstr + ".png"
-        self.thumbfile = self.filename + "_" + str(graphtype) + "_" + clipstr + "-thumb.png"
-        
-    def loadData(self, dirs, profilenames=None):
-        if profilenames==None:
-            self.profiles = dirs.keys()
-            self.profiles.sort()
-        else:
-            self.profiles = profilenames
-        for p in self.profiles:
-            dir = dirs[p]
-            
-            f = dir + "/" + self.filename
-            print "Loading %s" % f
-            file = open (f, "r")
-            data = load(file)
-            file.close()
-            
-            leases = getleases(dir)
-
-            if self.clip != None:
-                startclip = self.clip[0]
-                endclip = self.clip[1]
-                
-                if startclip[0] == constants.CLIP_PERCENTSUBMITTED:
-                    percent = startclip[1]
-                    time = leases.getPercentSubmittedTime(percent, leasetype=ds.BestEffortLease)
-                    data = [e for e in data if e[0] >= time]
-                elif startclip[0] == constants.CLIP_TIMESTAMP:
-                    time = startclip[1]
-                    data = [e for e in data if e[0] >= time]
-
-                if endclip[0] == constants.CLIP_PERCENTSUBMITTED:
-                    percent = endclip[1]
-                    time = leases.getPercentSubmittedTime(percent, leasetype=ds.BestEffortLease)
-                    data = [e for e in data if e[0] <= None]
-                elif endclip[0] == constants.CLIP_TIMESTAMP:
-                    time = endclip[1]
-                    data = [e for e in data if e[0] <= time]
-                elif endclip[0] == constants.CLIP_LASTSUBMISSION:
-                    time = leases.getLastSubmissionTime(leasetype=ds.BestEffortLease)
-                    data = [e for e in data if e[0] <= time]
-
-                # Recompute average
-                accum=0
-                count=0
-                newdata = []
-                for v in data:
-                    value = v[2]
-                    accum += value
-                    count += 1
-                    avg = accum/count
-                    newdata.append((v[0], v[1], value, avg))
-                data = newdata
-            self.data[p] = data
-            self.leases[p] = leases
-            
-        # If we are going to produce a table, create it now
-        if self.tablefinal == constants.TABLE_FINALTIME:
-            for p in self.profiles:
-                if len(self.data[p]) > 0:
-                    final = self.data[p][-1][0]
-                    self.final[p] = final
-                else:
-                    self.final[p] = 0
-        if self.tablefinal == constants.TABLE_FINALVALUE:
-            for p in self.profiles:
-                if len(self.data[p]) > 0:
-                    final = self.data[p][-1][2]
-                    self.final[p] = final
-                else:
-                    self.final[p] = 0
-        if self.tablefinal == constants.TABLE_FINALAVG:
-            for p in self.profiles:
-                if len(self.data[p]) > 0:
-                    final = self.data[p][-1][3]
-                    self.final[p] = final
-                else:
-                    self.final[p] = 0
-        
-    def generateGraph(self, outdir, filename=None, titlex=None, titley=None):
-        if self.graphtype in [constants.GRAPH_LINE_VALUE, constants.GRAPH_STEP_VALUE, constants.GRAPH_POINT_VALUE, constants.GRAPH_CUMULATIVE]:
-            values = [[(v[0],v[2]) for v in self.data[p]] for p in self.profiles]
-        elif self.graphtype in [constants.GRAPH_LINE_AVG]:
-            values = [[(v[0],v[3]) for v in self.data[p]] for p in self.profiles]
-        elif self.graphtype in [constants.GRAPH_POINTLINE_VALUEAVG]:
-            values = [[(v[0],v[2],v[3]) for v in self.data[p]] for p in self.profiles]
-        elif self.graphtype in [constants.GRAPH_NUMNODE_LENGTH_CORRELATION_SIZE, constants.GRAPH_NUMNODE_LENGTH_CORRELATION_Y, constants.GRAPH_NUMNODE_REQLENGTH_CORRELATION_SIZE, constants.GRAPH_NUMNODE_REQLENGTH_CORRELATION_Y]:
-            values = []
-            for p in self.profiles:
-                pvalues = []
-                for v in self.data[p]:
-                    lease = self.leases[p].getLease(v[1])
-                    numnodes = lease.numnodes
-                    length = (lease.maxdur - lease.remdur).seconds
-                    reqlength = lease.maxdur
-                    if self.graphtype == constants.GRAPH_NUMNODE_LENGTH_CORRELATION_SIZE:
-                        pvalues.append((length, numnodes, v[2]))
-                    elif self.graphtype == constants.GRAPH_NUMNODE_LENGTH_CORRELATION_Y:
-                        pvalues.append((length, v[2], numnodes))
-                    elif self.graphtype == constants.GRAPH_NUMNODE_REQLENGTH_CORRELATION_SIZE:
-                        pvalues.append((reqlength, numnodes, v[2]))
-                    elif self.graphtype == constants.GRAPH_NUMNODE_REQLENGTH_CORRELATION_Y:
-                        pvalues.append((reqlength, v[2], numnodes))
-                    
-                values.append(pvalues)
-        
-        if sum([len(l) for l in values]) == 0:
-            pass
-            # TODO: print out an error message
-        else:
-            if self.graphtype in [constants.GRAPH_LINE_VALUE, constants.GRAPH_LINE_AVG]:
-                graph = graphs.LineGraph
-                legends = self.profiles
-            elif self.graphtype in [constants.GRAPH_STEP_VALUE]:
-                graph = graphs.StepGraph
-                legends = self.profiles
-            elif self.graphtype in [constants.GRAPH_CUMULATIVE]:
-                graph = graphs.CumulativeGraph
-                legends = self.profiles
-            elif self.graphtype in [constants.GRAPH_POINTLINE_VALUEAVG]:
-                graph = graphs.PointAndLineGraph
-                legends = []
-                for l in self.profiles:
-                    legends.append(l)
-                    legends.append(l + " (avg)")
-            elif self.graphtype in [constants.GRAPH_NUMNODE_LENGTH_CORRELATION_SIZE]:
-                graph = graphs.ScatterGraph
-                legends = self.profiles
-                titlex = "Length of lease (s)"
-                titley = "Number of nodes"
-            elif self.graphtype in [constants.GRAPH_NUMNODE_LENGTH_CORRELATION_Y]:
-                graph = graphs.ScatterGraph
-                legends = self.profiles
-                titlex = "Length of lease (s)"
-                titley = self.title
-            elif self.graphtype in [constants.GRAPH_NUMNODE_REQLENGTH_CORRELATION_SIZE]:
-                graph = graphs.ScatterGraph
-                legends = self.profiles
-                titlex = "Requested length of lease (s)"
-                titley = "Number of nodes"
-            elif self.graphtype in [constants.GRAPH_NUMNODE_REQLENGTH_CORRELATION_Y]:
-                graph = graphs.ScatterGraph
-                legends = self.profiles
-                titlex = "Requested length of lease (s)"
-                titley = self.title
-                
-            if titlex==None:
-                titlex = "Time (s)"
-            if titley==None:
-                titley = self.title
-            
-
-
-            if self.slideshow:
-                smallestX = min([min([p[0] for p in l]) for l in values])
-                largestX = max([max([p[0] for p in l]) for l in values])
-                limx=(smallestX,largestX)
-                smallestY = min([min([p[1] for p in l]) for l in values])
-                largestY = max([max([p[1] for p in l]) for l in values])
-                limy=(smallestY,largestY)
-                for p, v in zip(self.profiles, values):
-                    g = graph([v], titlex, titley, None, limx=limx, limy=limy)
-                    if filename==None:
-                        graphfile = outdir + "/s_" + p + "-" + self.graphfile
-                        thumbfile = outdir + "/s_" + p + "-" + self.thumbfile
-                    else:
-                        graphfile = outdir + "/s_" + p + "-" + filename + ".png"
-                        thumbfile = outdir + "/s_" + p + "-" + filename + "-thumb.png"                    
-                    g.plotToFile(graphfile, thumbfile)
-            else:
-                g = graph(values, titlex, titley, legends)
-                if filename==None:
-                    graphfile = outdir + "/" + self.graphfile
-                    thumbfile = outdir + "/" + self.thumbfile
-                else:
-                    graphfile = outdir + "/" + filename + ".png"
-                    thumbfile = outdir + "/" + filename + "-thumb.png"                    
-                g.plotToFile(graphfile, thumbfile)
-        
-    def generateHTML(self):
-        if self.slideshow:
-            graphfile = "s_" + self.profiles[0] + "-" + self.graphfile
-            thumbfile = "s_" + self.profiles[0] + "-" + self.thumbfile
-            html = ""
-            html += "<div class='image'>"
-            html += "<a href='%s'><img src='%s' id='graph%i' border='0'/></a>" % (graphfile, thumbfile, id(self))
-            html += "<br/><b><span id='graphtitle%i'>%s</span></b><br/>" % (id(self), self.profiles[0])
-            for p in self.profiles:
-                graphfile = "s_" + p + "-" + self.graphfile
-                thumbfile = "s_" + p + "-" + self.thumbfile
-                html+= "[<a href='#' onclick=\"document.getElementById('graph%i').src='%s';" % (id(self), thumbfile)
-                html+= "document.getElementById('graph%i').href='%s';" % (id(self), graphfile)
-                html+= "document.getElementById('graphtitle%i').innerHTML='%s';" % (id(self), p)
-                html+= "return false"
-                html+= "\">%s</a>]&nbsp;&nbsp;&nbsp;" % p
-            html += "</div>"
-        else:
-            html  = "<div class='image'>"
-            html += "<a href='%s'><img src='%s' border='0'/></a>" % (self.graphfile, self.thumbfile)
-            html += "</div>"
-        
-        if self.tablefinal != None:
-            html += "<table align='center' border='1' cellpadding='5'>"
-            html += "<tr>"
-            if self.tablefinal == constants.TABLE_FINALTIME:
-                title = "Final Times"
-                col = "Time"
-            if self.tablefinal == constants.TABLE_FINALVALUE:
-                title = "Final Values"
-                col = "Value"
-            if self.tablefinal == constants.TABLE_FINALAVG:
-                title = "Final Values"
-                col = "Average"
-            html += "<th colspan='2'>%s</th>" % title
-            html += "</tr>"
-            html += "<tr><th>Profile</th><th>%s</th></tr>" % col
-            for p in self.profiles:
-                html += "<tr><td>%s</td>" % p
-                html += "<td>%.2f</td></tr>" % self.final[p]
-            html += "</table>"
-        
-        return html
-
-class Report(object):
-    def __init__(self, configfile, statsdir, htmlonly, mode=constants.REPORT_ALL):
-        self.configfile = configfile
-        self.config = RMMultiConfig.fromFile(self.configfile)
-        self.statsdir = statsdir
-        self.htmlonly = htmlonly
-        self.mode = mode
-
-        confs = self.config.getConfigsToReport()
-
-        profiles = set([c.getProfile() for c in confs])
-        self.profiles = list(profiles)
-
-        tracefiles = set([c.getTracefile() for c in confs])
-        injectfiles = set([c.getInjectfile() for c in confs])
-        self.traces = []
-        for t in tracefiles:
-            for i in injectfiles:
-                self.traces.append((t,i,genTraceInjName(t,i)))        
-        
-        
-        self.css = self.config.getCSS()
-        self.outdir = self.config.getReportDir()
-  
-        self.sections = []
-        graphs = self.config.getGraphSections()
-        for g in graphs:
-            title = self.config.getGraphTitle(g)
-            datafile = self.config.getGraphDatafile(g)
-            graphtype = self.config.getGraphType(g)
-            tablefinal = self.config.getGraphTable(g)
-            clip = self.config.getGraphClip(g)
-            slideshow = self.config.getGraphSlideshow(g)
-            
-            s = Section(title = title, datafile = datafile, graphtype = graphtype,
-                        tablefinal = tablefinal, clip = clip, slideshow = slideshow)
-            self.sections.append(s)
-
-        if not os.path.exists(self.outdir):
-            os.makedirs(self.outdir)
-
-        
-        
-
-
-    def generate(self, onlyprofile=None, onlytrace=None, configfilename=None):
-        def getProfilesDirs(t):
-            profilesdirs = [(p, self.statsdir + "/" + genDataDirName(p,t[0],t[1])) for p in self.profiles]
-            profilesdirs = dict([(p,d) for p,d in profilesdirs if os.path.exists(d)])
-            return profilesdirs
-
-        def getTracesDirs(p):
-            tracesdirs = [(t[2], self.statsdir + "/" + genDataDirName(p,t[0],t[1])) for t in self.traces]
-            tracesdirs = dict([(p,d) for p,d in tracesdirs if os.path.exists(d)])
-            return tracesdirs
-        
-        if self.mode == constants.REPORT_ALL:
-            self.generateIndex()
-            for t in self.traces:
-                print "Generating report for trace %s" % t[2]
-                profilesdirs = getProfilesDirs(t)
-                if len(profilesdirs) > 0:
-                    self.generateReport(t[2],profilesdirs)
-            for p in self.profiles:
-                print "Generating report for profile %s" % p
-                tracesdirs = getTracesDirs(p)
-                if len(tracesdirs) > 0:
-                    self.generateReport(p, tracesdirs)
-        elif self.mode == constants.REPORT_BASH or self.mode == constants.REPORT_CONDOR:
-            self.generateIndex()
-            if self.mode == constants.REPORT_CONDOR:
-                print generateCondorHeader(logname="report")
-            elif self.mode == constants.REPORT_BASH:
-                print "#!/bin/bash\n\n"
-            for t in self.traces:
-                profilesdirs = getProfilesDirs(t)
-                if len(profilesdirs) > 0:
-                    command  = "/home/borja/bin/vw/haizea-report-single-trace -c %s -s %s" % (self.configfile, self.statsdir)
-                    command += " --trace %s" % t[0]
-                    command += " --inj %s" % t[1]
-                    if self.mode == constants.REPORT_CONDOR:
-                        print generateCondorQueueEntry(command=command, dir="./")
-                    elif self.mode == constants.REPORT_BASH:
-                        print "python2.5", command
-            for p in self.profiles:
-                tracesdirs = getTracesDirs(p)
-                if len(tracesdirs) > 0:
-                    command  = "/home/borja/bin/vw/haizea-report-single-profile -c %s -s %s" % (self.configfile, self.statsdir)
-                    command += " --profile %s" % p
-                    if self.mode == constants.REPORT_CONDOR:
-                        print generateCondorQueueEntry(command=command, dir="./")
-                    elif self.mode == constants.REPORT_BASH:
-                        print "python2.5", command
-        elif self.mode == constants.REPORT_SINGLE_TRACE:
-            print "Generating report for trace %s" % onlytrace[2]
-            profilesdirs = getProfilesDirs(onlytrace)
-            if len(profilesdirs) > 0:
-                self.generateReport(onlytrace[2],profilesdirs)
-        elif self.mode == constants.REPORT_SINGLE_PROFILE:
-            print "Generating report for profile %s" % onlyprofile
-            tracesdirs = getTracesDirs(onlyprofile)
-            if len(tracesdirs) > 0:
-                self.generateReport(onlyprofile,tracesdirs)
-            
-
-    def generateIndex(self):
-        indexfile = open(self.outdir + "/index.html", "w")
-        header = self.generateHTMLHeader()
-        heading = self.generateHeading("Experiment Results")
-        indexfile.write(header + heading)
-        indexfile.write("<hr/>")
-        
-        traces = self.traces
-        traces.sort()
-        profiles = self.profiles
-        profiles.sort()
-        
-        html  = "<h3>Profile reports</h3>"
-        html += "<ul>"
-        for p in profiles:
-            html += "<li>"
-            tracesdirsexist = [os.path.exists(self.statsdir + "/" + genDataDirName(p,t[0],t[1])) for t in self.traces]
-            tracesdirsexist = [e for e in tracesdirsexist if e == True]
-            if len(tracesdirsexist) > 0:                    
-                html += "<a href='%s/index.html'>%s</a> (%i)" % (p,p,len(tracesdirsexist))
-            else:
-                html += p
-            html += "</li>"
-        html += "</ul>"
-        indexfile.write(html)
-        indexfile.write("<hr/>")
-
-        html  = "<h3>Trace reports</h3>"
-        html += "<ul>"
-        for t in traces:
-            html += "<li>"
-            profilesdirsexists = [os.path.exists(self.statsdir + "/" + genDataDirName(p,t[0],t[1])) for p in self.profiles]
-            profilesdirsexists = [e for e in profilesdirsexists if e == True]
-            if len(profilesdirsexists) > 0:                    
-                html += "<a href='%s/index.html'>%s</a> (%i)" % (t[2],t[2], len(profilesdirsexists))
-            else:
-                html += t[2]
-            html += "</li>"
-            html += "</li>"
-        html += "</ul>"
-        indexfile.write(html)
-        indexfile.write("<hr/>")
-        listitems = ""
-        for p in profiles:
-            for t in traces:
-                name = genDataDirName(p,t[0],t[1])
-                dir = self.statsdir + "/" + name
-                if not os.path.exists(dir):
-                    listitems += "<li>%s</li>" % name
-        if listitems != "":
-            html  = "<h3>Simulations that haven't completed yet</h3>"
-            html += "<ul>" + listitems + "</ul>"
-            indexfile.write(html)
-            indexfile.write("<hr/>")
-        
-
-        footer = self.generateHTMLFooter()
-        indexfile.write(footer)
-        
-        indexfile.close()
-        
-        if self.css != None:
-            shutil.copy(self.css, self.outdir)
-        
-    def generateReport(self, name, dirs):
-        outdir = self.outdir + "/" + name
-        if not os.path.exists(outdir):
-            os.makedirs(outdir)
-            
-        # Load data
-        for s in self.sections:
-            s.loadData(dirs)
-            
-        # Generate graphs
-        if not self.htmlonly:
-            for s in self.sections:
-                s.generateGraph(outdir)
-            
-        reportfile = open(outdir + "/index.html", "w")
-        
-        header = self.generateHTMLHeader()
-        heading = self.generateHeading(name)
-        reportfile.write(header + heading)
-        reportfile.write("<hr/>")
-        
-        toc = self.generateTOC()
-        reportfile.write(toc)
-        reportfile.write("<hr/>")
-
-        for i, s in enumerate(self.sections):
-            html = "<h3><a name='%i'></a>%s</h3>" % (i, s.title)
-            reportfile.write(html)
-            html = s.generateHTML()
-            reportfile.write(html)
-            reportfile.write("<hr/>")
-        
-        html = "<h3><a name='table'></a>Tabular Summary</h3>"
-        reportfile.write(html)
-        table = self.generateTableSummary(dirs)
-        reportfile.write(table)
-        
-        csvfile = "summary.csv"
-        html  = "<div class='center'><div class='small'>"
-        html += "[ <a href='%s'>CSV file</a> ]" % csvfile
-        html += "</div></div>"
-        reportfile.write(html)
-
-        self.generateCSVSummary(outdir + "/" + csvfile, dirs)
-            
-        footer = self.generateHTMLFooter()
-        reportfile.write(footer)
-        
-        reportfile.close()
-        
-        if self.css != None:
-            shutil.copy(self.css, outdir)
-        
-    def generateHTMLHeader(self):
-        header = """<html>
-<head>
-    <title>Experiment results</title>
-    <meta http-equiv="Content-Type" content="text/html" />
-    <meta http-equiv="Content-Language" content="en"/>
-    <link rel="stylesheet" type="text/css" href="report.css" media="screen" />
-</head>
-"""
-        return header
-    
-    def generateHeading(self, title):
-        heading = """
-<body>
-<h1>%s</h1>
-<hr/>
-<p>
-<strong>Report generation date:</strong> %s
-</p>
-""" % (title, now())
-        return heading
-    
-    def generateTOC(self):
-        toc = "<h5>Table of contents</h5>"
-        toc += "<ul>"
-        for i, s in enumerate(self.sections):
-            toc += "<li><a href='#%i'>%s</a></li>" % (i, s.title)
-        toc += "<li><a href='#table'>Tabular summary</a></li>"
-        toc += "</ul>"
-        
-        return toc
-    
-    def generateTableSummary(self, dirs):   
-        profiles = dirs.keys()
-        profiles.sort()
-        sections = [s for s in self.sections if s.tablefinal!=None] 
-
-        html  = "<table align='center' border='1' cellpadding='5'>"
-        html += "<tr>"
-        html += "<th colspan='%i'>Summary</th>" % (len(self.sections)+1)
-        html += "</tr>"
-        html += "<tr><th>Profile</th>"
-        for s in sections:
-            html += "<th>%s</th>" % s.title
-        html += "</tr>"
-        for p in profiles:
-            html += "<tr><td>%s</td>" % p
-            for s in sections:
-                html += "<td>%.2f</td>" % s.final[p]
-            html += "</tr>"
-        html += "</table>"        
-        return html
-    
-    def generateCSVSummary(self, csvfile, dirs):  
-        profiles = dirs.keys()
-        profiles.sort()
-        sections = [s for s in self.sections if s.tablefinal!=None] 
-        
-        f=open(csvfile, 'w')
-        
-        headers = ["Profiles"] + [s.title for s in sections]
-        csvheader=",".join(headers)
-        f.write("%s\n" % csvheader)
-        for p in profiles:
-            fields = [p] + ["%.2f" % s.final[p] for s in sections]
-            csvline=",".join(fields)
-            f.write("%s\n" % csvline)
-        f.close()
-    
-    def generateHTMLFooter(self):
-        footer = """
-</body>
-</html>
-"""
-        return footer
-        
-

Deleted: trunk/src/haizea/analysis/traces.py
===================================================================
--- trunk/src/haizea/analysis/traces.py	2008-07-16 17:17:54 UTC (rev 439)
+++ trunk/src/haizea/analysis/traces.py	2008-07-16 17:21:36 UTC (rev 440)
@@ -1,33 +0,0 @@
-# -------------------------------------------------------------------------- #
-# Copyright 2006-2008, University of Chicago                                 #
-# Copyright 2008, Distributed Systems Architecture Group, Universidad        #
-# Complutense de Madrid (dsa-research.org)                                   #
-#                                                                            #
-# Licensed under the Apache License, Version 2.0 (the "License"); you may    #
-# not use this file except in compliance with the License. You may obtain    #
-# a copy of the License at                                                   #
-#                                                                            #
-# http://www.apache.org/licenses/LICENSE-2.0                                 #
-#                                                                            #
-# Unless required by applicable law or agreed to in writing, software        #
-# distributed under the License is distributed on an "AS IS" BASIS,          #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
-# See the License for the specific language governing permissions and        #
-# limitations under the License.                                             #
-# -------------------------------------------------------------------------- #
-
-import haizea.traces.readers as tracereaders
-
-def analyzeARLeaseInjection(tracefile):
-    injectedleases = tracereaders.LWF(tracefile)
-    accumdur = 0
-    for l in injectedleases:
-        dur = l.end - l.start
-        numnodes = l.numnodes
-        
-        accumdur += dur * numnodes
-    
-    seconds = accumdur.seconds
-    formatted = accumdur.strftime("%dd-%Hh-%Mm-%Ss")
-
-    print "%i %s" % (seconds, formatted)
\ No newline at end of file

Modified: trunk/src/haizea/cli/commands.py
===================================================================
--- trunk/src/haizea/cli/commands.py	2008-07-16 17:17:54 UTC (rev 439)
+++ trunk/src/haizea/cli/commands.py	2008-07-16 17:21:36 UTC (rev 440)
@@ -18,7 +18,7 @@
 
 from haizea.resourcemanager.rm import ResourceManager
 from haizea.traces.generators import generateTrace, generateImages
-from haizea.common.utils import gen_traceinj_name
+from haizea.common.utils import gen_traceinj_name, unpickle
 from haizea.common.config import RMConfig, RMMultiConfig, TraceConfig, ImageConfig
 import os.path
 import optparse
@@ -104,6 +104,29 @@
     print template.render(configs=templatedata, etcdir=etcdir)
 
 
+def haizea_convert_data(argv):
+    p = OptionParser()
+    p.add_option(Option("-d", "--datafiles", action="store", type="string", dest="datafiles", required=True))
+    p.add_option(Option("-s", "--summary", action="store_true",  dest="summary"))
+    p.add_option(Option("-l", "--lease-stats", action="store", type="string", dest="lease"))
+    p.add_option(Option("-t", "--include-attributes", action="store_true", dest="attributes"))
+    p.add_option(Option("-f", "--format", action="store", type="string", dest="format"))
+
+    opt, args = p.parse_args(argv)
+    
+    datafile=opt.datafiles
+    
+    stats = unpickle(datafile)
+    
+    # Barebones for now. Just prints out lease id, waiting time, and
+    # slowdown (only best-effort leases)
+    waitingtimes = stats.get_waiting_times()
+    slowdowns = stats.get_slowdowns()
+    print "lease_id waiting_time slowdown"
+    for lease_id in waitingtimes:
+        print lease_id, waitingtimes[lease_id].seconds, slowdowns[lease_id]
+
+
 class OptionParser (optparse.OptionParser):
     def _init_parsing_state (self):
         optparse.OptionParser._init_parsing_state(self)

Modified: trunk/src/haizea/common/constants.py
===================================================================
--- trunk/src/haizea/common/constants.py	2008-07-16 17:17:54 UTC (rev 439)
+++ trunk/src/haizea/common/constants.py	2008-07-16 17:21:36 UTC (rev 440)
@@ -294,14 +294,14 @@
 
 ENACT_PACKAGE="haizea.resourcemanager.enact"
 
-COUNTER_ARACCEPTED="ar_accepted"
-COUNTER_ARREJECTED="ar_rejected"
-COUNTER_IMACCEPTED="im_accepted"
-COUNTER_IMREJECTED="im_rejected"
-COUNTER_BESTEFFORTCOMPLETED="besteffort_completed"
-COUNTER_QUEUESIZE="queuesize"
-COUNTER_DISKUSAGE="diskusage"
-COUNTER_CPUUTILIZATION="cpuutilization"
+COUNTER_ARACCEPTED="Accepted AR"
+COUNTER_ARREJECTED="Rejected AR"
+COUNTER_IMACCEPTED="Accepted Immediate"
+COUNTER_IMREJECTED="Rejected Immediate"
+COUNTER_BESTEFFORTCOMPLETED="Best-effort completed"
+COUNTER_QUEUESIZE="Queue size"
+COUNTER_DISKUSAGE="Disk usage"
+COUNTER_CPUUTILIZATION="CPU utilization"
 
 AVERAGE_NONE=0
 AVERAGE_NORMAL=1

Modified: trunk/src/haizea/common/utils.py
===================================================================
--- trunk/src/haizea/common/utils.py	2008-07-16 17:17:54 UTC (rev 439)
+++ trunk/src/haizea/common/utils.py	2008-07-16 17:21:36 UTC (rev 440)
@@ -18,7 +18,7 @@
 
 from mx import DateTime
 from math import ceil, floor
-from cPickle import dump, HIGHEST_PROTOCOL
+from cPickle import dump, load, HIGHEST_PROTOCOL
 
 def gen_traceinj_name(tracefile, injectedfile):
     tracename=tracefile.split("/")[-1].split(".")[0]
@@ -63,6 +63,13 @@
     dump(data, f, protocol = HIGHEST_PROTOCOL)
     f.close()
 
+def unpickle(file):
+    f = open (file, "r")
+    data = load(f)
+    f.close()
+    return data
+
+
 LEASE_ID = 1
 
 def get_lease_id():

Modified: trunk/src/haizea/resourcemanager/scheduler.py
===================================================================
--- trunk/src/haizea/resourcemanager/scheduler.py	2008-07-16 17:17:54 UTC (rev 439)
+++ trunk/src/haizea/resourcemanager/scheduler.py	2008-07-16 17:21:36 UTC (rev 440)
@@ -474,6 +474,8 @@
         if l.state == constants.LEASE_STATE_DEPLOYED:
             l.state = constants.LEASE_STATE_ACTIVE
             rr.state = constants.RES_STATE_ACTIVE
+            now_time = self.rm.clock.get_time()
+            l.start.actual = now_time
             
             try:
                 self.rm.resourcepool.startVMs(l, rr)
@@ -499,13 +501,15 @@
         self.rm.logger.debug("LEASE-%i Start of handleEndVM" % l.id, constants.SCHED)
         self.rm.logger.edebug("LEASE-%i Before:" % l.id, constants.SCHED)
         l.print_contents()
-        diff = self.rm.clock.get_time() - rr.start
+        now_time = self.rm.clock.get_time()
+        diff = now_time - rr.start
         l.duration.accumulate_duration(diff)
         rr.state = constants.RES_STATE_DONE
         if rr.oncomplete == constants.ONCOMPLETE_ENDLEASE:
             self.rm.resourcepool.stopVMs(l, rr)
             l.state = constants.LEASE_STATE_DONE
             l.duration.actual = l.duration.accumulated
+            l.end = now_time
             self.completedleases.add(l)
             self.scheduledleases.remove(l)
             for vnode, pnode in l.vmimagemap.items():

Modified: trunk/src/haizea/resourcemanager/stats.py
===================================================================
--- trunk/src/haizea/resourcemanager/stats.py	2008-07-16 17:17:54 UTC (rev 439)
+++ trunk/src/haizea/resourcemanager/stats.py	2008-07-16 17:21:36 UTC (rev 440)
@@ -19,6 +19,7 @@
 import os
 import os.path
 import haizea.common.constants as constants
+import haizea.resourcemanager.datastruct as ds
 from haizea.common.utils import pickle
 from errno import EEXIST
 
@@ -34,7 +35,23 @@
         
         # Lease data
         self.leases = {}
+        
+    def get_waiting_times(self):
+        waiting_times = {}
+        for lease_id in self.leases:
+            lease = self.leases[lease_id]
+            if isinstance(lease, ds.BestEffortLease):
+                waiting_times[lease_id] = lease.get_waiting_time()
+        return waiting_times
 
+    def get_slowdowns(self):
+        slowdowns = {}
+        for lease_id in self.leases:
+            lease = self.leases[lease_id]
+            if isinstance(lease, ds.BestEffortLease):
+                slowdowns[lease_id] = lease.get_slowdown()
+        return slowdowns
+
 class StatsCollection(object):
     def __init__(self, rm, datafile):
         self.data = StatsData()



More information about the Haizea-commit mailing list