Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
f81bc371
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f81bc371
编写于
10月 29, 2020
作者:
K
Kaushik Iska
提交者:
GitHub
10月 29, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[profiling] Handle thread_info to account for killed threads (#22170)
Fixes:
https://github.com/flutter/flutter/issues/63025
上级
ce1dd11f
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
22 addition
and
8 deletion
+22
-8
shell/platform/darwin/ios/framework/Source/profiler_metrics_ios.mm
...tform/darwin/ios/framework/Source/profiler_metrics_ios.mm
+22
-8
未找到文件。
shell/platform/darwin/ios/framework/Source/profiler_metrics_ios.mm
浏览文件 @
f81bc371
...
...
@@ -168,6 +168,7 @@ std::optional<CpuUsageInfo> ProfilerMetricsIOS::CpuUsage() {
}
double
total_cpu_usage
=
0.0
;
uint32_t
num_threads
=
mach_threads
.
thread_count
;
// Add the CPU usage for each thread. It should be noted that there may be some CPU usage missing
// from this calculation. If a thread ends between calls to this routine, then its info will be
...
...
@@ -182,17 +183,30 @@ std::optional<CpuUsageInfo> ProfilerMetricsIOS::CpuUsage() {
kernel_return_code
=
thread_info
(
mach_threads
.
threads
[
i
],
THREAD_BASIC_INFO
,
reinterpret_cast
<
thread_info_t
>
(
&
basic_thread_info
),
&
thread_info_count
);
if
(
kernel_return_code
!=
KERN_SUCCESS
)
{
switch
(
kernel_return_code
)
{
case
KERN_SUCCESS
:
{
const
double
current_thread_cpu_usage
=
basic_thread_info
.
cpu_usage
/
static_cast
<
float
>
(
TH_USAGE_SCALE
);
total_cpu_usage
+=
current_thread_cpu_usage
;
break
;
}
case
MACH_SEND_TIMEOUT
:
case
MACH_SEND_TIMED_OUT
:
case
MACH_SEND_INVALID_DEST
:
// Ignore as this thread been destroyed. The possible return codes are not really well
// documented. This handling is inspired from the following sources:
// - https://opensource.apple.com/source/xnu/xnu-4903.221.2/tests/task_inspect.c.auto.html
// - https://github.com/apple/swift-corelibs-libdispatch/blob/main/src/queue.c#L6617
num_threads
--
;
break
;
default:
FML_LOG
(
ERROR
)
<<
"Error retrieving thread information: "
<<
mach_error_string
(
kernel_return_code
);
return
std
::
nullopt
;
}
const
double
current_thread_cpu_usage
=
basic_thread_info
.
cpu_usage
/
static_cast
<
float
>
(
TH_USAGE_SCALE
);
total_cpu_usage
+=
current_thread_cpu_usage
;
}
flutter
::
CpuUsageInfo
cpu_usage_info
=
{.
num_threads
=
mach_threads
.
thread_count
,
flutter
::
CpuUsageInfo
cpu_usage_info
=
{.
num_threads
=
num_threads
,
.
total_cpu_usage
=
total_cpu_usage
*
100.0
};
return
cpu_usage_info
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录