Snej69420 9 месяцев назад
Родитель
Сommit
52d31a4a54
1 измененных файлов с 9 добавлено и 7 удалено
  1. 9 7
      benchmarks/compareMemory.py

+ 9 - 7
benchmarks/compareMemory.py

@@ -115,7 +115,7 @@ def plot_traces(files, unit="MB", path="", name="", title=None, bw=False):
         df = process_data(df, unit)
 
         color, linestyle = next(style_cycle)
-        label = Path(file).stem
+        label = file.stem + " " + SIMULATOR_MAPPING[file.parent.name]
 
         plt.plot(
             df["relative_time"],
@@ -150,14 +150,16 @@ def plot_traces(files, unit="MB", path="", name="", title=None, bw=False):
     plt.grid(True, linestyle=':', alpha=0.6)
 
     # Save output
-    output_path = Path(path)
-    # Ensure directory exists
-    if output_path.parent != Path('.'):
-        output_path.parent.mkdir(parents=True, exist_ok=True)
+    script_dir = Path(__file__).resolve().parent
+    output_dir = script_dir / "MemoryPlots"
+    if path:
+        output_dir = output_dir / path
+    output_dir.mkdir(parents=True, exist_ok=True)
+    output_file = output_dir / f"{final_name}.png"
 
     plt.tight_layout()
-    plt.savefig(output_path, dpi=300)
-    print(f"Saved plot to {output_path / final_name}")
+    plt.savefig(output_file, dpi=300)
+    print(f"Saved plot to {output_file}")
 
 
 def main():