test_3_analysis.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import pickle
  2. import pandas as pd
  3. def get_average_active_secs(df, repeat=1):
  4. mask = (df > 0.005) & (df < 0.020)
  5. active = df[mask]
  6. secs = len(active) / 1000
  7. return secs / repeat
  8. def analyze_benchmark(benchmark):
  9. with open(f"output/test_3_{benchmark}_ckpt.pickle", "rb") as f:
  10. d = pickle.load(f)
  11. measured_init_times = []
  12. for messages in d["debug_outputs"]:
  13. for message in messages:
  14. if message.startswith("cycle"):
  15. cycle = message.split()[1]
  16. cycle = int(cycle)
  17. freq = 10 * 1000 * 1000
  18. time = cycle / freq
  19. measured_init_times.append(time)
  20. return measured_init_times[0]
  21. def do_analysis(benchmarks):
  22. results = []
  23. for benchmark in benchmarks:
  24. try:
  25. init_time = analyze_benchmark(benchmark)
  26. except:
  27. continue
  28. results.append({
  29. "benchmark": benchmark,
  30. "init time (s)": init_time,
  31. })
  32. d = pd.DataFrame(results)
  33. avg_init_time = d["init time (s)"].mean()
  34. print(d)
  35. print("")
  36. print(f"average init time: {avg_init_time:.5f} s")
  37. def main():
  38. benchmarks = ["vFFT", "vConv2d", "vCrc", "vBasicMath", "vSha", "vStringSearch", "vAes", "vMatMul"]
  39. benchmarks = ["vFFT", "vCrc", "vAes", "vSha"]
  40. do_analysis(benchmarks)
  41. if __name__ == "__main__":
  42. main()