All pastes #263635 Raw Edit

Something

public text v1 · immutable
·published 2006-12-01 18:10 UTC
rendered paste body
class Reader:
        
        # (hostname,id) => value in ms
        amavis = {}
        postfix = {}
        apattern = re.compile('^.* (.*) amavis\[.* \((.*)\) TIMING \[total (.*) ms\]')
        def readamavis(self,alog):
                
                f = open(alog)
                fsize = os.path.getsize(alog)
                s = 'start'
                counter = 0
                while s :
                        s = f.readline()
                        if s:
                                #m = self.apattern.match(s)
                                sp = s.split()[:9]
                                if sp[6] == 'TIMING':
#                               if m:
                                        key = ( sp[3], sp[5] )
                                        value = sp[8]
                        
                                        self.amavis[key] = value
                        counter += 1

                        if counter > 1000:
                                print  'done %f percent' % ( (float( f.tell()) / fsize)  * 100 )
                                counter = 0

                f.close()

        def readpostfix(self,plog):
                self.plog
                pass

class Treebuilder:
        def buildtree(self,amavis, postfix):
                self.tree=[] #tree is a tuple  unfinished when tupls is incomplete (third field) ( num nu