Skip to content

Commit c426d1b

Browse files
committed
Add runtime logging to UserProjectsRepository and UserComProjectSynchronizer
1 parent a5b227b commit c426d1b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Rubberduck.Parsing/ComReflection/UserProjectRepository.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using System.Runtime.InteropServices;
55
using NLog;
6+
using Rubberduck.Parsing.Common;
67
using Rubberduck.Parsing.UIContext;
78
using Rubberduck.Parsing.VBA.Extensions;
89
using Rubberduck.VBEditor.ComManagement;
@@ -44,6 +45,8 @@ public ComProject UserProject(string projectId)
4445

4546
public void RefreshUserComProjects(IReadOnlyCollection<string> projectIdsToReload)
4647
{
48+
var parsingStageTimer = ParsingStageTimer.StartNew();
49+
4750
RemoveNoLongerExistingProjects();
4851
RemoveProjects(projectIdsToReload);
4952
var loadTask = _uiDispatcher.StartTask(() =>
@@ -52,6 +55,9 @@ public void RefreshUserComProjects(IReadOnlyCollection<string> projectIdsToReloa
5255
AddLockedProjects();
5356
});
5457
loadTask.Wait();
58+
59+
parsingStageTimer.Stop();
60+
parsingStageTimer.Log("Loaded ComProjects for user projects in {0}ms.");
5561
}
5662

5763
private void RemoveNoLongerExistingProjects()

Rubberduck.Parsing/VBA/DeclarationResolving/UserComProjectSynchronizer.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using System.Linq;
3+
using Rubberduck.Parsing.Common;
34
using Rubberduck.Parsing.ComReflection;
45

56
namespace Rubberduck.Parsing.VBA.DeclarationResolving
@@ -35,6 +36,8 @@ public UserComProjectSynchronizer(
3536

3637
public void SyncUserComProjects()
3738
{
39+
var parsingStateTimer = ParsingStageTimer.StartNew();
40+
3841
_lastSyncLoadedDeclaration = false;
3942
_unloadedProjectIds.Clear();
4043

@@ -46,6 +49,9 @@ public void SyncUserComProjects()
4649

4750
LoadProjects(newProjectIdsToBeLoaded);
4851
UnloadProjects(projectsToBeUndloaded);
52+
53+
parsingStateTimer.Stop();
54+
parsingStateTimer.Log("Loaded declarations from ComProjects for user projects in {0}ms.");
4955
}
5056

5157
private void LoadProjects(IEnumerable<string> projectIds)

0 commit comments

Comments
 (0)