Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
5acd34a2
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,体验更适合开发者的 AI 搜索 >>
提交
5acd34a2
编写于
12月 11, 2018
作者:
Z
zaxon
提交者:
Jiangtao Hu
12月 13, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
framework: put perf conf into setup.bash && add compile opt for performance issue (#2315)
上级
206f515e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
31 addition
and
68 deletion
+31
-68
cyber/conf/cyber.pb.conf
cyber/conf/cyber.pb.conf
+0
-5
cyber/event/BUILD
cyber/event/BUILD
+0
-1
cyber/event/perf_event_cache.cc
cyber/event/perf_event_cache.cc
+22
-23
cyber/event/perf_event_cache.h
cyber/event/perf_event_cache.h
+3
-4
cyber/proto/BUILD
cyber/proto/BUILD
+0
-15
cyber/proto/cyber_conf.proto
cyber/proto/cyber_conf.proto
+2
-4
cyber/proto/perf_conf.proto
cyber/proto/perf_conf.proto
+0
-16
cyber/setup.bash
cyber/setup.bash
+4
-0
未找到文件。
cyber/conf/cyber.pb.conf
浏览文件 @
5acd34a2
...
...
@@ -31,8 +31,3 @@ scheduler_conf {
routine_num
:
100
default_proc_num
:
16
}
perf_conf
{
enable
:
false
type
:
ALL
}
cyber/event/BUILD
浏览文件 @
5acd34a2
...
...
@@ -17,7 +17,6 @@ cc_library(
"//cyber/common:global_data"
,
"//cyber/common:log"
,
"//cyber/common:macros"
,
"//cyber/proto:perf_conf_cc_proto"
,
"//cyber/time:time"
,
]
)
...
...
cyber/event/perf_event_cache.cc
浏览文件 @
5acd34a2
...
...
@@ -18,7 +18,8 @@
#include <string>
#include "cyber/common/global_data.h"
#include "cyber/base/macros.h"
#include "cyber/common/environment.h"
#include "cyber/common/log.h"
#include "cyber/common/macros.h"
#include "cyber/state.h"
...
...
@@ -28,18 +29,22 @@ namespace apollo {
namespace
cyber
{
namespace
event
{
using
common
::
GlobalData
;
using
proto
::
PerfConf
;
using
proto
::
PerfType
;
using
common
::
GetEnv
;
PerfEventCache
::
PerfEventCache
()
{
auto
&
global_conf
=
GlobalData
::
Instance
()
->
Config
();
if
(
global_conf
.
has_perf_conf
())
{
perf_conf_
.
CopyFrom
(
global_conf
.
perf_conf
());
enable_
=
perf_conf_
.
enable
();
auto
trans_perf
=
GetEnv
(
"cyber_trans_perf"
);
if
(
trans_perf
!=
""
&&
std
::
stoi
(
trans_perf
))
{
enable_trans_perf_
=
true
;
}
auto
sched_perf
=
GetEnv
(
"cyber_sched_perf"
);
if
(
sched_perf
!=
""
&&
std
::
stoi
(
sched_perf
))
{
enable_sched_perf_
=
true
;
}
if
(
enable_
)
{
if
(
enable_sched_perf_
||
enable_trans_perf_
)
{
if
(
!
event_queue_
.
Init
(
kEventQueueSize
))
{
AERROR
<<
"Event queue init failed."
;
throw
std
::
runtime_error
(
"Event queue init failed."
);
...
...
@@ -49,11 +54,15 @@ PerfEventCache::PerfEventCache() {
}
PerfEventCache
::~
PerfEventCache
()
{
if
(
!
enable_
)
{
if
(
!
enable_sched_perf_
&&
!
enable_trans_perf_
)
{
return
;
}
if
(
shutdown_
.
exchange
(
true
))
{
return
;
}
shutdown_
=
true
;
event_queue_
.
BreakAllWait
();
if
(
io_thread_
.
joinable
())
{
io_thread_
.
join
();
...
...
@@ -67,12 +76,7 @@ PerfEventCache::~PerfEventCache() {
void
PerfEventCache
::
AddSchedEvent
(
const
SchedPerf
event_id
,
const
uint64_t
cr_id
,
const
int
proc_id
,
const
int
cr_state
)
{
if
(
!
enable_
)
{
return
;
}
if
(
perf_conf_
.
type
()
!=
PerfType
::
SCHED
&&
perf_conf_
.
type
()
!=
PerfType
::
ALL
)
{
if
(
likely
(
!
enable_sched_perf_
))
{
return
;
}
...
...
@@ -89,12 +93,7 @@ void PerfEventCache::AddSchedEvent(const SchedPerf event_id,
void
PerfEventCache
::
AddTransportEvent
(
const
TransPerf
event_id
,
const
uint64_t
channel_id
,
const
uint64_t
msg_seq
)
{
if
(
likely
(
!
enable_
))
{
return
;
}
if
(
unlikely
(
perf_conf_
.
type
()
!=
PerfType
::
TRANSPORT
&&
perf_conf_
.
type
()
!=
PerfType
::
ALL
))
{
if
(
likely
(
!
enable_trans_perf_
))
{
return
;
}
...
...
cyber/event/perf_event_cache.h
浏览文件 @
5acd34a2
...
...
@@ -25,7 +25,6 @@
#include "cyber/base/bounded_queue.h"
#include "cyber/common/macros.h"
#include "cyber/event/perf_event.h"
#include "cyber/proto/perf_conf.pb.h"
namespace
apollo
{
namespace
cyber
{
...
...
@@ -48,10 +47,10 @@ class PerfEventCache {
std
::
thread
io_thread_
;
std
::
ofstream
of_
;
bool
enable_
=
false
;
bool
shutdown_
=
false
;
bool
enable_trans_perf_
=
false
;
bool
enable_sched_perf_
=
false
;
std
::
atomic
<
bool
>
shutdown_
=
{
false
};
proto
::
PerfConf
perf_conf_
;
base
::
BoundedQueue
<
EventBasePtr
>
event_queue_
;
const
int
kFlushSize
=
512
;
...
...
cyber/proto/BUILD
浏览文件 @
5acd34a2
...
...
@@ -18,7 +18,6 @@ proto_library(
":choreography_conf_proto"
,
":scheduler_conf_proto"
,
":transport_conf_proto"
,
":perf_conf_proto"
,
":run_mode_conf_proto"
,
":topology_conf_proto"
,
],
...
...
@@ -84,20 +83,6 @@ proto_library(
],
)
cc_proto_library
(
name
=
"perf_conf_cc_proto"
,
deps
=
[
":perf_conf_proto"
,
],
)
proto_library
(
name
=
"perf_conf_proto"
,
srcs
=
[
"perf_conf.proto"
,
],
)
cc_proto_library
(
name
=
"run_mode_conf_cc_proto"
,
deps
=
[
...
...
cyber/proto/cyber_conf.proto
浏览文件 @
5acd34a2
...
...
@@ -4,14 +4,12 @@ package apollo.cyber.proto;
import
"cyber/proto/scheduler_conf.proto"
;
import
"cyber/proto/transport_conf.proto"
;
import
"cyber/proto/perf_conf.proto"
;
import
"cyber/proto/run_mode_conf.proto"
;
import
"cyber/proto/topology_conf.proto"
;
message
CyberConfig
{
optional
SchedulerConf
scheduler_conf
=
1
;
optional
TransportConf
transport_conf
=
2
;
optional
PerfConf
perf_conf
=
3
;
optional
RunModeConf
run_mode_conf
=
4
;
optional
TopologyConf
topology_conf
=
5
;
optional
RunModeConf
run_mode_conf
=
3
;
optional
TopologyConf
topology_conf
=
4
;
}
cyber/proto/perf_conf.proto
已删除
100644 → 0
浏览文件 @
206f515e
syntax
=
"proto2"
;
package
apollo
.
cyber.proto
;
enum
PerfType
{
SCHED
=
1
;
TRANSPORT
=
2
;
DATA_CACHE
=
3
;
ALL
=
4
;
}
message
PerfConf
{
optional
bool
enable
=
1
[
default
=
false
];
optional
PerfType
type
=
2
[
default
=
ALL
];
}
cyber/setup.bash
浏览文件 @
5acd34a2
...
...
@@ -9,6 +9,7 @@ PYTHON_LD_PATH="/apollo/bazel-bin/cyber/py_wrapper"
launch_path
=
"
${
CYBER_PATH
}
/tools/cyber_launch"
qt_path
=
/usr/local/Qt5.5.1/5.5/gcc_64
export
LD_LIBRARY_PATH
=
${
qt_path
}
/lib:
$LD_LIBRARY_PATH
export
QT_QPA_PLATFORM_PLUGIN_PATH
=
${
qt_path
}
/plugins
export
PATH
=
${
binary_path
}
:
${
recorder_path
}
:
${
monitor_path
}
:
${
launch_path
}
:
${
qt_path
}
/bin:
${
visualizer_path
}
:
$PATH
...
...
@@ -22,6 +23,9 @@ export GLOG_alsologtostderr=0
export
GLOG_colorlogtostderr
=
1
export
GLOG_minloglevel
=
0
export
cyber_trans_perf
=
0
export
cyber_sched_perf
=
0
# for DEBUG log
#export GLOG_minloglevel=-1
#export GLOG_v=4
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录