Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
5fddfc48
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,发现更多精彩内容 >>
提交
5fddfc48
编写于
1月 16, 2020
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Track the number of bytes allocated per edit
上级
e9f4524a
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
14 addition
and
9 deletion
+14
-9
src/Tools/AnalyzerRunner/DiagnosticAnalyzerRunner.cs
src/Tools/AnalyzerRunner/DiagnosticAnalyzerRunner.cs
+8
-9
src/Tools/AnalyzerRunner/PerformanceTracker.cs
src/Tools/AnalyzerRunner/PerformanceTracker.cs
+6
-0
未找到文件。
src/Tools/AnalyzerRunner/DiagnosticAnalyzerRunner.cs
浏览文件 @
5fddfc48
...
...
@@ -98,7 +98,7 @@ public async Task RunAsync(Workspace workspace, CancellationToken cancellationTo
}
var
currentDocumentPerformance
=
await
TestDocumentPerformanceAsync
(
_analyzers
,
project
,
documentId
,
_options
,
cancellationToken
).
ConfigureAwait
(
false
);
Console
.
WriteLine
(
$"
{
document
.
FilePath
??
document
.
Name
}
:
{
currentDocumentPerformance
.
EditsPerSecond
:
0.00
}
"
);
Console
.
WriteLine
(
$"
{
document
.
FilePath
??
document
.
Name
}
:
{
currentDocumentPerformance
.
EditsPerSecond
:
0.00
}
(
{
currentDocumentPerformance
.
AllocatedBytesPerEdit
}
bytes)
"
);
documentPerformance
.
Add
(
documentId
,
currentDocumentPerformance
);
}
...
...
@@ -118,7 +118,7 @@ public async Task RunAsync(Workspace workspace, CancellationToken cancellationTo
foreach
(
var
pair
in
projectGroup
.
Take
(
5
))
{
var
document
=
solution
.
GetDocument
(
pair
.
Key
);
Console
.
WriteLine
(
$"
{
document
.
FilePath
??
document
.
Name
}
:
{
pair
.
Value
.
EditsPerSecond
:
0.00
}
"
);
Console
.
WriteLine
(
$"
{
document
.
FilePath
??
document
.
Name
}
:
{
pair
.
Value
.
EditsPerSecond
:
0.00
}
(
{
pair
.
Value
.
AllocatedBytesPerEdit
}
bytes)
"
);
}
}
...
...
@@ -163,7 +163,7 @@ private static async Task<DocumentAnalyzerPerformance> TestDocumentPerformanceAs
Compilation
compilation
=
await
project
.
GetCompilationAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
stopwatch
=
Stopwatch
.
StartNew
();
var
stopwatch
=
PerformanceTracker
.
StartNew
();
for
(
int
i
=
0
;
i
<
analyzerOptionsInternal
.
TestDocumentIterations
;
i
++)
{
var
workspaceAnalyzerOptions
=
new
WorkspaceAnalyzerOptions
(
project
.
AnalyzerOptions
,
project
.
Solution
);
...
...
@@ -174,7 +174,7 @@ private static async Task<DocumentAnalyzerPerformance> TestDocumentPerformanceAs
await
compilationWithAnalyzers
.
GetAnalyzerSemanticDiagnosticsAsync
(
compilation
.
GetSemanticModel
(
tree
),
null
,
cancellationToken
).
ConfigureAwait
(
false
);
}
return
new
DocumentAnalyzerPerformance
(
analyzerOptionsInternal
.
TestDocumentIterations
/
stopwatch
.
Elapsed
.
TotalSeconds
);
return
new
DocumentAnalyzerPerformance
(
analyzerOptionsInternal
.
TestDocumentIterations
/
stopwatch
.
Elapsed
.
TotalSeconds
,
stopwatch
.
AllocatedBytes
/
Math
.
Max
(
1
,
analyzerOptionsInternal
.
TestDocumentIterations
)
);
}
private
static
void
WriteDiagnosticResults
(
ImmutableArray
<
Tuple
<
ProjectId
,
Diagnostic
>>
diagnostics
,
string
fileName
)
...
...
@@ -458,15 +458,14 @@ private static void WriteExecutionTimes(string analyzerName, int longestAnalyzer
private
struct
DocumentAnalyzerPerformance
{
public
DocumentAnalyzerPerformance
(
double
editsPerSecond
)
public
DocumentAnalyzerPerformance
(
double
editsPerSecond
,
long
allocatedBytesPerEdit
)
{
EditsPerSecond
=
editsPerSecond
;
AllocatedBytesPerEdit
=
allocatedBytesPerEdit
;
}
public
double
EditsPerSecond
{
get
;
}
public
double
EditsPerSecond
{
get
;
}
public
long
AllocatedBytesPerEdit
{
get
;
}
}
}
}
src/Tools/AnalyzerRunner/PerformanceTracker.cs
浏览文件 @
5fddfc48
...
...
@@ -33,6 +33,12 @@ public static PerformanceTracker StartNew(bool preciseMemory = true)
public
TimeSpan
Elapsed
=>
_stopwatch
.
Elapsed
;
#if NETCOREAPP
public
long
AllocatedBytes
=>
GC
.
GetTotalAllocatedBytes
(
true
)
-
_initialTotalAllocatedBytes
;
#else
public
long
AllocatedBytes
=>
0
;
#endif
public
string
GetSummary
(
bool
preciseMemory
=
true
)
{
#if NETCOREAPP
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录