Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
9c083068
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9c083068
编写于
10月 24, 2019
作者:
M
Michael Woerister
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
self-profiling: Switch query-blocking measurements to RAII-style API.
上级
ee1173a8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
21 deletion
+19
-21
src/librustc/ty/query/plumbing.rs
src/librustc/ty/query/plumbing.rs
+12
-2
src/librustc/util/profiling.rs
src/librustc/util/profiling.rs
+7
-19
未找到文件。
src/librustc/ty/query/plumbing.rs
浏览文件 @
9c083068
...
...
@@ -90,6 +90,10 @@ pub(super) fn try_get(tcx: TyCtxt<'tcx>, span: Span, key: &Q::Key) -> TryGetJob<
}
return
TryGetJob
::
JobCompleted
(
result
);
}
#[cfg(parallel_compiler)]
let
query_blocked_prof_timer
;
let
job
=
match
lock
.active
.entry
((
*
key
)
.clone
())
{
Entry
::
Occupied
(
entry
)
=>
{
match
*
entry
.get
()
{
...
...
@@ -98,7 +102,9 @@ pub(super) fn try_get(tcx: TyCtxt<'tcx>, span: Span, key: &Q::Key) -> TryGetJob<
// in another thread has completed. Record how long we wait in the
// self-profiler.
#[cfg(parallel_compiler)]
tcx
.prof
.query_blocked_start
(
Q
::
NAME
);
{
query_blocked_prof_timer
=
tcx
.prof
.query_blocked
(
Q
::
NAME
);
}
job
.clone
()
},
...
...
@@ -140,7 +146,11 @@ pub(super) fn try_get(tcx: TyCtxt<'tcx>, span: Span, key: &Q::Key) -> TryGetJob<
#[cfg(parallel_compiler)]
{
let
result
=
job
.r
#
await
(
tcx
,
span
);
tcx
.prof
.query_blocked_end
(
Q
::
NAME
);
// This `drop()` is not strictly necessary as the binding
// would go out of scope anyway. But it's good to have an
// explicit marker of how far the measurement goes.
drop
(
query_blocked_prof_timer
);
if
let
Err
(
cycle
)
=
result
{
return
TryGetJob
::
Cycle
(
Q
::
handle_cycle_error
(
tcx
,
cycle
));
...
...
src/librustc/util/profiling.rs
浏览文件 @
9c083068
...
...
@@ -156,26 +156,14 @@ pub fn query_cache_hit(&self, query_name: QueryName) {
}
/// Start profiling a query being blocked on a concurrent execution.
/// Profiling continues until `query_blocked_end` is called.
/// Profiling continues until the TimingGuard returned from this call is
/// dropped.
#[inline(always)]
pub
fn
query_blocked_start
(
&
self
,
query_name
:
QueryName
)
{
self
.non_guard_query_event
(
|
profiler
|
profiler
.query_blocked_event_kind
,
query_name
,
EventFilter
::
QUERY_BLOCKED
,
TimestampKind
::
Start
,
);
}
/// End profiling a query being blocked on a concurrent execution.
#[inline(always)]
pub
fn
query_blocked_end
(
&
self
,
query_name
:
QueryName
)
{
self
.non_guard_query_event
(
|
profiler
|
profiler
.query_blocked_event_kind
,
query_name
,
EventFilter
::
QUERY_BLOCKED
,
TimestampKind
::
End
,
);
pub
fn
query_blocked
(
&
self
,
query_name
:
QueryName
)
->
TimingGuard
<
'_
>
{
self
.exec
(
EventFilter
::
QUERY_BLOCKED
,
|
profiler
|
{
let
event_id
=
SelfProfiler
::
get_query_name_string_id
(
query_name
);
TimingGuard
::
start
(
profiler
,
profiler
.query_blocked_event_kind
,
event_id
)
})
}
/// Start profiling how long it takes to load a query result from the
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录