From a7985955b4a745fed9c20d4c25d7a60ce4ac36fb Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 26 Jul 2025 17:02:02 +0100 Subject: [PATCH] Add debug message of how long it took to import ROMs from folder. --- RomRepoMgr/ViewModels/ImportRomFolderViewModel.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/RomRepoMgr/ViewModels/ImportRomFolderViewModel.cs b/RomRepoMgr/ViewModels/ImportRomFolderViewModel.cs index 9277971..b9ad202 100644 --- a/RomRepoMgr/ViewModels/ImportRomFolderViewModel.cs +++ b/RomRepoMgr/ViewModels/ImportRomFolderViewModel.cs @@ -28,10 +28,11 @@ public sealed partial class ImportRomFolderViewModel : ViewModelBase { readonly Context _ctx = Context.Create(Settings.Settings.Current.DatabasePath, new SerilogLoggerFactory(Log.Logger)); - readonly ConcurrentBag _newDisks = []; - readonly ConcurrentBag _newFiles = []; - readonly ConcurrentBag _newMedias = []; - readonly Stopwatch _stopwatch = new(); + readonly Stopwatch _mainStopwatch = new(); + readonly ConcurrentBag _newDisks = []; + readonly ConcurrentBag _newFiles = []; + readonly ConcurrentBag _newMedias = []; + readonly Stopwatch _stopwatch = new(); [ObservableProperty] bool _canChoose; [ObservableProperty] @@ -129,6 +130,7 @@ public sealed partial class ImportRomFolderViewModel : ViewModelBase IsImporting = true; IsReady = false; CanChoose = false; + _mainStopwatch.Start(); _ = Task.Run(() => _rootImporter.FindFiles(FolderPath)); } @@ -264,6 +266,9 @@ public sealed partial class ImportRomFolderViewModel : ViewModelBase IsReady = false; IsImporting = false; StatusMessage = Localization.Finished; + _mainStopwatch.Stop(); + + Log.Debug("Took {TotalSeconds} seconds to import ROMs", _mainStopwatch.Elapsed.TotalSeconds); } void ProcessArchives()