Skip to content

Commit c9095c3

Browse files
committed
WIP: update new profiling data
1 parent 471877d commit c9095c3

26 files changed

+271
-265
lines changed

statistic/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
3: Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
44
4: arm (ThunderX2-99xx)
55
5: mag
6+
6: M2 Pro Max

statistic/boot time difference.png

-93.1 KB
Binary file not shown.

statistic/diff_boot_time.png

93.1 KB
Loading

statistic/diff_ns_per_call.png

83.8 KB
Loading

statistic/draw.py

Lines changed: 72 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,42 @@
11
#!/usr/bin/env python3
22
"""
3-
plot_results.py
3+
draw.py
44
5-
Reads 5 "results_summary_{N}.txt" files, each containing columns:
5+
We have 6 data files:
6+
results_summary_1.txt
7+
results_summary_2.txt
8+
results_summary_3.txt
9+
results_summary_4.txt
10+
results_summary_5.txt
11+
results_summary_6.txt
12+
13+
Each has 11 columns (skip the first row as a header):
614
1) SMP
715
2) real_boot_time
8-
3) times_call_semu_timer_clocksource
16+
3) times_called
917
4) ns_per_call
1018
5) predict_sec
1119
6) scale_factor
12-
7) percentage
13-
8) real_ns_per_call
14-
15-
We skip the header row in each file. For each column 2..8, we create
16-
one figure, plotting SMP on the x-axis vs. that column's values
17-
on the y-axis. We have 5 lines in each plot, one line per environment.
18-
19-
Additionally, we create one more figure for the difference:
20-
(predict_sec [col 5]) - (real_boot_time [col 2])
21-
22-
Environment CPU Descriptions:
23-
1: 13th Gen Intel(R) Core(TM) i7-13700
24-
2: Intel(R) Xeon(R) CPU E5-2640 v4 @ 2.40GHz
25-
3: Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
26-
4: arm (ThunderX2-99xx)
27-
5: mag
20+
7) test_total_clocksource_ns
21+
8) real_total_clocksource_ns
22+
9) percentage
23+
10) real_ns_per_call
24+
11) diff_ns_per_call
25+
26+
We want to plot columns 2..11 (10 columns) vs. column 1 (SMP).
27+
Then create 1 more difference plot for (predict_sec - real_boot_time).
28+
29+
Thus, we produce 11 plots total:
30+
- 10 from col=2..11
31+
- 1 difference plot (predict_sec - real_boot_time).
2832
"""
2933

3034
import matplotlib
31-
# Force a non-interactive backend (no hover tooltips):
32-
matplotlib.use("Agg")
35+
matplotlib.use("Agg") # for non-interactive environments
3336

3437
import numpy as np
3538
import matplotlib.pyplot as plt
3639

37-
# Filenames expected
38-
# results_summary_1.txt
39-
# results_summary_2.txt
40-
# results_summary_3.txt
41-
# results_summary_4.txt
42-
# results_summary_5.txt
43-
4440
ENV_FILES = [
4541
"results_summary_1.txt",
4642
"results_summary_2.txt",
@@ -56,91 +52,101 @@
5652
"3: Env3",
5753
"4: Env4",
5854
"5: Env5",
59-
"6: Env6"
55+
"6: Env6",
6056
]
6157

62-
# Map from column index to a label (column 1 is SMP)
63-
# We want columns 2..8
58+
# A dictionary for column labels (2..11):
6459
COL_LABELS = {
65-
2: "real boot time (sec)",
66-
3: "times call 'semu_timer_clocksource'",
67-
4: "ns_per_call",
68-
5: "predict boot time (sec)",
60+
2: "real_boot_time",
61+
3: "times_called",
62+
4: "predict_ns_per_call",
63+
5: "predict_boot_time",
6964
6: "scale_factor",
65+
7: "test_total_clocksource_ns",
66+
8: "real_total_clocksource_ns",
67+
9: "percentage",
68+
10: "real_ns_per_call",
69+
11: "diff_ns_per_call",
7070
}
7171

7272
def main():
73-
# 1) Plot each data column from 2..8
74-
for col in range(2, 7):
73+
# 1) Create a figure for each column from 2..11
74+
for col in range(2, 12): # 2..11 inclusive => 10 columns
7575
label = COL_LABELS[col]
7676

7777
plt.figure(figsize=(8, 6))
7878
plt.title(f"{label} vs. SMP")
7979
plt.xlabel("SMP")
8080
plt.ylabel(label)
8181

