github-actions[bot] commented on code in PR #35608: URL: https://github.com/apache/doris/pull/35608#discussion_r1618667694
########## be/src/util/jvm_metrics.cpp: ########## @@ -246,9 +250,7 @@ _init_complete = true; } -#include "jni.h" - -void jvmStats::refresh(JvmMetrics* jvm_metrics) { +void JvmStats::refresh(JvmMetrics* jvm_metrics) { Review Comment: warning: function 'refresh' exceeds recommended size/complexity thresholds [readability-function-size] ```cpp void JvmStats::refresh(JvmMetrics* jvm_metrics) { ^ ``` <details> <summary>Additional context</summary> **be/src/util/jvm_metrics.cpp:252:** 159 lines including whitespace and comments (threshold 80) ```cpp void JvmStats::refresh(JvmMetrics* jvm_metrics) { ^ ``` </details> ########## be/src/util/jvm_metrics.cpp: ########## @@ -119,9 +121,11 @@ JvmMetrics::JvmMetrics(MetricRegistry* registry, JNIEnv* env) : _jvm_stats(env) void JvmMetrics::update() { _jvm_stats.refresh(this); } -#include <util/jni-util.h> -jvmStats::jvmStats(JNIEnv* ENV) : env(ENV) { +JvmStats::JvmStats(JNIEnv* ENV) : env(ENV) { Review Comment: warning: function 'JvmStats' exceeds recommended size/complexity thresholds [readability-function-size] ```cpp JvmStats::JvmStats(JNIEnv* ENV) : env(ENV) { ^ ``` <details> <summary>Additional context</summary> **be/src/util/jvm_metrics.cpp:124:** 126 lines including whitespace and comments (threshold 80) ```cpp JvmStats::JvmStats(JNIEnv* ENV) : env(ENV) { ^ ``` </details> ########## be/src/util/jvm_metrics.cpp: ########## @@ -246,9 +250,7 @@ _init_complete = true; } -#include "jni.h" - -void jvmStats::refresh(JvmMetrics* jvm_metrics) { +void JvmStats::refresh(JvmMetrics* jvm_metrics) { Review Comment: warning: method 'refresh' can be made const [readability-make-member-function-const] be/src/util/jvm_metrics.h:100: ```diff - void refresh(JvmMetrics* jvm_metrics); + void refresh(JvmMetrics* jvm_metrics) const; ``` ```suggestion void JvmStats::refresh(JvmMetrics* jvm_metrics) const { ``` ########## be/src/util/jvm_metrics.cpp: ########## @@ -246,9 +250,7 @@ _init_complete = true; } -#include "jni.h" - -void jvmStats::refresh(JvmMetrics* jvm_metrics) { +void JvmStats::refresh(JvmMetrics* jvm_metrics) { Review Comment: warning: function 'refresh' has cognitive complexity of 65 (threshold 50) [readability-function-cognitive-complexity] ```cpp void JvmStats::refresh(JvmMetrics* jvm_metrics) { ^ ``` <details> <summary>Additional context</summary> **be/src/util/jvm_metrics.cpp:253:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp if (!_init_complete) { ^ ``` **be/src/util/jvm_metrics.cpp:268:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp jvm_metrics->jvm_heap_size_bytes_used->set_value(heapMemoryUsed < 0 ? 0 : heapMemoryUsed); ^ ``` **be/src/util/jvm_metrics.cpp:270:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp heapMemoryCommitted < 0 ? 0 : heapMemoryCommitted); ^ ``` **be/src/util/jvm_metrics.cpp:271:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp jvm_metrics->jvm_heap_size_bytes_max->set_value(heapMemoryMax < 0 ? 0 : heapMemoryMax); ^ ``` **be/src/util/jvm_metrics.cpp:281:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp nonHeapMemoryCommitted < 0 ? 0 : nonHeapMemoryCommitted); ^ ``` **be/src/util/jvm_metrics.cpp:282:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp jvm_metrics->jvm_non_heap_size_bytes_used->set_value(nonHeapMemoryUsed < 0 ? 0 ^ ``` **be/src/util/jvm_metrics.cpp:290:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp for (int i = 0; i < size; ++i) { ^ ``` **be/src/util/jvm_metrics.cpp:307:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp if (nameStr != nullptr) { ^ ``` **be/src/util/jvm_metrics.cpp:309:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (it == _memoryPoolName.end()) { ^ ``` **be/src/util/jvm_metrics.cpp:312:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (it->second == memoryPoolNameEnum::YOUNG) { ^ ``` **be/src/util/jvm_metrics.cpp:313:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp jvm_metrics->jvm_young_size_bytes_used->set_value(used < 0 ? 0 : used); ^ ``` **be/src/util/jvm_metrics.cpp:314:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp jvm_metrics->jvm_young_size_bytes_peak_used->set_value(peakUsed < 0 ? 0 : peakUsed); ^ ``` **be/src/util/jvm_metrics.cpp:315:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp jvm_metrics->jvm_young_size_bytes_max->set_value(max < 0 ? 0 : max); ^ ``` **be/src/util/jvm_metrics.cpp:317:** +1, nesting level increased to 3 ```cpp } else if (it->second == memoryPoolNameEnum::OLD) { ^ ``` **be/src/util/jvm_metrics.cpp:318:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp jvm_metrics->jvm_old_size_bytes_used->set_value(used < 0 ? 0 : used); ^ ``` **be/src/util/jvm_metrics.cpp:319:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp jvm_metrics->jvm_old_size_bytes_peak_used->set_value(peakUsed < 0 ? 0 : peakUsed); ^ ``` **be/src/util/jvm_metrics.cpp:320:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp jvm_metrics->jvm_old_size_bytes_max->set_value(max < 0 ? 0 : max); ^ ``` **be/src/util/jvm_metrics.cpp:343:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp jvm_metrics->jvm_thread_peak_count->set_value(peakThreadCount < 0 ? 0 : peakThreadCount); ^ ``` **be/src/util/jvm_metrics.cpp:344:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp jvm_metrics->jvm_thread_count->set_value(threadCount < 0 ? 0 : threadCount); ^ ``` **be/src/util/jvm_metrics.cpp:346:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp for (int i = 0; i < threadCount; i++) { ^ ``` **be/src/util/jvm_metrics.cpp:348:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp if (threadInfo == nullptr) { ^ ``` **be/src/util/jvm_metrics.cpp:353:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp if (env->IsSameObject(threadState, _newThreadStateObj)) { ^ ``` **be/src/util/jvm_metrics.cpp:355:** +1, nesting level increased to 2 ```cpp } else if (env->IsSameObject(threadState, _runnableThreadStateObj)) { ^ ``` **be/src/util/jvm_metrics.cpp:357:** +1, nesting level increased to 2 ```cpp } else if (env->IsSameObject(threadState, _blockedThreadStateObj)) { ^ ``` **be/src/util/jvm_metrics.cpp:359:** +1, nesting level increased to 2 ```cpp } else if (env->IsSameObject(threadState, _waitingThreadStateObj)) { ^ ``` **be/src/util/jvm_metrics.cpp:361:** +1, nesting level increased to 2 ```cpp } else if (env->IsSameObject(threadState, _timedWaitingThreadStateObj)) { ^ ``` **be/src/util/jvm_metrics.cpp:363:** +1, nesting level increased to 2 ```cpp } else if (env->IsSameObject(threadState, _terminatedThreadStateObj)) { ^ ``` **be/src/util/jvm_metrics.cpp:370:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp jvm_metrics->jvm_thread_new_count->set_value(threadsNew < 0 ? 0 : threadsNew); ^ ``` **be/src/util/jvm_metrics.cpp:371:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp jvm_metrics->jvm_thread_runnable_count->set_value(threadsRunnable < 0 ? 0 : threadsRunnable); ^ ``` **be/src/util/jvm_metrics.cpp:372:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp jvm_metrics->jvm_thread_blocked_count->set_value(threadsBlocked < 0 ? 0 : threadsBlocked); ^ ``` **be/src/util/jvm_metrics.cpp:373:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp jvm_metrics->jvm_thread_waiting_count->set_value(threadsWaiting < 0 ? 0 : threadsWaiting); ^ ``` **be/src/util/jvm_metrics.cpp:375:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp threadsTimedWaiting < 0 ? 0 : threadsTimedWaiting); ^ ``` **be/src/util/jvm_metrics.cpp:376:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp jvm_metrics->jvm_thread_terminated_count->set_value(threadsTerminated < 0 ? 0 ^ ``` **be/src/util/jvm_metrics.cpp:384:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp for (int i = 0; i < numCollectors; i++) { ^ ``` **be/src/util/jvm_metrics.cpp:391:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp if (gcNameStr != nullptr) { ^ ``` **be/src/util/jvm_metrics.cpp:392:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (strcmp(gcNameStr, "G1 Young Generation") == 0) { ^ ``` **be/src/util/jvm_metrics.cpp:396:** +1, nesting level increased to 3 ```cpp } else { ^ ``` </details> ########## be/src/util/jvm_metrics.h: ########## @@ -17,8 +17,6 @@ #pragma once -#include <jni.h> - #include "jni.h" Review Comment: warning: 'jni.h' file not found [clang-diagnostic-error] ```cpp #include "jni.h" ^ ``` -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org