Advertisement
Guest User

Untitled

a guest
Mar 20th, 2020
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import sys
  4.  
  5.  
  6. def report_parse(report):
  7.     # Keep lines with report
  8.     clocks = {}
  9.  
  10.     for l in report:
  11.         if not 'Max frequency' in l:
  12.             continue
  13.         l = l.split(':')
  14.  
  15.         cn = l[1].split("'")[-2]
  16.         cf = float(l[2].split()[0])
  17.  
  18.         clocks[cn] = cf
  19.    
  20.     return clocks
  21.  
  22.  
  23. def main(argv0, *argv):
  24.     clocks = {}
  25.     for f in argv:
  26.         cr = report_parse(open(f).readlines())
  27.         for cn, cf in cr.items():
  28.             clocks.setdefault(cn, []).append(cf)
  29.  
  30.     for cn, cfs in clocks.items():
  31.         print("%10s: %f %f %f" % (
  32.             cn, min(cfs), sum(cfs)/len(cfs), max(cfs)
  33.         ))
  34.  
  35.  
  36. if __name__ == '__main__':
  37.     main(*sys.argv)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement