/
AnalyzerTelemetry.cs
174 lines (146 loc) · 6.35 KB
/
AnalyzerTelemetry.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.Serialization;
namespace Microsoft.CodeAnalysis.Diagnostics.Telemetry
{
/// <summary>
/// Contains telemetry info for a specific analyzer, such as count of registered actions, the total execution time, etc.
/// </summary>
[DataContract]
public sealed class AnalyzerTelemetryInfo
{
/// <summary>
/// Count of registered compilation start actions.
/// </summary>
[DataMember(Order = 0)]
public int CompilationStartActionsCount { get; set; }
/// <summary>
/// Count of registered compilation end actions.
/// </summary>
[DataMember(Order = 1)]
public int CompilationEndActionsCount { get; set; }
/// <summary>
/// Count of registered compilation actions.
/// </summary>
[DataMember(Order = 2)]
public int CompilationActionsCount { get; set; }
/// <summary>
/// Count of registered syntax tree actions.
/// </summary>
[DataMember(Order = 3)]
public int SyntaxTreeActionsCount { get; set; }
/// <summary>
/// Count of registered additional file actions.
/// </summary>
[DataMember(Order = 4)]
public int AdditionalFileActionsCount { get; set; }
/// <summary>
/// Count of registered semantic model actions.
/// </summary>
[DataMember(Order = 5)]
public int SemanticModelActionsCount { get; set; }
/// <summary>
/// Count of registered symbol actions.
/// </summary>
[DataMember(Order = 6)]
public int SymbolActionsCount { get; set; }
/// <summary>
/// Count of registered symbol start actions.
/// </summary>
[DataMember(Order = 7)]
public int SymbolStartActionsCount { get; set; }
/// <summary>
/// Count of registered symbol end actions.
/// </summary>
[DataMember(Order = 8)]
public int SymbolEndActionsCount { get; set; }
/// <summary>
/// Count of registered syntax node actions.
/// </summary>
[DataMember(Order = 9)]
public int SyntaxNodeActionsCount { get; set; }
/// <summary>
/// Count of registered code block start actions.
/// </summary>
[DataMember(Order = 10)]
public int CodeBlockStartActionsCount { get; set; }
/// <summary>
/// Count of registered code block end actions.
/// </summary>
[DataMember(Order = 11)]
public int CodeBlockEndActionsCount { get; set; }
/// <summary>
/// Count of registered code block actions.
/// </summary>
[DataMember(Order = 12)]
public int CodeBlockActionsCount { get; set; }
/// <summary>
/// Count of registered operation actions.
/// </summary>
[DataMember(Order = 13)]
public int OperationActionsCount { get; set; }
/// <summary>
/// Count of registered operation block start actions.
/// </summary>
[DataMember(Order = 14)]
public int OperationBlockStartActionsCount { get; set; }
/// <summary>
/// Count of registered operation block end actions.
/// </summary>
[DataMember(Order = 15)]
public int OperationBlockEndActionsCount { get; set; }
/// <summary>
/// Count of registered operation block actions.
/// </summary>
[DataMember(Order = 16)]
public int OperationBlockActionsCount { get; set; }
/// <summary>
/// Count of registered suppression actions.
/// This is the same as count of <see cref="DiagnosticSuppressor"/>s as each suppressor
/// has a single suppression action, i.e. <see cref="DiagnosticSuppressor.ReportSuppressions(SuppressionAnalysisContext)"/>.
/// </summary>
[DataMember(Order = 17)]
public int SuppressionActionsCount { get; set; }
/// <summary>
/// Total execution time.
/// </summary>
[DataMember(Order = 18)]
public TimeSpan ExecutionTime { get; set; } = TimeSpan.Zero;
/// <summary>
/// Gets a value indicating whether the analyzer supports concurrent execution.
/// </summary>
[DataMember(Order = 19)]
public bool Concurrent { get; set; }
internal AnalyzerTelemetryInfo(AnalyzerActionCounts actionCounts, int suppressionActionCounts, TimeSpan executionTime)
{
CompilationStartActionsCount = actionCounts.CompilationStartActionsCount;
CompilationEndActionsCount = actionCounts.CompilationEndActionsCount;
CompilationActionsCount = actionCounts.CompilationActionsCount;
SyntaxTreeActionsCount = actionCounts.SyntaxTreeActionsCount;
AdditionalFileActionsCount = actionCounts.AdditionalFileActionsCount;
SemanticModelActionsCount = actionCounts.SemanticModelActionsCount;
SymbolActionsCount = actionCounts.SymbolActionsCount;
SymbolStartActionsCount = actionCounts.SymbolStartActionsCount;
SymbolEndActionsCount = actionCounts.SymbolEndActionsCount;
SyntaxNodeActionsCount = actionCounts.SyntaxNodeActionsCount;
CodeBlockStartActionsCount = actionCounts.CodeBlockStartActionsCount;
CodeBlockEndActionsCount = actionCounts.CodeBlockEndActionsCount;
CodeBlockActionsCount = actionCounts.CodeBlockActionsCount;
OperationActionsCount = actionCounts.OperationActionsCount;
OperationBlockStartActionsCount = actionCounts.OperationBlockStartActionsCount;
OperationBlockEndActionsCount = actionCounts.OperationBlockEndActionsCount;
OperationBlockActionsCount = actionCounts.OperationBlockActionsCount;
SuppressionActionsCount = suppressionActionCounts;
ExecutionTime = executionTime;
Concurrent = actionCounts.Concurrent;
}
/// <summary>
/// Create telemetry info for a specific analyzer, such as count of registered actions, the total execution time, etc.
/// </summary>
public AnalyzerTelemetryInfo()
{
}
}
}