This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new f82649012bd branch-3.1: [fix](be) fix macos report wrong cpu cores 
#52726 (#52859)
f82649012bd is described below

commit f82649012bd8d899e76d2b2928d3a2ea6765517b
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Jul 8 14:19:45 2025 +0800

    branch-3.1: [fix](be) fix macos report wrong cpu cores #52726 (#52859)
    
    Cherry-picked from #52726
    
    Co-authored-by: 924060929 <[email protected]>
---
 be/src/util/cpu_info.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/be/src/util/cpu_info.cpp b/be/src/util/cpu_info.cpp
index b49985cdc06..6b8680c3a4d 100644
--- a/be/src/util/cpu_info.cpp
+++ b/be/src/util/cpu_info.cpp
@@ -161,6 +161,11 @@ void CpuInfo::init() {
         }
     }
 
+#ifdef __APPLE__
+    size_t len = sizeof(max_num_cores_);
+    sysctlbyname("hw.physicalcpu", &physical_num_cores, &len, nullptr, 0);
+#endif
+
     int num_cores = 
CGroupUtil::get_cgroup_limited_cpu_number(physical_num_cores);
     if (max_mhz != 0) {
         cycles_per_ms_ = int64_t(max_mhz) * 1000;
@@ -179,7 +184,6 @@ void CpuInfo::init() {
     }
 
 #ifdef __APPLE__
-    size_t len = sizeof(max_num_cores_);
     sysctlbyname("hw.logicalcpu", &max_num_cores_, &len, nullptr, 0);
 #else
     max_num_cores_ = get_nprocs_conf();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to