提交 fb8e6ec7 编写于 作者: J Jiangtao Hu 提交者: Yifei Jiang

add processor time stats.

上级 a3468fc4
......@@ -15,6 +15,7 @@ cc_library(
"//modules/common:log",
"//modules/common/proto:path_point_proto",
"//modules/common/status",
"//modules/common/time",
"//modules/common/util",
"//modules/common/util:factory",
"//modules/common/vehicle_state",
......
......@@ -21,6 +21,7 @@
#include "modules/common/adapters/adapter_manager.h"
#include "modules/common/log.h"
#include "modules/common/time/time.h"
#include "modules/common/util/string_tokenizer.h"
#include "modules/common/util/string_util.h"
#include "modules/common/vehicle_state/vehicle_state.h"
......@@ -41,6 +42,7 @@ namespace planning {
using common::Status;
using common::adapter::AdapterManager;
using common::time::Clock;
using common::ErrorCode;
using common::TrajectoryPoint;
using common::VehicleState;
......@@ -99,7 +101,11 @@ Status EMPlanner::Plan(const TrajectoryPoint& start_point,
planning_data->set_decision_data(decision_data);
for (auto& optimizer : optimizers_) {
const double start_timestamp = apollo::common::time::ToSecond(Clock::Now());
optimizer->Optimize(planning_data);
const double end_timestamp = apollo::common::time::ToSecond(Clock::Now());
const double time_diff_ms = (end_timestamp - start_timestamp) * 1000;
ADEBUG << "after optimizer " << optimizer->name() << ":"
<< planning_data->DebugString();
......@@ -116,6 +122,9 @@ Status EMPlanner::Plan(const TrajectoryPoint& start_point,
optimized_path->mutable_path_point()->CopyFrom(
{path_points.begin(), path_points.end()});
}
auto stats = trajectory_pb->mutable_latency_stats()->add_processor_stats();
stats->set_name(optimizer->name());
stats->set_time_ms(time_diff_ms);
}
}
PublishableTrajectory computed_trajectory;
......
......@@ -70,8 +70,14 @@ message EStop {
optional bool is_estop = 1;
}
message ProcessorStats {
optional string name = 1;
optional double time_ms = 2;
}
message LatencyStats {
optional double total_time_ms = 1;
repeated ProcessorStats processor_stats = 2;
}
// next id: 16
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册