未验证 提交 44938774 编写于 作者: H Heejae Chang 提交者: GitHub

add more telemetry to track feature performances (#32550)

上级 882f646d
......@@ -9,7 +9,7 @@
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.CodeAnalysis.Editor.Shared.Options;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Notification;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
......@@ -79,9 +79,11 @@ public bool ExecuteCommand(GoToImplementationCommandArgs args, CommandExecutionC
// We have all the cheap stuff, so let's do expensive stuff now
string messageToShow = null;
var userCancellationToken = context.OperationContext.UserCancellationToken;
using (context.OperationContext.AddScope(allowCancellation: true, EditorFeaturesResources.Locating_implementations))
using (Logger.LogBlock(FunctionId.CommandHandler_GoToImplementation, KeyValueLogMessage.Create(LogType.UserAction), userCancellationToken))
{
var userCancellationToken = context.OperationContext.UserCancellationToken;
StreamingGoToImplementation(
document, caretPosition,
streamingService, streamingPresenter,
......
......@@ -348,7 +348,6 @@ private bool IsAnyTypeKind(GraphNode node, params TypeKind[] typeKinds)
public T GetExtension<T>(GraphObject graphObject, T previous) where T : class
{
if (graphObject is GraphNode graphNode)
{
// If this is not a Roslyn node, bail out.
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.FindSymbols;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.VisualStudio.GraphModel;
using Microsoft.VisualStudio.GraphModel.Schemas;
using Microsoft.VisualStudio.Progression;
using Roslyn.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Progression
{
internal sealed class ImplementedByGraphQuery : IGraphQuery
{
public async Task<GraphBuilder> GetGraphAsync(Solution solution, IGraphContext context, CancellationToken cancellationToken)
{
using (Logger.LogBlock(FunctionId.GraphQuery_ImplementedBy, KeyValueLogMessage.Create(LogType.UserAction), cancellationToken))
{
var graphBuilder = await GraphBuilder.CreateForInputNodesAsync(solution, context.InputNodes, cancellationToken).ConfigureAwait(false);
......@@ -41,4 +36,5 @@ public async Task<GraphBuilder> GetGraphAsync(Solution solution, IGraphContext c
return graphBuilder;
}
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.FindSymbols;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.VisualStudio.GraphModel;
using Microsoft.VisualStudio.GraphModel.Schemas;
using Microsoft.VisualStudio.Progression;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Progression
{
internal sealed class ImplementsGraphQuery : IGraphQuery
{
public async Task<GraphBuilder> GetGraphAsync(Solution solution, IGraphContext context, CancellationToken cancellationToken)
{
using (Logger.LogBlock(FunctionId.GraphQuery_Implements, KeyValueLogMessage.Create(LogType.UserAction), cancellationToken))
{
var graphBuilder = await GraphBuilder.CreateForInputNodesAsync(solution, context.InputNodes, cancellationToken).ConfigureAwait(false);
......@@ -39,6 +37,7 @@ public async Task<GraphBuilder> GetGraphAsync(Solution solution, IGraphContext c
return graphBuilder;
}
}
private static async Task AddImplementedSymbolsAsync(GraphBuilder graphBuilder, GraphNode node, IEnumerable<ISymbol> implementedSymbols)
{
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.FindSymbols;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.VisualStudio.GraphModel;
using Microsoft.VisualStudio.GraphModel.CodeSchema;
using Microsoft.VisualStudio.GraphModel.Schemas;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Progression
......@@ -18,6 +14,8 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.Progression
internal sealed class IsCalledByGraphQuery : IGraphQuery
{
public async Task<GraphBuilder> GetGraphAsync(Solution solution, IGraphContext context, CancellationToken cancellationToken)
{
using (Logger.LogBlock(FunctionId.GraphQuery_IsCalledBy, KeyValueLogMessage.Create(LogType.UserAction), cancellationToken))
{
var graphBuilder = await GraphBuilder.CreateForInputNodesAsync(solution, context.InputNodes, cancellationToken).ConfigureAwait(false);
......@@ -39,4 +37,5 @@ public async Task<GraphBuilder> GetGraphAsync(Solution solution, IGraphContext c
return graphBuilder;
}
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.FindSymbols;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.VisualStudio.GraphModel;
using Microsoft.VisualStudio.GraphModel.CodeSchema;
using Microsoft.VisualStudio.GraphModel.Schemas;
......@@ -18,6 +15,8 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.Progression
internal sealed class IsUsedByGraphQuery : IGraphQuery
{
public async Task<GraphBuilder> GetGraphAsync(Solution solution, IGraphContext context, CancellationToken cancellationToken)
{
using (Logger.LogBlock(FunctionId.GraphQuery_IsUsedBy, KeyValueLogMessage.Create(LogType.UserAction), cancellationToken))
{
var graphBuilder = await GraphBuilder.CreateForInputNodesAsync(solution, context.InputNodes, cancellationToken).ConfigureAwait(false);
......@@ -44,6 +43,7 @@ public async Task<GraphBuilder> GetGraphAsync(Solution solution, IGraphContext c
return graphBuilder;
}
}
internal GraphNode GetLocationNode(ISymbol symbol, Location location, IGraphContext context, ProjectId projectId, CancellationToken cancellationToken)
{
......
......@@ -4,6 +4,7 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.FindSymbols;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.VisualStudio.GraphModel;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Progression
......@@ -11,6 +12,8 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.Progression
internal sealed class OverridesGraphQuery : IGraphQuery
{
public async Task<GraphBuilder> GetGraphAsync(Solution solution, IGraphContext context, CancellationToken cancellationToken)
{
using (Logger.LogBlock(FunctionId.GraphQuery_Overrides, KeyValueLogMessage.Create(LogType.UserAction), cancellationToken))
{
var graphBuilder = await GraphBuilder.CreateForInputNodesAsync(solution, context.InputNodes, cancellationToken).ConfigureAwait(false);
......@@ -31,4 +34,5 @@ public async Task<GraphBuilder> GetGraphAsync(Solution solution, IGraphContext c
return graphBuilder;
}
}
}
}
......@@ -445,5 +445,11 @@ internal enum FunctionId
SyntaxTreeIndex_Precalculate_Create,
SymbolTreeInfo_Create,
SymbolTreeInfo_TryLoadOrCreate,
CommandHandler_GoToImplementation,
GraphQuery_ImplementedBy,
GraphQuery_Implements,
GraphQuery_IsCalledBy,
GraphQuery_IsUsedBy,
GraphQuery_Overrides,
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册