Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
dfcc01b2
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,发现更多精彩内容 >>
提交
dfcc01b2
编写于
10月 08, 2018
作者:
Z
zaxon
提交者:
GoLancer
10月 10, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
framework: code clean
上级
c4bacf27
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
27 addition
and
34 deletion
+27
-34
framework/benchmark/benchmark_gaussian_elimination.cpp
framework/benchmark/benchmark_gaussian_elimination.cpp
+3
-3
framework/cybertron/scheduler/policy/cfs.cpp
framework/cybertron/scheduler/policy/cfs.cpp
+11
-17
framework/cybertron/scheduler/policy/cfs.h
framework/cybertron/scheduler/policy/cfs.h
+4
-5
framework/cybertron/scheduler/policy/classic.cpp
framework/cybertron/scheduler/policy/classic.cpp
+4
-3
framework/cybertron/scheduler/policy/classic.h
framework/cybertron/scheduler/policy/classic.h
+3
-4
scripts/apollo_base.sh
scripts/apollo_base.sh
+1
-1
scripts/record_bag.py
scripts/record_bag.py
+1
-1
未找到文件。
framework/benchmark/benchmark_gaussian_elimination.cpp
浏览文件 @
dfcc01b2
...
...
@@ -66,7 +66,7 @@ int MSG_SEND_GAP_US = 0;
int
PROC_TIME_US
=
0
;
// 0: usleep; 1: cpu computer; 2: gpu computer
int
PROC_TYPE
=
0
;
in
t
MSG_NUM
=
0
;
uint64_
t
MSG_NUM
=
0
;
void
LocalProc
(
const
std
::
string
&
node_name
,
const
std
::
shared_ptr
<
apollo
::
cybertron
::
proto
::
Chatter
>&
msg
)
{
...
...
@@ -143,7 +143,7 @@ class GaussianComponent
}
};
int
GenGaussianDag
()
{
void
GenGaussianDag
()
{
std
::
shared_ptr
<
apollo
::
cybertron
::
Node
>
start_node
;
std
::
shared_ptr
<
apollo
::
cybertron
::
Writer
<
apollo
::
cybertron
::
proto
::
Chatter
>>
start_node_writer
;
...
...
@@ -232,7 +232,7 @@ int GenGaussianDag() {
++
idx
;
}
}
for
(
in
t
i
=
0
;
i
<
MSG_NUM
;
++
i
)
{
for
(
uint64_
t
i
=
0
;
i
<
MSG_NUM
;
++
i
)
{
if
(
apollo
::
cybertron
::
IsShutdown
())
{
break
;
}
...
...
framework/cybertron/scheduler/policy/cfs.cpp
浏览文件 @
dfcc01b2
...
...
@@ -62,13 +62,13 @@ std::shared_ptr<CRoutine> CFSContext::NextLocalRoutine() {
cur_croutine_
->
priority
());
cur_croutine_
->
set_exec_time
(
cur_croutine_
->
vruntime
()
*
cur_croutine_
->
priority
());
local_r
b_map
_
.
insert
(
std
::
pair
<
double
,
std
::
shared_ptr
<
CRoutine
>>
(
local_r
t_queue
_
.
insert
(
std
::
pair
<
double
,
std
::
shared_ptr
<
CRoutine
>>
(
cur_croutine_
->
vruntime
(),
cur_croutine_
));
cur_croutine_
=
nullptr
;
}
std
::
shared_ptr
<
CRoutine
>
croutine
=
nullptr
;
for
(
auto
it
=
local_r
b_map_
.
begin
();
it
!=
local_rb_map
_
.
end
();)
{
for
(
auto
it
=
local_r
t_queue_
.
begin
();
it
!=
local_rt_queue
_
.
end
();)
{
auto
cr
=
it
->
second
;
auto
lock
=
cr
->
TryLock
();
if
(
!
lock
)
{
...
...
@@ -77,13 +77,9 @@ std::shared_ptr<CRoutine> CFSContext::NextLocalRoutine() {
}
cr
->
UpdateState
();
if
(
cr
->
state
()
==
RoutineState
::
RUNNING
)
{
++
it
;
continue
;
}
if
(
cr
->
state
()
==
RoutineState
::
FINISHED
)
{
it
=
local_r
b_map
_
.
erase
(
it
);
it
=
local_r
t_queue
_
.
erase
(
it
);
continue
;
}
...
...
@@ -92,11 +88,12 @@ std::shared_ptr<CRoutine> CFSContext::NextLocalRoutine() {
croutine
=
cr
;
croutine
->
set_state
(
RoutineState
::
RUNNING
);
cur_croutine_
=
croutine
;
local_r
b_map
_
.
erase
(
it
);
local_r
t_queue
_
.
erase
(
it
);
break
;
}
++
it
;
}
if
(
croutine
==
nullptr
)
{
notified_
.
store
(
false
);
}
else
{
...
...
@@ -115,7 +112,7 @@ std::shared_ptr<CRoutine> CFSContext::NextAffinityRoutine() {
auto
start_perf_time
=
apollo
::
cybertron
::
Time
::
Now
().
ToNanosecond
();
std
::
shared_ptr
<
CRoutine
>
croutine
=
nullptr
;
for
(
auto
it
=
affinity_r
b_map_
.
begin
();
it
!=
affinity_rb_map
_
.
end
();)
{
for
(
auto
it
=
affinity_r
t_queue_
.
begin
();
it
!=
affinity_rt_queue
_
.
end
();)
{
auto
cr
=
it
->
second
;
auto
lock
=
cr
->
TryLock
();
if
(
!
lock
)
{
...
...
@@ -124,13 +121,9 @@ std::shared_ptr<CRoutine> CFSContext::NextAffinityRoutine() {
}
cr
->
UpdateState
();
if
(
cr
->
state
()
==
RoutineState
::
FINISHED
)
{
it
=
affinity_rb_map_
.
erase
(
it
);
continue
;
}
if
(
cr
->
state
()
==
RoutineState
::
RUNNING
)
{
++
it
;
if
(
cr
->
state
()
==
RoutineState
::
FINISHED
)
{
it
=
affinity_rt_queue_
.
erase
(
it
)
;
continue
;
}
...
...
@@ -141,6 +134,7 @@ std::shared_ptr<CRoutine> CFSContext::NextAffinityRoutine() {
}
++
it
;
}
if
(
croutine
)
{
PerfEventCache
::
Instance
()
->
AddSchedEvent
(
SchedPerf
::
NEXT_AFFINITY_R
,
croutine
->
id
(),
proc_index_
,
0
,
...
...
@@ -165,7 +159,7 @@ bool CFSContext::Enqueue(const std::shared_ptr<CRoutine>& cr) {
std
::
lock_guard
<
std
::
mutex
>
lg
(
mtx_run_queue_
);
cr
->
set_vruntime
(
min_vruntime_
+
cr
->
normalized_vruntime
());
cr
->
set_exec_time
(
cr
->
vruntime
()
*
cr
->
priority
());
local_r
b_map
_
.
insert
(
local_r
t_queue
_
.
insert
(
std
::
pair
<
double
,
std
::
shared_ptr
<
CRoutine
>>
(
cr
->
vruntime
(),
cr
));
return
true
;
}
...
...
@@ -173,7 +167,7 @@ bool CFSContext::Enqueue(const std::shared_ptr<CRoutine>& cr) {
bool
CFSContext
::
EnqueueAffinityRoutine
(
const
std
::
shared_ptr
<
CRoutine
>&
cr
)
{
std
::
lock_guard
<
std
::
mutex
>
lg
(
rw_affinity_lock_
);
if
(
cr
->
IsAffinity
(
id
()))
{
affinity_r
b_map
_
.
insert
(
affinity_r
t_queue
_
.
insert
(
std
::
pair
<
uint32_t
,
std
::
shared_ptr
<
CRoutine
>>
(
cr
->
priority
(),
cr
));
return
true
;
}
...
...
framework/cybertron/scheduler/policy/cfs.h
浏览文件 @
dfcc01b2
...
...
@@ -18,13 +18,11 @@
#define CYBERTRON_SCHEDULER_POLICY_CFS_CONTEXT_H_
#include <cstdint>
#include <future>
#include <list>
#include <functional>
#include <map>
#include <memory>
#include <mutex>
#include <string>
#include <vector>
#include "cybertron/scheduler/processor_context.h"
...
...
@@ -53,8 +51,9 @@ class CFSContext : public ProcessorContext {
std
::
mutex
mtx_run_queue_
;
std
::
mutex
rw_affinity_lock_
;
std
::
multimap
<
double
,
std
::
shared_ptr
<
CRoutine
>>
local_rb_map_
;
std
::
multimap
<
double
,
std
::
shared_ptr
<
CRoutine
>>
affinity_rb_map_
;
std
::
multimap
<
double
,
std
::
shared_ptr
<
CRoutine
>>
local_rt_queue_
;
std
::
multimap
<
double
,
std
::
shared_ptr
<
CRoutine
>
,
std
::
greater
<
double
>>
affinity_rt_queue_
;
std
::
shared_ptr
<
CRoutine
>
cur_croutine_
=
nullptr
;
double
min_vruntime_
=
0
;
};
...
...
framework/cybertron/scheduler/policy/classic.cpp
浏览文件 @
dfcc01b2
...
...
@@ -48,7 +48,7 @@ std::shared_ptr<CRoutine> ClassicContext::NextRoutine() {
auto
start_perf_time
=
apollo
::
cybertron
::
Time
::
Now
().
ToNanosecond
();
std
::
shared_ptr
<
CRoutine
>
croutine
=
nullptr
;
for
(
auto
it
=
r
b_map_
.
begin
();
it
!=
rb_map
_
.
end
();)
{
for
(
auto
it
=
r
t_queue_
.
begin
();
it
!=
rt_queue
_
.
end
();)
{
auto
cr
=
it
->
second
;
auto
lock
=
cr
->
TryLock
();
if
(
!
lock
)
{
...
...
@@ -56,8 +56,9 @@ std::shared_ptr<CRoutine> ClassicContext::NextRoutine() {
continue
;
}
cr
->
UpdateState
();
if
(
cr
->
state
()
==
RoutineState
::
FINISHED
)
{
it
=
r
b_map
_
.
erase
(
it
);
it
=
r
t_queue
_
.
erase
(
it
);
continue
;
}
...
...
@@ -90,7 +91,7 @@ bool ClassicContext::Enqueue(const std::shared_ptr<CRoutine>& cr) {
bool
ClassicContext
::
EnqueueAffinityRoutine
(
const
std
::
shared_ptr
<
CRoutine
>&
cr
)
{
std
::
lock_guard
<
std
::
mutex
>
lg
(
mtx_run_queue_
);
r
b_map
_
.
insert
(
r
t_queue
_
.
insert
(
std
::
pair
<
double
,
std
::
shared_ptr
<
CRoutine
>>
(
cr
->
priority
(),
cr
));
return
true
;
}
...
...
framework/cybertron/scheduler/policy/classic.h
浏览文件 @
dfcc01b2
...
...
@@ -18,13 +18,11 @@
#define CYBERTRON_SCHEDULER_POLICY_CLASSIC_CONTEXT_H_
#include <cstdint>
#include <future>
#include <list>
#include <functional>
#include <map>
#include <memory>
#include <mutex>
#include <string>
#include <vector>
#include "cybertron/scheduler/processor_context.h"
...
...
@@ -49,7 +47,8 @@ class ClassicContext : public ProcessorContext {
private:
std
::
mutex
mtx_run_queue_
;
std
::
multimap
<
double
,
std
::
shared_ptr
<
CRoutine
>>
rb_map_
;
std
::
multimap
<
double
,
std
::
shared_ptr
<
CRoutine
>
,
std
::
greater
<
double
>>
rt_queue_
;
};
}
// namespace scheduler
...
...
scripts/apollo_base.sh
浏览文件 @
dfcc01b2
...
...
@@ -84,7 +84,7 @@ function set_lib_path() {
PY_LIB_PATH
=
/apollo/lib
PY_TOOLS_PATH
=
/apollo/modules/tools
else
local
CYBERTRON_SETUP
=
"/apollo/framework/
cybertron
/setup.bash"
local
CYBERTRON_SETUP
=
"/apollo/framework/
install
/setup.bash"
if
[
-e
"
${
CYBERTRON_SETUP
}
"
]
;
then
source
"
${
CYBERTRON_SETUP
}
"
fi
...
...
scripts/record_bag.py
浏览文件 @
dfcc01b2
...
...
@@ -203,7 +203,7 @@ class Recorder(object):
cmd
=
'''
cd "{}"
source /apollo/scripts/apollo_base.sh
source /apollo/framework/
cybertron
/setup.bash
source /apollo/framework/
install
/setup.bash
nohup cyber_recorder record -c {} >{} 2>&1 &
'''
.
format
(
task_dir
,
topics_str
,
log_file
)
shell_cmd
(
cmd
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录