anmolanmol1234 commented on code in PR #8056:
URL: https://github.com/apache/hadoop/pull/8056#discussion_r2545888622


##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsCountersImpl.java:
##########
@@ -267,6 +298,22 @@ public AbfsReadFooterMetrics getAbfsReadFooterMetrics() {
     return abfsReadFooterMetrics != null ? abfsReadFooterMetrics : null;
   }
 
+  /**
+   * Returns the write thread pool metrics instance, or {@code null} if 
uninitialized.
+   */
+  @Override
+  public AbfsWriteThreadPoolMetrics getAbfsWriteThreadPoolMetrics() {
+    return abfsWriteThreadPoolMetrics != null ? abfsWriteThreadPoolMetrics : 
null;

Review Comment:
   taken



##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/WriteThreadPoolSizeManager.java:
##########
@@ -255,19 +289,43 @@ private double getCpuUtilization() {
     OperatingSystemMXBean osBean = ManagementFactory.getPlatformMXBean(
         OperatingSystemMXBean.class);
     double cpuLoad = osBean.getSystemCpuLoad();
-    if (cpuLoad < 0) {
+    if (cpuLoad < ZERO) {
       LOG.warn("System CPU load value unavailable (returned -1.0). Defaulting 
to 0.0.");
-      return 0.0;
+      return ZERO_D;
     }
     return cpuLoad;
   }
 
+  /**
+   * Returns the CPU utilization of the JVM process as a percentage (0–100).
+   */
+  public static double getJvmCpuUtilization() {
+    OperatingSystemMXBean osBean =
+        (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
+    long cpuTime = osBean.getProcessCpuTime();
+    long now = System.nanoTime();
+    if (lastTime == ZERO) {
+      lastCpuTime = cpuTime;
+      lastTime = now;
+      return 0.0; // first call has no previous data

Review Comment:
   removed this piece of code



-- 
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]

Reply via email to