zhiqiang-hhhh commented on code in PR #33331:
URL: https://github.com/apache/doris/pull/33331#discussion_r1557488835
##########
fe/fe-core/src/main/java/org/apache/doris/common/profile/ExecutionProfile.java:
##########
@@ -243,6 +247,81 @@ public void update(long startTime, boolean isFinished) {
}
}
+ public Status updateProfile(TQueryProfile profile, TNetworkAddress
address) {
+ if (isPipelineXProfile) {
+ if (!profile.isSetFragmentIdToProfile()) {
+ return new Status(TStatusCode.INVALID_ARGUMENT,
"FragmentIdToProfile is not set");
+ }
+
+ for (Entry<Integer, List<TDetailedReportParams>> entry :
profile.getFragmentIdToProfile().entrySet()) {
+ int fragmentId = entry.getKey();
+ List<TDetailedReportParams> fragmentProfile = entry.getValue();
+ int pipelineIdx = 0;
+ List<RuntimeProfile> taskProfile = Lists.newArrayList();
+ for (TDetailedReportParams pipelineProfile : fragmentProfile) {
+ String name = "Pipeline :" + pipelineIdx + " "
+ + " (host=" + address + ")";
Review Comment:
done
##########
be/src/runtime/query_context.cpp:
##########
@@ -297,4 +319,161 @@ Status QueryContext::set_workload_group(WorkloadGroupPtr&
tg) {
return Status::OK();
}
+void QueryContext::add_fragment_profile_x(
+ int fragment_id, const
std::vector<std::shared_ptr<TRuntimeProfileTree>>& pipeline_profiles,
+ std::shared_ptr<TRuntimeProfileTree> load_channel_profile) {
+ if (pipeline_profiles.empty()) {
+ std::string msg = fmt::format("Add pipeline profile failed, query {},
fragment {}",
+ print_id(this->_query_id), fragment_id);
+ LOG_ERROR(msg);
+ DCHECK(false) << msg;
+ return;
+ }
+
+#ifndef NDEBUG
+ for (const auto& p : pipeline_profiles) {
+ DCHECK(p != nullptr) << fmt::format("Add pipeline profile failed,
query {}, fragment {}",
+ print_id(this->_query_id),
fragment_id);
+ }
+#endif
+
+ std::lock_guard<std::mutex> l(_profile_mutex);
+ LOG_INFO("Query X add fragment profile, query {}, fragment {}, pipeline
profile count {} ",
+ print_id(this->_query_id), fragment_id, pipeline_profiles.size());
+
+ _profile_map_x.insert(std::make_pair(fragment_id, pipeline_profiles));
+
+ if (load_channel_profile != nullptr) {
+ _load_channel_profile_map_x.insert(std::make_pair(fragment_id,
load_channel_profile));
+ }
+}
+
+void QueryContext::add_instance_profile(const TUniqueId& instance_id,
+ std::shared_ptr<TRuntimeProfileTree>
profile,
+ std::shared_ptr<TRuntimeProfileTree>
load_channel_profile) {
+ DCHECK(profile != nullptr) << print_id(instance_id);
+
+ std::lock_guard<std::mutex> lg(_profile_mutex);
+ _profile_map.insert(std::make_pair(instance_id, profile));
+ if (load_channel_profile != nullptr) {
+ _load_channel_profile_map.insert(std::make_pair(instance_id,
load_channel_profile));
+ }
+}
+
+void QueryContext::_report_query_profile() {
+ _report_query_profile_x();
+ _report_query_profile_non_pipeline();
+}
+
+void QueryContext::_report_query_profile_non_pipeline() {
+ if (enable_pipeline_exec()) {
Review Comment:
done
##########
be/src/runtime/fragment_mgr.cpp:
##########
@@ -483,6 +486,14 @@ void
FragmentMgr::_exec_actual(std::shared_ptr<PlanFragmentExecutor> fragment_ex
std::chrono::system_clock::now().time_since_epoch())
.count();
std::lock_guard<std::mutex> lock(_lock);
+
+ if (query_ctx->enable_profile()) {
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]