Update exporter.py

This commit is contained in:
2026-05-06 10:34:10 +07:00
parent 4049e66428
commit e3aea889dd
+39 -16
View File
@@ -212,41 +212,64 @@ def run_process_test(n, proc_count):
def draw_performance_graph():
n = 10000
proc_counts = list(range(1, 33))
data_sizes = {
"16": 16,
"64": 64,
"256": 256,
}
times = []
proc_counts = list(range(1, 129))
print("\nBenchmarking process count performance:")
for label, n in data_sizes.items():
times = []
print(f"\nTesting N = {n}:")
for p in proc_counts:
t = run_process_test(n, p)
times.append(t)
print(f"Processes: {p:2d} | Time: {t:.6f} sec")
print(f"N={n:3d} | Processes: {p:3d} | Time: {t:.6f} sec")
base_time = times[0]
speedup = [base_time / t if t > 0 else 0 for t in times]
out_path = os.path.join(OUT_DIR, "process_performance.png")
out_path = os.path.join(
OUT_DIR,
f"performance_N{n}.png",
)
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 6))
fig, (ax1, ax2) = plt.subplots(
1,
2,
figsize=(14, 6),
)
# -------------------------
# TIME GRAPH
# -------------------------
# --------------------------------
# EXECUTION TIME
# --------------------------------
ax1.plot(proc_counts, times, "o-")
ax1.set_xlabel("Количество процессов")
ax1.set_ylabel("Время (сек)")
ax1.set_title("Время выполнения")
ax1.set_title(f"Время выполнения (N = {n})")
ax1.grid(True)
# -------------------------
# SPEEDUP GRAPH
# -------------------------
# --------------------------------
# SPEEDUP
# --------------------------------
ax2.plot(
proc_counts,
speedup,
"s-",
label="Реальное ускорение",
)
ax2.plot(proc_counts, speedup, "s-", label="Реальное ускорение")
ax2.plot(
proc_counts,
proc_counts,
@@ -258,7 +281,7 @@ def draw_performance_graph():
ax2.set_xlabel("Количество процессов")
ax2.set_ylabel("Ускорение")
ax2.set_title("Масштабируемость")
ax2.set_title(f"Масштабируемость (N = {n})")
ax2.legend()
ax2.grid(True)
@@ -266,7 +289,7 @@ def draw_performance_graph():
plt.savefig(out_path)
plt.close()
print(f"\nPerformance graph saved to: {out_path}")
print(f"Saved: {out_path}")
def main():