Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
bddbf764
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bddbf764
编写于
11月 21, 2018
作者:
B
Baisheng08
提交者:
Jiangtao Hu
12月 13, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
framekwork: Specify/set scheduling policy/nice for choreography policy. (#1932)
上级
aa84a88f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
32 addition
and
12 deletion
+32
-12
cyber/conf/example_choreagraphy_sched.conf
cyber/conf/example_choreagraphy_sched.conf
+2
-0
cyber/proto/choreography_conf.proto
cyber/proto/choreography_conf.proto
+6
-4
cyber/scheduler/policy/scheduler_choreography.cc
cyber/scheduler/policy/scheduler_choreography.cc
+6
-0
cyber/scheduler/policy/scheduler_choreography.h
cyber/scheduler/policy/scheduler_choreography.h
+3
-1
cyber/scheduler/processor.cc
cyber/scheduler/processor.cc
+14
-7
cyber/scheduler/processor.h
cyber/scheduler/processor.h
+1
-0
未找到文件。
cyber/conf/example_choreagraphy_sched.conf
浏览文件 @
bddbf764
...
...
@@ -12,6 +12,8 @@ scheduler_conf {
pool_processor_num
:
8
pool_affinity
:
"range"
pool_cpuset
:
"16-23"
pool_processor_policy
:
"SCHED_OTHER"
pool_processor_prio
: -
10
tasks
: [
{
...
...
cyber/proto/choreography_conf.proto
浏览文件 @
bddbf764
...
...
@@ -19,11 +19,13 @@ message ChoreographyConf {
optional
uint32
choreography_processor_num
=
1
;
optional
string
choreography_affinity
=
2
;
optional
string
choreography_processor_policy
=
3
;
optional
u
int32
choreography_processor_prio
=
4
;
optional
int32
choreography_processor_prio
=
4
;
optional
string
choreography_cpuset
=
5
;
optional
uint32
pool_processor_num
=
6
;
optional
string
pool_affinity
=
7
;
optional
string
pool_cpuset
=
8
;
repeated
ChoreographyTask
tasks
=
9
;
repeated
InnerThread
threads
=
10
;
optional
string
pool_processor_policy
=
8
;
optional
int32
pool_processor_prio
=
9
;
optional
string
pool_cpuset
=
10
;
repeated
ChoreographyTask
tasks
=
11
;
repeated
InnerThread
threads
=
12
;
}
cyber/scheduler/policy/scheduler_choreography.cc
浏览文件 @
bddbf764
...
...
@@ -61,6 +61,10 @@ SchedulerChoreography::SchedulerChoreography() {
.
pool_processor_num
();
pool_affinity_
=
cfg
.
scheduler_conf
().
choreography_conf
()
.
pool_affinity
();
pool_processor_policy_
=
cfg
.
scheduler_conf
().
choreography_conf
()
.
pool_processor_policy
();
pool_processor_prio_
=
cfg
.
scheduler_conf
().
choreography_conf
()
.
pool_processor_prio
();
ParseCpuset
(
cfg
.
scheduler_conf
().
choreography_conf
().
pool_cpuset
(),
&
pool_cpuset_
);
...
...
@@ -103,6 +107,8 @@ void SchedulerChoreography::CreateProcessor() {
proc
->
BindContext
(
ctx
);
proc
->
SetAffinity
(
pool_cpuset_
,
pool_affinity_
,
i
);
proc
->
SetSchedPolicy
(
pool_processor_policy_
,
pool_processor_prio_
);
ctx
->
BindProc
(
proc
);
pctxs_
.
emplace_back
(
ctx
);
}
...
...
cyber/scheduler/policy/scheduler_choreography.h
浏览文件 @
bddbf764
...
...
@@ -48,10 +48,12 @@ class SchedulerChoreography : public Scheduler {
std
::
string
choreography_affinity_
;
std
::
string
choreography_processor_policy_
;
u
int32_t
choreography_processor_prio_
;
int32_t
choreography_processor_prio_
;
std
::
vector
<
int
>
choreography_cpuset_
;
std
::
string
pool_affinity_
;
std
::
vector
<
int
>
pool_cpuset_
;
std
::
string
pool_processor_policy_
;
int32_t
pool_processor_prio_
;
};
}
// namespace scheduler
...
...
cyber/scheduler/processor.cc
浏览文件 @
bddbf764
...
...
@@ -16,6 +16,8 @@
#include "cyber/scheduler/processor.h"
#include <sys/syscall.h>
#include <sys/resource.h>
#include <sched.h>
#include <chrono>
...
...
@@ -67,21 +69,26 @@ void Processor::SetSchedPolicy(std::string spolicy, int sched_priority) {
struct
sched_param
sp
;
int
policy
;
memset
(
reinterpret_cast
<
void
*>
(
&
sp
),
0
,
sizeof
(
sp
));
sp
.
sched_priority
=
sched_priority
;
if
(
!
spolicy
.
compare
(
"SCHED_FIFO"
))
{
policy
=
SCHED_FIFO
;
pthread_setschedparam
(
thread_
.
native_handle
(),
policy
,
&
sp
);
}
else
if
(
!
spolicy
.
compare
(
"SCHED_RR"
))
{
policy
=
SCHED_RR
;
}
else
{
return
;
pthread_setschedparam
(
thread_
.
native_handle
(),
policy
,
&
sp
);
}
else
if
(
!
spolicy
.
compare
(
"SCHED_OTHER"
))
{
// Set normal thread nice value.
while
(
tid_
.
load
()
==
-
1
)
{
cpu_relax
();
}
setpriority
(
PRIO_PROCESS
,
tid_
.
load
(),
sched_priority
);
}
memset
(
reinterpret_cast
<
void
*>
(
&
sp
),
0
,
sizeof
(
sp
));
sp
.
sched_priority
=
sched_priority
;
pthread_setschedparam
(
thread_
.
native_handle
(),
policy
,
&
sp
);
}
void
Processor
::
Run
()
{
tid_
.
store
(
static_cast
<
int
>
(
syscall
(
SYS_gettid
)));
CRoutine
::
SetMainContext
(
routine_context_
);
while
(
likely
(
running_
))
{
...
...
cyber/scheduler/processor.h
浏览文件 @
bddbf764
...
...
@@ -58,6 +58,7 @@ class Processor {
std
::
atomic
<
bool
>
running_
{
false
};
std
::
mutex
mtx_ctx_
;
std
::
condition_variable
cv_ctx_
;
std
::
atomic
<
pid_t
>
tid_
{
-
1
};
};
}
// namespace scheduler
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录