This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 761a5002037 [chore](compile check) Fix compile check (#55562)
761a5002037 is described below
commit 761a5002037a22aef7b06b6e5e00b12b14e6037d
Author: zhiqiang <[email protected]>
AuthorDate: Wed Sep 3 14:05:52 2025 +0800
[chore](compile check) Fix compile check (#55562)
---
be/src/util/runtime_profile.cpp | 16 ++++++++--------
be/src/util/runtime_profile.h | 5 +++--
be/src/util/runtime_profile_counter_tree_node.cpp | 2 +-
be/src/util/runtime_profile_counter_tree_node.h | 2 +-
be/src/util/system_metrics.cpp | 8 +++++---
5 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/be/src/util/runtime_profile.cpp b/be/src/util/runtime_profile.cpp
index d45076d8f35..71b1a444f61 100644
--- a/be/src/util/runtime_profile.cpp
+++ b/be/src/util/runtime_profile.cpp
@@ -39,7 +39,7 @@
#endif
namespace doris {
-
+#include "common/compile_check_begin.h"
// Thread counters name
static const std::string THREAD_VOLUNTARY_CONTEXT_SWITCHES =
"VoluntaryContextSwitches";
static const std::string THREAD_INVOLUNTARY_CONTEXT_SWITCHES =
"InvoluntaryContextSwitches";
@@ -368,7 +368,7 @@ void RuntimeProfile::compute_time_in_profile(int64_t total)
{
int64_t local_time = total_time_counter()->value() - total_child_time;
// Counters have some margin, set to 0 if it was negative.
local_time = std::max<int64_t>(0L, local_time);
- _local_time_percent = static_cast<double>(local_time) / total;
+ _local_time_percent = static_cast<double>(local_time) /
static_cast<double>(total);
_local_time_percent = std::min(1.0, _local_time_percent) * 100;
// Recurse on children
@@ -670,7 +670,7 @@ void RuntimeProfile::to_thrift(TRuntimeProfileTree* tree,
int64_t profile_level)
}
void RuntimeProfile::to_thrift(std::vector<TRuntimeProfileNode>* nodes,
int64_t profile_level) {
- int index = nodes->size();
+ size_t index = nodes->size();
nodes->push_back(TRuntimeProfileNode());
TRuntimeProfileNode& node = (*nodes)[index];
node.name = _name;
@@ -699,11 +699,11 @@ void
RuntimeProfile::to_thrift(std::vector<TRuntimeProfileNode>* nodes, int64_t
std::lock_guard<std::mutex> l(_children_lock);
children = _children;
}
- node.num_children = children.size();
+ node.num_children = cast_set<int32_t>(children.size());
nodes->reserve(nodes->size() + children.size());
for (int i = 0; i < children.size(); ++i) {
- int child_idx = nodes->size();
+ size_t child_idx = nodes->size();
children[i].first->to_thrift(nodes, profile_level);
// fix up indentation flag
(*nodes)[child_idx].indent = children[i].second;
@@ -748,10 +748,10 @@ void
RuntimeProfile::to_proto(google::protobuf::RepeatedPtrField<PRuntimeProfile
children = _children;
}
- node->set_num_children(children.size());
+ node->set_num_children(cast_set<int32_t>(children.size()));
for (const auto& child : children) {
- int child_index = nodes->size(); // capture index for indent correction
+ int child_index = cast_set<int>(nodes->size()); // capture index for
indent correction
child.first->to_proto(nodes, profile_level);
(*nodes)[child_index].set_indent(child.second);
}
@@ -767,7 +767,7 @@ int64_t RuntimeProfile::units_per_second(const
RuntimeProfile::Counter* total_co
}
double secs = static_cast<double>(timer->value()) / 1000.0 / 1000.0 /
1000.0;
- return int64_t(total_counter->value() / secs);
+ return int64_t(static_cast<double>(total_counter->value()) / secs);
}
int64_t RuntimeProfile::counter_sum(const std::vector<Counter*>* counters) {
diff --git a/be/src/util/runtime_profile.h b/be/src/util/runtime_profile.h
index 7f470ad9a8a..ca5ffcca438 100644
--- a/be/src/util/runtime_profile.h
+++ b/be/src/util/runtime_profile.h
@@ -46,6 +46,7 @@
#include "util/stopwatch.hpp"
namespace doris {
+#include "common/compile_check_begin.h"
class TRuntimeProfileNode;
class TRuntimeProfileTree;
class RuntimeProfileCounterTreeNode;
@@ -605,7 +606,7 @@ public:
void get_all_children(std::vector<RuntimeProfile*>* children);
// Returns the number of counters in this profile
- int num_counters() const { return _counter_map.size(); }
+ int num_counters() const { return cast_set<int>(_counter_map.size()); }
// Returns name of this profile
const std::string& name() const { return _name; }
@@ -821,5 +822,5 @@ private:
T _sw;
C* _counter = nullptr;
};
-
+#include "common/compile_check_end.h"
} // namespace doris
diff --git a/be/src/util/runtime_profile_counter_tree_node.cpp
b/be/src/util/runtime_profile_counter_tree_node.cpp
index cbbb02bdadf..00fd8b8d6a7 100644
--- a/be/src/util/runtime_profile_counter_tree_node.cpp
+++ b/be/src/util/runtime_profile_counter_tree_node.cpp
@@ -54,7 +54,7 @@ RuntimeProfileCounterTreeNode
RuntimeProfileCounterTreeNode::from_map(
// 1. Remove all leaf nodes whose level is greater than the given level.
// 2. Remove all nodes whose children are all pruned.
RuntimeProfileCounterTreeNode RuntimeProfileCounterTreeNode::prune_the_tree(
- RuntimeProfileCounterTreeNode node, int level) {
+ RuntimeProfileCounterTreeNode node, int64_t level) {
// Iterate through the children and prune them recursively
for (auto it = node.children.begin(); it != node.children.end();) {
*it = prune_the_tree(*it, level);
diff --git a/be/src/util/runtime_profile_counter_tree_node.h
b/be/src/util/runtime_profile_counter_tree_node.h
index 85284797cb6..96104a37e69 100644
--- a/be/src/util/runtime_profile_counter_tree_node.h
+++ b/be/src/util/runtime_profile_counter_tree_node.h
@@ -44,7 +44,7 @@ public:
// 1. Remove all leaf nodes whose level is greater than the given level.
// 2. Remove all nodes whose children are all pruned.
static RuntimeProfileCounterTreeNode
prune_the_tree(RuntimeProfileCounterTreeNode node,
- int level);
+ int64_t level);
// Convert the counter tree to a list of TCounter objects and a map of
tree topology.
void to_thrift(std::vector<TCounter>& tcounter,
diff --git a/be/src/util/system_metrics.cpp b/be/src/util/system_metrics.cpp
index 034a3ece38f..98c9299f6b4 100644
--- a/be/src/util/system_metrics.cpp
+++ b/be/src/util/system_metrics.cpp
@@ -25,12 +25,13 @@
#include <unordered_map>
#include <utility>
+#include "common/cast_set.h"
#include "runtime/memory/jemalloc_control.h"
#include "util/cgroup_util.h"
#include "util/perf_counters.h"
namespace doris {
-
+#include "common/compile_check_begin.h"
DEFINE_COUNTER_METRIC_PROTOTYPE_2ARG(avail_cpu_num, MetricUnit::NOUNIT);
DEFINE_COUNTER_METRIC_PROTOTYPE_2ARG(host_cpu_num, MetricUnit::NOUNIT);
@@ -731,7 +732,7 @@ void SystemMetrics::_update_snmp_metrics() {
}
// We only care about Tcp lines, so skip other lines in front of Tcp line
- int res = 0;
+ int64_t res = 0;
while ((res = getline(&_line_ptr, &_line_buf_size, fp)) > 0) {
if (strstr(_line_ptr, "Tcp") != nullptr) {
break;
@@ -1004,7 +1005,8 @@ void SystemMetrics::_update_proc_metrics() {
void SystemMetrics::update_be_avail_cpu_num() {
int64_t physical_cpu_num = _cpu_num_metrics->host_cpu_num->value();
if (physical_cpu_num > 0) {
- physical_cpu_num =
CGroupUtil::get_cgroup_limited_cpu_number(physical_cpu_num);
+ physical_cpu_num =
+
CGroupUtil::get_cgroup_limited_cpu_number(cast_set<int32_t>(physical_cpu_num));
_cpu_num_metrics->avail_cpu_num->set_value(physical_cpu_num);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]