From 5a54ffe14aa963c001ae0c57f7b16f335387137c Mon Sep 17 00:00:00 2001 From: BoulderBadgeDad Date: Sat, 27 Jun 2026 13:42:14 -0700 Subject: [PATCH] dashboard: show SoulSync's own RAM next to system memory % MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the Memory Usage stat showed only global system memory (psutil.virtual_memory().percent). add the process's own resident set size (RSS) — the real 'how much RAM SoulSync uses' number — formatted MB under 1GB, GB above. headline stays the system %, subtitle now reads 'SoulSync · 612 MB' instead of the generic 'Current usage'. graceful fallback if psutil errors / older backend. useful context after the recent RAM-footprint discussions. --- web_server.py | 11 +++++++++-- webui/static/api-monitor.js | 4 +++- webui/static/core.js | 5 ++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/web_server.py b/web_server.py index 09614540..a6007bc8 100644 --- a/web_server.py +++ b/web_server.py @@ -2837,9 +2837,15 @@ def _build_system_stats(): uptime_seconds = time.time() - start_time uptime = str(timedelta(seconds=int(uptime_seconds))) - # Get memory usage + # Get memory usage — global system %, plus SoulSync's own resident memory (RSS), + # so the dashboard can show "system load" and "how much RAM SoulSync itself uses". memory = psutil.virtual_memory() memory_usage = f"{memory.percent}%" + try: + _proc_rss_mb = psutil.Process(os.getpid()).memory_info().rss / (1024 * 1024) + process_memory = f"{_proc_rss_mb:.0f} MB" if _proc_rss_mb < 1024 else f"{_proc_rss_mb / 1024:.1f} GB" + except Exception: + process_memory = None # Count active downloads from download_batches (batches that are currently downloading) active_downloads = len([batch_id for batch_id, batch_data in download_batches.items() @@ -2917,7 +2923,8 @@ def _build_system_stats(): 'download_speed': download_speed_str, 'active_syncs': active_syncs, 'uptime': uptime, - 'memory_usage': memory_usage + 'memory_usage': memory_usage, + 'process_memory': process_memory } @app.route('/api/system/stats') diff --git a/webui/static/api-monitor.js b/webui/static/api-monitor.js index 36e09242..14ced632 100644 --- a/webui/static/api-monitor.js +++ b/webui/static/api-monitor.js @@ -893,7 +893,9 @@ async function fetchAndUpdateSystemStats() { updateStatCard('download-speed-card', data.download_speed, 'Combined speed'); updateStatCard('active-syncs-card', data.active_syncs, 'Playlists syncing'); updateStatCard('uptime-card', data.uptime, 'Application runtime'); - updateStatCard('memory-card', data.memory_usage, 'Current usage'); + // system memory % headline + SoulSync's own RSS in the subtitle (#935 follow-up) + updateStatCard('memory-card', data.memory_usage, + data.process_memory ? `SoulSync · ${data.process_memory}` : 'Current usage'); } catch (error) { console.warn('Could not fetch system stats:', error); diff --git a/webui/static/core.js b/webui/static/core.js index a6b0f0f9..aad4f6c6 100644 --- a/webui/static/core.js +++ b/webui/static/core.js @@ -687,7 +687,10 @@ function handleDashboardStats(data) { updateStatCard('download-speed-card', data.download_speed, 'Combined speed'); updateStatCard('active-syncs-card', data.active_syncs, 'Playlists syncing'); updateStatCard('uptime-card', data.uptime, 'Application runtime'); - updateStatCard('memory-card', data.memory_usage, 'Current usage'); + // Headline is system memory %; subtitle shows SoulSync's own RSS so users can see the + // app's actual footprint (falls back to the generic label on older backends). + updateStatCard('memory-card', data.memory_usage, + data.process_memory ? `SoulSync · ${data.process_memory}` : 'Current usage'); } function handleDashboardActivity(data) {