Contact: fumanchu@aminus.org

Log in as guest/misc to create tickets

Changeset 128

Show
Ignore:
Timestamp:
10/29/07 18:10:44
Author:
fumanchu
Message:

pyconquer: New log_times helper function.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • pyconquer.py

    r118 r128  
    392392        tr.out.close() 
    393393 
     394def log_times(globpath, pattern=".*"): 
     395    """Return a dict of matching (float(time in ms), line) pairs for each file.""" 
     396    import glob 
     397     
     398    results = {} 
     399    for fname in glob.glob(globpath): 
     400        f = open(fname, 'rb') 
     401        lines = [] 
     402        for line in f.readlines(): 
     403            line = line.rstrip() 
     404            if line.endswith("ms") and re.search(pattern, line): 
     405                line = line.rsplit(" ", 1) 
     406                lines.append((float(line[1][:-2]), line[0])) 
     407        results[fname] = lines 
     408        f.close() 
     409    return results 
    394410 
    395411#                                Verifier                                 #