Advertisement
Dave_Rove

Benchmark checks with phpBB colored output

Oct 28th, 2019
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.57 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. benchmark='''
  4. STM32F103C8T6 72MHz (Cortex-M3)
  5. INT_LOOP(30000) bench...= 2924 microseconds 10.26MIPS
  6. LONG_LOOP(30000) bench...= 2926 microseconds 10.25MIPS
  7. FLOAT_DIV(30000) bench...= 27979 microseconds 1.20MFLOPS
  8. DOUBLE_DIV(30000) bench...= 38000 microseconds 0.86MFLOPS
  9. FLOAT_MUL(30000) bench...= 20463 microseconds 1.71MFLOPS
  10. DOUBLE_MUL(30000) bench...= 25891 microseconds 1.31MFLOPS
  11.  
  12. Arduino Nano (ATMega328 16MHz AVR)
  13. INT_LOOP(30000) bench...= 7544 microseconds 3.98MIPS
  14. LONG_LOOP(30000) bench...= 13408 microseconds 2.24MIPS
  15. FLOAT_DIV(30000) bench...= 154792 microseconds 0.21MFLOPS
  16. DOUBLE_DIV(30000) bench...= 154800 microseconds 0.21MFLOPS
  17. FLOAT_MUL(30000) bench...= 156744 microseconds 0.21MFLOPS
  18. DOUBLE_MUL(30000) bench...= 156736 microseconds 0.21MFLOPS
  19.  
  20. Arduino Zero (Atmel ATSAMD21G18 48MHz Cortex-M0+)
  21. INT_LOOP(30000) bench...= 116898 microseconds 11.92MIPS
  22. LONG_LOOP(30000) bench...= 116898 microseconds 11.93MIPS
  23. FLOAT_DIV(30000) bench...= 116898 microseconds 0.38MFLOPS
  24. DOUBLE_DIV(30000) bench...= 113126 microseconds 0.27MFLOPS
  25. FLOAT_MUL(30000) bench...= 92387 microseconds 0.33MFLOPS
  26. DOUBLE_MUL(30000) bench...= 116898 microseconds 0.26MFLOPS
  27.  
  28. Arduino Due (Atmel SAM3X8E 84 MHz Cortex-M3)
  29. INT_LOOP(30000) bench...= 1074 microseconds 27.93MIPS
  30. LONG_LOOP(30000) bench...= 1107 microseconds 27.10MIPS
  31. FLOAT_DIV(30000) bench...= 25859 microseconds 1.21MFLOPS
  32. DOUBLE_DIV(30000) bench...= 37966 microseconds 0.81MFLOPS
  33. FLOAT_MUL(30000) bench...= 18659 microseconds 1.71MFLOPS
  34. DOUBLE_MUL(30000) bench...= 25450 microseconds 1.23MFLOPS
  35.  
  36. Teensy LC (MKL26Z64 Cortex-M0 48MHz)
  37. INT_LOOP(30000) bench...= 2508 microseconds 11.96MIPS
  38. LONG_LOOP(30000) bench...= 2512 microseconds 11.94MIPS
  39. FLOAT_DIV(30000) bench...= 76705 microseconds 0.40MFLOPS
  40. DOUBLE_DIV(30000) bench...= 101840 microseconds 0.30MFLOPS
  41. FLOAT_MUL(30000) bench...= 80471 microseconds 0.38MFLOPS
  42. DOUBLE_MUL(30000) bench...= 106242 microseconds 0.29MFLOPS
  43.  
  44. Teensy 3.2 (MK20DX256 Cortex-M4 96 MHz)
  45. INT_LOOP(30000) bench...= 940 microseconds 31.91MIPS
  46. LONG_LOOP(30000) bench...= 944 microseconds 31.78MIPS
  47. FLOAT_DIV(30000) bench...= 10977 microseconds 2.99MFLOPS
  48. DOUBLE_DIV(30000) bench...= 21317 microseconds 1.47MFLOPS
  49. FLOAT_MUL(30000) bench...= 8463 microseconds 3.99MFLOPS
  50. DOUBLE_MUL(30000) bench...= 13162 microseconds 2.46MFLOPS
  51.  
  52. Teensy 3.2 (MK20DX256 Cortex-M4 72MHz)
  53. INT_LOOP(30000) bench...= 1253 microseconds 23.94MIPS
  54. LONG_LOOP(30000) bench...= 1256 microseconds 23.89MIPS
  55. FLOAT_DIV(30000) bench...= 14635 microseconds 2.24MFLOPS
  56. DOUBLE_DIV(30000) bench...= 25083 microseconds 1.26MFLOPS
  57. FLOAT_MUL(30000) bench...= 11288 microseconds 2.99MFLOPS
  58. DOUBLE_MUL(30000) bench...= 17551 microseconds 1.84MFLOPS
  59.  
  60. ESP8266 esp-12e 160MHz
  61. INT_LOOP(30000) bench...= 752 microseconds 39.89MIPS
  62. LONG_LOOP(30000) bench...= 751 microseconds 39.95MIPS
  63. FLOAT_DIV(30000) bench...= 7500 microseconds 4.45MFLOPS
  64. DOUBLE_DIV(30000) bench...= 8063 microseconds 4.10MFLOPS
  65. FLOAT_MUL(30000) bench...= 9938 microseconds 3.27MFLOPS
  66. DOUBLE_MUL(30000) bench...= 10688 microseconds 3.02MFLOPS
  67.  
  68. ESP8266 esp-12e 80MHz
  69. INT_LOOP(30000) bench...= 1504 microseconds 19.95MIPS
  70. LONG_LOOP(30000) bench...= 1501 microseconds 19.99MIPS
  71. FLOAT_DIV(30000) bench...= 15001 microseconds 2.22MFLOPS
  72. DOUBLE_DIV(30000) bench...= 16126 microseconds 2.05MFLOPS
  73. FLOAT_MUL(30000) bench...= 19876 microseconds 1.63MFLOPS
  74. DOUBLE_MUL(30000) bench...= 21377 microseconds 1.51MFLOPS
  75.  
  76. #From mantoui
  77.  
  78. teensy3.6 @180mhz
  79.      INT_LOOP(30000) bench...= 500 microseconds 60.00MIPS
  80.      LONG_LOOP(30000) bench...= 502 microseconds 59.76MIPS
  81.      FLOAT_DIV(30000) bench...= 2503 microseconds 14.99MFLOPS
  82.      DOUBLE_DIV(30000) bench...= 9343 microseconds 3.39MFLOPS
  83.      FLOAT_MUL(30000) bench...= 667 microseconds 181.82MFLOPS
  84.      DOUBLE_MUL(30000) bench...= 7008 microseconds 4.61MFLOPS
  85.  
  86. teensy3.6 @120mhz
  87.     INT_LOOP(30000) bench...= 752 microseconds 39.89MIPS
  88.     LONG_LOOP(30000) bench...= 753 microseconds 39.84MIPS
  89.     FLOAT_DIV(30000) bench...= 3756 microseconds 9.99MFLOPS
  90.     DOUBLE_DIV(30000) bench...= 14019 microseconds 2.26MFLOPS
  91.     FLOAT_MUL(30000) bench...= 1001 microseconds 120.97MFLOPS
  92.     DOUBLE_MUL(30000) bench...= 10514 microseconds 3.07MFLOPS
  93.  
  94. teensy3.5@120mhz
  95.     INT_LOOP(30000) bench...= 752 microseconds 39.89MIPS
  96.     LONG_LOOP(30000) bench...= 755 microseconds 39.74MIPS
  97.     FLOAT_DIV(30000) bench...= 3758 microseconds 9.99MFLOPS
  98.     DOUBLE_DIV(30000) bench...= 18797 microseconds 1.66MFLOPS
  99.     FLOAT_MUL(30000) bench...= 1003 microseconds 120.97MFLOPS
  100.     DOUBLE_MUL(30000) bench...= 10529 microseconds 3.07MFLOPS
  101.  
  102. teensy3.2@120mhz
  103.     INT_LOOP(30000) bench...= 751 microseconds 39.95MIPS
  104.     LONG_LOOP(30000) bench...= 755 microseconds 39.74MIPS
  105.     FLOAT_DIV(30000) bench...= 8784 microseconds 3.74MFLOPS
  106.     DOUBLE_DIV(30000) bench...= 17559 microseconds 1.79MFLOPS
  107.     FLOAT_MUL(30000) bench...= 6771 microseconds 4.99MFLOPS
  108.     DOUBLE_MUL(30000) bench...= 10533 microseconds 3.07MFLOPS
  109.  
  110. dragonfly@80MHz    
  111.    INT_LOOP(30000) bench...= 1129 microseconds 26.57MIPS
  112.    LONG_LOOP(30000) bench...= 1129 microseconds 26.57MIPS
  113.    FLOAT_DIV(30000) bench...= 5641 microseconds 6.65MFLOPS
  114.    DOUBLE_DIV(30000) bench...= 21813 microseconds 1.45MFLOPS
  115.    FLOAT_MUL(30000) bench...= 1883 microseconds 39.79MFLOPS
  116.    DOUBLE_MUL(30000) bench...= 16173 microseconds 1.99MFLOPS
  117.  
  118. #From Budvar10
  119.  Arduino-PRO 1284 (ATmega1284P 24MHz)
  120.  INT_LOOP(30000) bench...= 5024 microseconds 5.97MIPS
  121.  LONG_LOOP(30000) bench...= 8992 microseconds 3.34MIPS
  122.  FLOAT_DIV(30000) bench...= 96789 microseconds 0.34MFLOPS
  123.  DOUBLE_DIV(30000) bench...= 96800 microseconds 0.34MFLOPS
  124.  FLOAT_MUL(30000) bench...= 98058 microseconds 0.34MFLOPS
  125.  DOUBLE_MUL(30000) bench...= 98059 microseconds 0.34MFLOPS
  126.  
  127. #From gdsports
  128.  Adafruit Metro M4 Express (samd51 @120MHz) cache on
  129.  INT_LOOP(30000) bench...= 752 microseconds 39.89MIPS
  130.  LONG_LOOP(30000) bench...= 753 microseconds 39.84MIPS
  131.  FLOAT_DIV(30000) bench...= 3756 microseconds 9.99MFLOPS
  132.  DOUBLE_DIV(30000) bench...= 14022 microseconds 2.26MFLOPS
  133.  FLOAT_MUL(30000) bench...= 1002 microseconds 120.48MFLOPS
  134.  DOUBLE_MUL(30000) bench...= 10516 microseconds 3.07MFLOPS
  135.  
  136. Teensy 4.0 @600MHz
  137. FLOAT_DIV(30000) bench...= 200 microseconds 300.00MFLOPS
  138. DOUBLE_DIV(30000) bench...= 201 microseconds 297.03MFLOPS
  139. FLOAT_MUL(30000) bench...= 150 microseconds 600.00MFLOPS
  140. DOUBLE_MUL(30000) bench...= 300 microseconds 150.00MFLOPS
  141. Time (ms)...= 396577 ms
  142. INT_LOOP(30000) bench...= 300 microseconds 600.00MIPS
  143. LONG_LOOP(30000) bench...= 300 microseconds 300.00MIPS
  144. FLOAT_DIV(30000) bench...= 300 microseconds 300.00MFLOPS
  145. '''
  146.  
  147.  
  148. benchlist = benchmark.splitlines()
  149. with open('output.txt', 'w') as filewr:
  150.     filewr.write("   TEST           TIME        MOPS           TIME*MOPS\n")
  151.     filewr.write("   ----           ----        ----           ---------\n")
  152.     for line in benchlist:
  153.         linelist = line.split()
  154.         if "microseconds" in linelist:
  155.             test = linelist[0].split('(')[0]
  156.             time = int(linelist[2])
  157.             mops, op = linelist[4].split('M')
  158.             mops, op = float(mops), op.lower()
  159.             div = time * mops
  160.             good = 27000 < div < 33000
  161.             divform = "{:12.2f}" if good else "[color=red]{:12.2f}[/color]"
  162.             template = "   {:11s}{:8d} μs{:9.2f} M{:6s}" + divform + "\n"
  163.             filewr.write(template.format(test,time,mops,op,time*mops))
  164.         elif line and not line[0].isspace():
  165.             filewr.write("[color=grey]" + line + "[/color]\n")
  166.         else:
  167.             filewr.write('\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement