-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraph.py
53 lines (40 loc) · 1.22 KB
/
graph.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import json
import matplotlib.pyplot as plt
from collections import defaultdict
import re
# Load the JSON file
with open('benchmarks.json', 'r') as file:
data = json.load(file)
# Group the data by the base name
benchmarks = data['benchmarks']
grouped_data = defaultdict(list)
FREQ = 4.5
for benchmark in benchmarks:
# Split into base name and number
name_parts = benchmark['name'].split('/')
base_name = name_parts[0]
divisor = 2**(int(name_parts[1]) + 10)
adjusted_time = benchmark['real_time'] / divisor
adjusted_time *= FREQ
grouped_data[base_name].append(adjusted_time) # Group main benchmark data
adjusted_data = {}
for name, real_times in grouped_data.items():
adjusted_data[name] = real_times
# Plot the adjusted data
plt.figure(figsize=(10, 6))
for name, real_times in adjusted_data.items():
x_values = range(10, 10 + len(real_times))
plt.plot(
x_values,
real_times,
label=name,
marker='o', # Add a marker for each point
markersize=5 # Adjust marker size for visibility
)
# Add labels, title, and legend
plt.xlabel('Number of nops (log base 2)')
plt.ylabel('Clock cycles per nop')
plt.legend()
plt.grid(True)
# Show the plot
plt.show()