Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ContextMenuProfiler.UI/Core/BenchmarkService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ public List<BenchmarkResult> RunBenchmark(string targetPath)
return RunSystemBenchmark(ScanMode.Targeted); // Simplified for now
}

public long RunRealShellBenchmark(string? filePath = null) => 0;
public long RunRealShellBenchmark(string? filePath = null) => -1;

private string DetermineCategory(IEnumerable<string> locations)
{
Expand Down
32 changes: 10 additions & 22 deletions ContextMenuProfiler.UI/ViewModels/DashboardViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ private async Task ScanSystem()
_lastScanMode = "System";
StatusText = LocalizationService.Instance["Dashboard.Status.ScanningSystem"];
IsBusy = true;
RealLoadTime = LocalizationService.Instance["Dashboard.RealLoad.Measuring"];

App.Current.Dispatcher.Invoke(() =>
{
Expand Down Expand Up @@ -375,6 +376,9 @@ void TryCompleteUiDrain()
TryCompleteUiDrain();
await uiDrainTcs.Task;

// Ensure summary values are refreshed even if no progress callback was emitted.
UpdateStats();

StatusText = string.Format(LocalizationService.Instance["Dashboard.Status.ScanComplete"], Results.Count);
NotificationService.Instance.ShowSuccess(LocalizationService.Instance["Dashboard.Notify.ScanComplete.Title"], string.Format(LocalizationService.Instance["Dashboard.Notify.ScanComplete.Message"], Results.Count));
}
Expand Down Expand Up @@ -477,8 +481,6 @@ private async Task ScanFile(string filePath)
NotificationService.Instance.ShowSuccess(LocalizationService.Instance["Dashboard.Notify.ScanComplete.Title"], string.Format(LocalizationService.Instance["Dashboard.Notify.ScanCompleteForFile.Message"], results.Count, System.IO.Path.GetFileName(filePath)));
}

// Run Real-World Benchmark (Parallel but after discovery to avoid COM conflicts if any)
await RunRealBenchmark(filePath);
}
catch (Exception ex)
{
Expand All @@ -493,26 +495,6 @@ private async Task ScanFile(string filePath)
}
}

private async Task RunRealBenchmark(string? filePath = null)
{
try
{
long elapsed = await Task.Run(() => _benchmarkService.RunRealShellBenchmark(filePath));
if (elapsed >= 0)
{
RealLoadTime = $"{elapsed} ms";
}
else
{
RealLoadTime = LocalizationService.Instance["Dashboard.RealLoad.Failed"];
}
}
catch
{
RealLoadTime = LocalizationService.Instance["Dashboard.RealLoad.Error"];
}
}

private void ApplyLocalizedCategoryNames()
{
Categories = new ObservableCollection<CategoryItem>
Expand Down Expand Up @@ -721,6 +703,12 @@ private void UpdateStats()
TotalLoadTime = totalTime;
ActiveLoadTime = activeTime;
DisabledLoadTime = disabledTime;

// "Real load" uses wall-clock IPC time when available; fall back to measured COM stage total.
long realLoadMs = Results
.Where(r => r.IsEnabled)
.Sum(r => r.WallClockTime > 0 ? r.WallClockTime : Math.Max(0, r.TotalTime));
RealLoadTime = realLoadMs > 0 ? $"{realLoadMs} ms" : "N/A";
Comment on lines +707 to +711
}
}
}
Loading