82+
# For each environment data
8283
for i, fname in enumerate(ENV_FILES):
8384
try:
84-
# Load numeric data, skipping first row (header).
85+
# skiprows=1 => skip header line
86+
# Load all columns => we have 11 total
8587
data = np.loadtxt(fname, skiprows=1)
8688
except OSError:
87-
print(f"Warning: could not open {fname}, skipping.")
89+
print(f"Warning: could not open {fname}. Skipping.")
90+
continue
91+
except ValueError as e:
92+
print(f"ValueError loading {fname}: {e}")
8893
continue
8994

90-
if data.shape[1] < 6:
91-
print(f"Warning: {fname} does not have at least 8 columns, skipping.")
95+
# We expect at least 11 columns
96+
if data.shape[1] < 11:
97+
print(f"Warning: {fname} does not have 11 columns. Found shape: {data.shape}")
9298
continue
9399

94-
x = data[:, 0] # SMP is col 1 => index=0
95-
y = data[:, col - 1] # col -> zero-based
100+
x = data[:, 0] # SMP is col=1 => index=0
101+
y = data[:, col - 1] # col => zero-based index
96102

97103
plt.plot(x, y, marker='o', label=ENV_NAMES[i])
98104

99105
plt.legend(loc="best")
100106
plt.grid(True)
101-
102-
outname = f"{label}.png"
103-
plt.savefig(outname, dpi=150)
107+
outfile = f"{label}.png"
108+
plt.savefig(outfile, dpi=150)
104109
plt.close()
105-
print(f"Created {outname}")
106-
107-
print("All standard column plots generated!")
108-
109-
# 2) Create an additional figure for (predict_sec - real_boot_time).
110-
# predict_sec is column 5 => index 4
111-
# real_boot_time is column 2 => index 1
112-
label_diff = "boot time difference" # name of the new figure
110+
print(f"Created {outfile}")
113111

112+
# 2) Create an additional difference plot for (predict_sec - real_boot_time).
113+
# predict_sec => col=5 => index=4
114+
# real_boot_time => col=2 => index=1
115+
label_diff = "diff_boot_time"
114116
plt.figure(figsize=(8, 6))
115117
plt.title(f"{label_diff} vs. SMP")
116118
plt.xlabel("SMP")
117-
plt.ylabel("boot time difference (seconds)")
119+
plt.ylabel("predict_sec - real_boot_time")
120+
118121
for i, fname in enumerate(ENV_FILES):
119122
try:
120123
data = np.loadtxt(fname, skiprows=1)
121124
except OSError:
122-
print(f"Warning: could not open {fname}, skipping.")
125+
print(f"Warning: could not open {fname}. Skipping.")
126+
continue
127+
except ValueError as e:
128+
print(f"ValueError loading {fname}: {e}")
123129
continue
124130

125-
if data.shape[1] < 6:
126-
print(f"Warning: {fname} does not have at least 8 columns, skipping.")
131+
if data.shape[1] < 11:
132+
print(f"Warning: {fname} does not have 11 columns. Found shape: {data.shape}")
127133
continue
128134

129-
x = data[:, 0] # SMP
130-
predict_sec = data[:, 4] # col5 => index=4
131-
real_bt = data[:, 1] # col2 => index=1
132-
diff = predict_sec - real_bt # difference
135+
x = data[:, 0]
136+
predict_sec = data[:, 4] # col=5 => index=4
137+
real_bt = data[:, 1] # col=2 => index=1
138+
diff = predict_sec - real_bt
133139

134140
plt.plot(x, diff, marker='o', label=ENV_NAMES[i])
135141

136142
plt.legend(loc="best")
137143
plt.grid(True)
138-
outdiff = f"{label_diff}.png"
139-
plt.savefig(outdiff, dpi=150)
144+
outfile_diff = f"{label_diff}.png"
145+
plt.savefig(outfile_diff, dpi=150)
140146
plt.close()
141-
print(f"Created {outdiff}")
147+
print(f"Created {outfile_diff}")
142148

143-
print("Done! All plots generated including difference (predict - real_boot_time).")
149+
print("Done! Generated 10 standard plots (cols=2..11) + 1 difference plot (predict - real).")
144150

145151
if __name__ == "__main__":
146152
main()

statistic/ns_per_call.png

-66.2 KB
Binary file not shown.
-100 KB
Binary file not shown.

statistic/percentage.png

113 KB
Loading
-100 KB
Binary file not shown.

statistic/predict_boot_time.png

97.9 KB
Loading

0 commit comments

Comments
 (0)