Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
8adebab9
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8adebab9
编写于
3月 07, 2016
作者:
J
Jonathon Marolf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
do not use correlatio id as VsTelemetry will insert a session ID automatically.
上级
7d5969ba
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
39 addition
and
70 deletion
+39
-70
src/Workspaces/Core/Portable/LinkedFileDiffMerging/LinkedFileDiffMergingLogger.cs
...able/LinkedFileDiffMerging/LinkedFileDiffMergingLogger.cs
+39
-70
未找到文件。
src/Workspaces/Core/Portable/LinkedFileDiffMerging/LinkedFileDiffMergingLogger.cs
浏览文件 @
8adebab9
...
@@ -11,8 +11,7 @@ namespace Microsoft.CodeAnalysis
...
@@ -11,8 +11,7 @@ namespace Microsoft.CodeAnalysis
{
{
internal
class
LinkedFileDiffMergingLogger
internal
class
LinkedFileDiffMergingLogger
{
{
private
const
string
Id
=
nameof
(
Id
);
private
static
LogAggregator
LogAggregator
=
new
LogAggregator
();
private
static
ConcurrentDictionary
<
int
,
LogAggregator
>
LogAggregators
=
new
ConcurrentDictionary
<
int
,
LogAggregator
>();
internal
enum
MergeInfo
internal
enum
MergeInfo
{
{
...
@@ -31,98 +30,70 @@ internal static void LogSession(Workspace workspace, LinkedFileDiffMergingSessio
...
@@ -31,98 +30,70 @@ internal static void LogSession(Workspace workspace, LinkedFileDiffMergingSessio
{
{
if
(
sessionInfo
.
LinkedFileGroups
.
Count
>
1
)
if
(
sessionInfo
.
LinkedFileGroups
.
Count
>
1
)
{
{
int
correlationId
=
GetCorrelationId
(
workspace
);
LogNewSessionWithLinkedFiles
();
LogNumberOfLinkedFileGroupsProcessed
(
sessionInfo
.
LinkedFileGroups
.
Count
);
LogNewSessionWithLinkedFiles
(
correlationId
);
LogNumberOfLinkedFileGroupsProcessed
(
correlationId
,
sessionInfo
.
LinkedFileGroups
.
Count
);
foreach
(
var
groupInfo
in
sessionInfo
.
LinkedFileGroups
)
foreach
(
var
groupInfo
in
sessionInfo
.
LinkedFileGroups
)
{
{
LogNumberOfIdenticalDiffs
(
correlationId
,
groupInfo
.
IdenticalDiffs
);
LogNumberOfIdenticalDiffs
(
groupInfo
.
IdenticalDiffs
);
LogNumberOfIsolatedDiffs
(
correlationId
,
groupInfo
.
IsolatedDiffs
);
LogNumberOfIsolatedDiffs
(
groupInfo
.
IsolatedDiffs
);
LogNumberOfOverlappingDistinctDiffs
(
correlationId
,
groupInfo
.
OverlappingDistinctDiffs
);
LogNumberOfOverlappingDistinctDiffs
(
groupInfo
.
OverlappingDistinctDiffs
);
LogNumberOfOverlappingDistinctDiffsWithSameSpan
(
correlationId
,
groupInfo
.
OverlappingDistinctDiffsWithSameSpan
);
LogNumberOfOverlappingDistinctDiffsWithSameSpan
(
groupInfo
.
OverlappingDistinctDiffsWithSameSpan
);
LogNumberOfOverlappingDistinctDiffsWithSameSpanAndSubstringRelation
(
correlationId
,
groupInfo
.
OverlappingDistinctDiffsWithSameSpanAndSubstringRelation
);
LogNumberOfOverlappingDistinctDiffsWithSameSpanAndSubstringRelation
(
groupInfo
.
OverlappingDistinctDiffsWithSameSpanAndSubstringRelation
);
LogNumberOfInsertedMergeConflictComments
(
correlationId
,
groupInfo
.
InsertedMergeConflictComments
);
LogNumberOfInsertedMergeConflictComments
(
groupInfo
.
InsertedMergeConflictComments
);
LogNumberOfInsertedMergeConflictCommentsAtAdjustedLocation
(
correlationId
,
groupInfo
.
InsertedMergeConflictCommentsAtAdjustedLocation
);
LogNumberOfInsertedMergeConflictCommentsAtAdjustedLocation
(
groupInfo
.
InsertedMergeConflictCommentsAtAdjustedLocation
);
if
(
groupInfo
.
InsertedMergeConflictComments
>
0
||
if
(
groupInfo
.
InsertedMergeConflictComments
>
0
||
groupInfo
.
InsertedMergeConflictCommentsAtAdjustedLocation
>
0
)
groupInfo
.
InsertedMergeConflictCommentsAtAdjustedLocation
>
0
)
{
{
Logger
.
Log
(
FunctionId
.
Workspace_Solution_LinkedFileDiffMergingSession_LinkedFileGroup
,
SessionLogMessage
.
Create
(
correlationId
,
groupInfo
));
Logger
.
Log
(
FunctionId
.
Workspace_Solution_LinkedFileDiffMergingSession_LinkedFileGroup
,
SessionLogMessage
.
Create
(
groupInfo
));
}
}
}
}
}
}
}
}
private
static
int
GetCorrelationId
(
Workspace
workspace
)
private
static
void
LogNewSessionWithLinkedFiles
()
=>
{
Log
((
int
)
MergeInfo
.
SessionsWithLinkedFiles
,
1
);
int
correlationId
=
workspace
.
GetHashCode
();
if
(!
LogAggregators
.
Keys
.
Contains
(
correlationId
))
{
LogAggregators
.
TryAdd
(
correlationId
,
new
LogAggregator
());
}
return
correlationId
;
}
private
static
void
LogNewSessionWithLinkedFiles
(
int
correlationId
)
=>
Log
(
correlationId
,
(
int
)
MergeInfo
.
SessionsWithLinkedFiles
,
1
);
private
static
void
LogNumberOfLinkedFileGroupsProcessed
(
int
correlationId
,
int
linkedFileGroupsProcessed
)
=>
Log
(
correlationId
,
(
int
)
MergeInfo
.
LinkedFileGroupsProcessed
,
linkedFileGroupsProcessed
);
private
static
void
LogNumberOf
IdenticalDiffs
(
int
correlationId
,
int
identicalDiffs
)
=>
private
static
void
LogNumberOf
LinkedFileGroupsProcessed
(
int
linkedFileGroupsProcessed
)
=>
Log
(
correlationId
,
(
int
)
MergeInfo
.
IdenticalDiffs
,
identicalDiffs
);
Log
(
(
int
)
MergeInfo
.
LinkedFileGroupsProcessed
,
linkedFileGroupsProcessed
);
private
static
void
LogNumberOfI
solatedDiffs
(
int
correlationId
,
int
isolated
Diffs
)
=>
private
static
void
LogNumberOfI
denticalDiffs
(
int
identical
Diffs
)
=>
Log
(
correlationId
,
(
int
)
MergeInfo
.
IsolatedDiffs
,
isolated
Diffs
);
Log
(
(
int
)
MergeInfo
.
IdenticalDiffs
,
identical
Diffs
);
private
static
void
LogNumberOf
OverlappingDistinctDiffs
(
int
correlationId
,
int
overlappingDistinct
Diffs
)
=>
private
static
void
LogNumberOf
IsolatedDiffs
(
int
isolated
Diffs
)
=>
Log
(
correlationId
,
(
int
)
MergeInfo
.
OverlappingDistinctDiffs
,
overlappingDistinct
Diffs
);
Log
(
(
int
)
MergeInfo
.
IsolatedDiffs
,
isolated
Diffs
);
private
static
void
LogNumberOfOverlappingDistinctDiffs
WithSameSpan
(
int
correlationId
,
int
overlappingDistinctDiffsWithSameSpan
)
=>
private
static
void
LogNumberOfOverlappingDistinctDiffs
(
int
overlappingDistinctDiffs
)
=>
Log
(
correlationId
,
(
int
)
MergeInfo
.
OverlappingDistinctDiffsWithSameSpan
,
overlappingDistinctDiffsWithSameSpan
);
Log
(
(
int
)
MergeInfo
.
OverlappingDistinctDiffs
,
overlappingDistinctDiffs
);
private
static
void
LogNumberOfOverlappingDistinctDiffsWithSameSpan
AndSubstringRelation
(
int
correlationId
,
int
overlappingDistinctDiffsWithSameSpanAndSubstringRelatio
n
)
=>
private
static
void
LogNumberOfOverlappingDistinctDiffsWithSameSpan
(
int
overlappingDistinctDiffsWithSameSpa
n
)
=>
Log
(
correlationId
,
(
int
)
MergeInfo
.
OverlappingDistinctDiffsWithSameSpanAndSubstringRelation
,
overlappingDistinctDiffsWithSameSpanAndSubstringRelatio
n
);
Log
(
(
int
)
MergeInfo
.
OverlappingDistinctDiffsWithSameSpan
,
overlappingDistinctDiffsWithSameSpa
n
);
private
static
void
LogNumberOf
InsertedMergeConflictComments
(
int
correlationId
,
int
insertedMergeConflictComments
)
=>
private
static
void
LogNumberOf
OverlappingDistinctDiffsWithSameSpanAndSubstringRelation
(
int
overlappingDistinctDiffsWithSameSpanAndSubstringRelation
)
=>
Log
(
correlationId
,
(
int
)
MergeInfo
.
InsertedMergeConflictComments
,
insertedMergeConflictComments
);
Log
(
(
int
)
MergeInfo
.
OverlappingDistinctDiffsWithSameSpanAndSubstringRelation
,
overlappingDistinctDiffsWithSameSpanAndSubstringRelation
);
private
static
void
LogNumberOfInsertedMergeConflictComments
AtAdjustedLocation
(
int
correlationId
,
int
insertedMergeConflictCommentsAtAdjustedLocation
)
=>
private
static
void
LogNumberOfInsertedMergeConflictComments
(
int
insertedMergeConflictComments
)
=>
Log
(
correlationId
,
(
int
)
MergeInfo
.
InsertedMergeConflictCommentsAtAdjustedLocation
,
insertedMergeConflictCommentsAtAdjustedLocation
);
Log
(
(
int
)
MergeInfo
.
InsertedMergeConflictComments
,
insertedMergeConflictComments
);
private
static
void
Log
(
int
correlationId
,
int
mergeInfo
,
int
count
)
private
static
void
LogNumberOfInsertedMergeConflictCommentsAtAdjustedLocation
(
int
insertedMergeConflictCommentsAtAdjustedLocation
)
=>
{
Log
((
int
)
MergeInfo
.
InsertedMergeConflictCommentsAtAdjustedLocation
,
insertedMergeConflictCommentsAtAdjustedLocation
);
LogAggregators
[
correlationId
].
IncreaseCountBy
(
mergeInfo
,
count
);
}
internal
static
void
ReportTelemetry
(
int
correlationId
)
private
static
void
Log
(
int
mergeInfo
,
int
count
)
{
{
if
(
LogAggregators
.
ContainsKey
(
correlationId
))
LogAggregator
.
IncreaseCountBy
(
mergeInfo
,
count
);
{
Logger
.
Log
(
FunctionId
.
Workspace_Solution_LinkedFileDiffMergingSession
,
KeyValueLogMessage
.
Create
(
m
=>
{
m
[
Id
]
=
correlationId
;
foreach
(
var
kv
in
LogAggregators
[
correlationId
])
{
var
mergeInfo
=
((
MergeInfo
)
kv
.
Key
).
ToString
(
"f"
);
m
[
mergeInfo
]
=
kv
.
Value
.
GetCount
();
}
}));
LogAggregator
value
;
LogAggregators
.
TryRemove
(
correlationId
,
out
value
);
}
}
}
internal
static
void
ReportTelemetry
()
internal
static
void
ReportTelemetry
()
{
{
foreach
(
var
correlationId
in
LogAggregators
.
Keys
)
Logger
.
Log
(
FunctionId
.
Workspace_Solution_LinkedFileDiffMergingSession
,
KeyValueLogMessage
.
Create
(
m
=>
{
{
ReportTelemetry
(
correlationId
);
foreach
(
var
kv
in
LogAggregator
)
}
{
var
mergeInfo
=
((
MergeInfo
)
kv
.
Key
).
ToString
(
"f"
);
m
[
mergeInfo
]
=
kv
.
Value
.
GetCount
();
}
}));
}
}
private
static
class
SessionLogMessage
private
static
class
SessionLogMessage
...
@@ -130,12 +101,10 @@ private static class SessionLogMessage
...
@@ -130,12 +101,10 @@ private static class SessionLogMessage
private
const
string
LinkedDocuments
=
nameof
(
LinkedDocuments
);
private
const
string
LinkedDocuments
=
nameof
(
LinkedDocuments
);
private
const
string
DocumentsWithChanges
=
nameof
(
DocumentsWithChanges
);
private
const
string
DocumentsWithChanges
=
nameof
(
DocumentsWithChanges
);
public
static
KeyValueLogMessage
Create
(
int
correlationId
,
LinkedFileGroupSessionInfo
groupInfo
)
public
static
KeyValueLogMessage
Create
(
LinkedFileGroupSessionInfo
groupInfo
)
{
{
return
KeyValueLogMessage
.
Create
(
m
=>
return
KeyValueLogMessage
.
Create
(
m
=>
{
{
m
[
Id
]
=
correlationId
;
m
[
LinkedDocuments
]
=
groupInfo
.
LinkedDocuments
;
m
[
LinkedDocuments
]
=
groupInfo
.
LinkedDocuments
;
m
[
DocumentsWithChanges
]
=
groupInfo
.
DocumentsWithChanges
;
m
[
DocumentsWithChanges
]
=
groupInfo
.
DocumentsWithChanges
;
m
[
MergeInfo
.
IdenticalDiffs
.
ToString
(
"f"
)]
=
groupInfo
.
IdenticalDiffs
;
m
[
MergeInfo
.
IdenticalDiffs
.
ToString
(
"f"
)]
=
groupInfo
.
IdenticalDiffs
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录