This is an automated email from the ASF dual-hosted git repository.
zclllyybb 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 952aede1883 [fix](be) Rename CPU time profile counter (#64238)
952aede1883 is described below
commit 952aede18839ea7e7aaeb8713541accca92255a6
Author: zclllyybb <[email protected]>
AuthorDate: Tue Jun 9 15:24:26 2026 +0800
[fix](be) Rename CPU time profile counter (#64238)
Problem Summary: Runtime profiles had a CPU-time counter named
MaxFindRecvrTime(NS), while the naming convention for CPU-time counters
is to include CpuTime directly in the counter name. This makes it hard
to distinguish CPU-time counters from wall-time counters by name. Rename
the exchange receiver counter to MaxFindRecvrCpuTime(NS), keep existing
TaskCpuTime and ScannerCpuTime names without an extra suffix, and cover
the expected profile names in BE unit tests and the existing scanner
profile regression test.
---
be/src/exec/exchange/vdata_stream_recvr.cpp | 2 +-
be/test/exec/pipeline/vdata_stream_recvr_test.cpp | 18 ++++++++++++++++++
be/test/runtime/runtime_profile_test.cpp | 20 ++++++++++++++++++++
.../suites/query_profile/scanner_profile.groovy | 9 +++++++--
4 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/be/src/exec/exchange/vdata_stream_recvr.cpp
b/be/src/exec/exchange/vdata_stream_recvr.cpp
index 7768db708ea..7b77c24ecbd 100644
--- a/be/src/exec/exchange/vdata_stream_recvr.cpp
+++ b/be/src/exec/exchange/vdata_stream_recvr.cpp
@@ -417,7 +417,7 @@ VDataStreamRecvr::VDataStreamRecvr(VDataStreamMgr*
stream_mgr,
_blocks_produced_counter = ADD_COUNTER(_profile, "BlocksProduced",
TUnit::UNIT);
_max_wait_worker_time = ADD_COUNTER(_profile, "MaxWaitForWorkerTime",
TUnit::UNIT);
_max_wait_to_process_time = ADD_COUNTER(_profile, "MaxWaitToProcessTime",
TUnit::UNIT);
- _max_find_recvr_time = ADD_COUNTER(_profile, "MaxFindRecvrTime(NS)",
TUnit::UNIT);
+ _max_find_recvr_time = ADD_COUNTER(_profile, "MaxFindRecvrCpuTime(NS)",
TUnit::UNIT);
}
VDataStreamRecvr::~VDataStreamRecvr() {
diff --git a/be/test/exec/pipeline/vdata_stream_recvr_test.cpp
b/be/test/exec/pipeline/vdata_stream_recvr_test.cpp
index 9f8d1b13a26..6355f03e6a5 100644
--- a/be/test/exec/pipeline/vdata_stream_recvr_test.cpp
+++ b/be/test/exec/pipeline/vdata_stream_recvr_test.cpp
@@ -23,6 +23,7 @@
#include <functional>
#include <memory>
#include <mutex>
+#include <sstream>
#include <thread>
#include <vector>
@@ -91,6 +92,23 @@ TEST_F(DataStreamRecvrTest, TestCreateSenderQueue) {
}
}
+TEST_F(DataStreamRecvrTest, CpuTimeCounterNamesAreMarked) {
+ create_recvr(1, false);
+
+ EXPECT_NE(_mock_profile->get_counter("MaxFindRecvrCpuTime(NS)"), nullptr);
+ EXPECT_EQ(_mock_profile->get_counter("MaxFindRecvrTime(NS)"), nullptr);
+ EXPECT_EQ(_mock_profile->get_counter("MaxFindRecvrTime(NS) (Cpu Time)"),
nullptr);
+
+ std::stringstream ss;
+ _mock_profile->pretty_print(&ss);
+ const auto profile_text = ss.str();
+ EXPECT_NE(profile_text.find("- MaxFindRecvrCpuTime(NS):"),
std::string::npos);
+ EXPECT_EQ(profile_text.find("- MaxFindRecvrTime(NS):"), std::string::npos);
+ EXPECT_EQ(profile_text.find("- MaxFindRecvrTime(NS) (Cpu Time):"),
std::string::npos);
+
+ recvr->close();
+}
+
TEST_F(DataStreamRecvrTest, TestSender) {
create_recvr(3, false);
EXPECT_EQ(recvr->sender_queues().size(), 1);
diff --git a/be/test/runtime/runtime_profile_test.cpp
b/be/test/runtime/runtime_profile_test.cpp
index 7268146e4cd..7e36867805a 100644
--- a/be/test/runtime/runtime_profile_test.cpp
+++ b/be/test/runtime/runtime_profile_test.cpp
@@ -24,6 +24,7 @@
#include "common/exception.h"
#include "common/object_pool.h"
+#include "runtime/runtime_profile_counter_names.h"
using namespace std;
@@ -31,6 +32,25 @@ namespace doris {
class RuntimeProfileTest : public testing::Test {};
+TEST(RuntimeProfileTest, CpuTimeCounterNamesAreMarked) {
+ RuntimeProfile profile("ProfileWithCpuTime");
+ ADD_TIMER(&profile, profile::TASK_CPU_TIME)->set(int64_t {1000});
+ ADD_TIMER(&profile, profile::SCANNER_CPU_TIME)->set(int64_t {2000});
+
+ EXPECT_NE(profile.get_counter("TaskCpuTime"), nullptr);
+ EXPECT_NE(profile.get_counter("ScannerCpuTime"), nullptr);
+ EXPECT_EQ(profile.get_counter("TaskCpuTime (Cpu Time)"), nullptr);
+ EXPECT_EQ(profile.get_counter("ScannerCpuTime (Cpu Time)"), nullptr);
+
+ std::stringstream ss;
+ profile.pretty_print(&ss);
+ const auto profile_text = ss.str();
+ EXPECT_NE(profile_text.find("- TaskCpuTime:"), std::string::npos);
+ EXPECT_NE(profile_text.find("- ScannerCpuTime:"), std::string::npos);
+ EXPECT_EQ(profile_text.find("- TaskCpuTime (Cpu Time):"),
std::string::npos);
+ EXPECT_EQ(profile_text.find("- ScannerCpuTime (Cpu Time):"),
std::string::npos);
+}
+
TEST(RuntimeProfileTest, Basic) {
RuntimeProfile profile_a("ProfileA");
RuntimeProfile profile_a1("ProfileA1");
diff --git a/regression-test/suites/query_profile/scanner_profile.groovy
b/regression-test/suites/query_profile/scanner_profile.groovy
index 72587ee923d..9b26ce7ec3a 100644
--- a/regression-test/suites/query_profile/scanner_profile.groovy
+++ b/regression-test/suites/query_profile/scanner_profile.groovy
@@ -77,6 +77,7 @@ suite('scanner_profile') {
List profileData = profileAction.getProfileList()
def profileWithLimit1 = getProfileByToken(token)
logger.info("${token} Profile Data: ${profileWithLimit1}")
+ assertTrue(profileWithLimit1.toString().contains("- TaskCpuTime:"))
assertTrue(profileWithLimit1.toString().contains("- MaxScanConcurrency:
1"))
token = UUID.randomUUID().toString()
@@ -86,12 +87,16 @@ suite('scanner_profile') {
String profileWithFilter = getProfileByToken(token)
logger.info("${token} Profile Data: ${profileWithFilter}")
+ assertTrue(profileWithFilter.toString().contains("- TaskCpuTime:"))
+ assertTrue(profileWithFilter.toString().contains("- ScannerCpuTime:"))
+ assertFalse(profileWithFilter.toString().contains("- TaskCpuTime (Cpu
Time):"))
+ assertFalse(profileWithFilter.toString().contains("- ScannerCpuTime (Cpu
Time):"))
// Verify actualRows is backfilled onto the scan node. The exact value is
// unstable because 9 INT keys hash-distribute into 10 buckets and a few
// tablets may be pruned at runtime, so only assert it is in [1, 9].
- def matcher = (profileWithFilter.toString() =~
/PhysicalOlapScan\[scanner_profile\][^\n]*actualRows=(\d+)/)
+ def matcher = (profileWithFilter.toString() =~
/PhysicalOlapScan[^\n]*scanner_profile[^\n]*actualRows=(\d+)/)
assertTrue(matcher.find(), "actualRows not found on
PhysicalOlapScan[scanner_profile] in profile")
int actualRows = matcher.group(1) as int
assertTrue(actualRows >= 1 && actualRows <= 9,
"expect actualRows in [1, 9], got ${actualRows}")
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]