Prechádzať zdrojové kódy

Updated y axis label

Snej69420 4 mesiacov pred
rodič
commit
5fd997d03d
1 zmenil súbory, kde vykonal 3 pridanie a 33 odobranie
  1. 3 33
      benchmarks/compareMemory.py

+ 3 - 33
benchmarks/compareMemory.py

@@ -51,38 +51,8 @@ def get_style_config(user_input):
     key = SHORTHANDS.get(normalized, normalized)
     return PREDEFINED_STYLES.get(key, PREDEFINED_STYLES['blue'])
 
-
-def normalize_database(db_path):
-    """Normalizes the database so that every process starts at 0 RSS (Net Growth)."""
-    try:
-        with sqlite3.connect(db_path) as conn:
-            cursor = conn.cursor()
-            cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='record';")
-            if not cursor.fetchone(): return
-
-            cursor.execute("PRAGMA table_info(record)")
-            columns = [info[1] for info in cursor.fetchall()]
-
-            if 'raw_rss' not in columns:
-                cursor.execute("ALTER TABLE record ADD COLUMN raw_rss INTEGER")
-                cursor.execute("UPDATE record SET raw_rss = stat_rss")
-                cursor.execute("""
-                               UPDATE record
-                               SET stat_rss = raw_rss - (SELECT r2.raw_rss
-                                                         FROM record r2
-                                                         WHERE r2.stat_pid = record.stat_pid
-                                                         ORDER BY r2.record_id ASC
-                                                         LIMIT 1)
-                               """)
-                conn.commit()
-                print(f"Normalized {db_path.name}: Processes now start at 0 (Net Growth).")
-    except sqlite3.Error as e:
-        print(f"Error normalizing {db_path}: {e}")
-
-
 def get_memory_trace(db_path):
     if not db_path.exists() or db_path.stat().st_size == 0: return None
-    normalize_database(db_path)
     try:
         with sqlite3.connect(db_path) as conn:
             query = "SELECT ts, stat_rss FROM record WHERE stat_comm IN ('python3', 'julia') ORDER BY ts ASC"
@@ -132,7 +102,7 @@ def plot_traces(files, styles, width=None, depth=None, mem_unit="MB", time_unit=
     if not plotted_any: return
 
     plt.xlabel(f"Time ({time_unit})");
-    plt.ylabel(f"Resident Set Size Net Growth ({mem_unit})")
+    plt.ylabel(f"Resident Set Size ({mem_unit})")
 
     if not title:
         if main_model_type and width and depth:
@@ -140,10 +110,10 @@ def plot_traces(files, styles, width=None, depth=None, mem_unit="MB", time_unit=
             atomics = int(props.get("Atomic Models", 0))
             events = int(props.get("Events", 0))
 
-            plt.suptitle(f"Memory Usage over Time (Net Growth): {main_model_type}", fontsize=12)
+            plt.suptitle(f"Memory Usage over Time: {main_model_type}", fontsize=12)
             plt.title(f"Width: {width}, Depth: {depth} | #Atomic Models: {atomics:,} | #Events: {events:,}", fontsize=10)
         else:
-            plt.title("Memory Usage over Time (Net Growth)", fontsize=12)
+            plt.title("Memory Usage over Time", fontsize=12)
     else:
         plt.title(title, fontsize=12)