smiklosovic commented on code in PR #3420:
URL: https://github.com/apache/cassandra/pull/3420#discussion_r1679457737


##########
src/java/org/apache/cassandra/tools/nodetool/GcStats.java:
##########
@@ -31,7 +39,69 @@ public void execute(NodeProbe probe)
         double[] stats = probe.getAndResetGCStats();
         double mean = stats[2] / stats[5];
         double stdev = Math.sqrt((stats[3] / stats[5]) - (mean * mean));
+        long[] thread = probe.numberOfGCThreads();
+
+        //value of jnaLockable
+        boolean jnaLockable = NativeLibrary.jnaMemoryLockable();
+
+        OperatingSystemMXBean osBean = (OperatingSystemMXBean) 
ManagementFactory.getOperatingSystemMXBean();
+
+        long freeMemoryBytes = osBean.getFreeMemorySize();
+        long swapMemoryBytes = osBean.getFreeSwapSpaceSize();
+        long totalMemoryBytes = osBean.getTotalMemorySize();
+        long totalswapMemoryBytes = osBean.getTotalSwapSpaceSize();
+
+        String PM_freeMemoryBytes = 
FBUtilities.prettyPrintMemory(freeMemoryBytes, " ");
+        String PM_totalMemoryBytes = 
FBUtilities.prettyPrintMemory(totalMemoryBytes, " ");
+        String PM_totalswapMemoryBytes = 
FBUtilities.prettyPrintMemory(totalswapMemoryBytes, " ");
+
+        String PM_OSInUseMemoryBytes = 
FBUtilities.prettyPrintMemory(totalswapMemoryBytes - freeMemoryBytes, " ");
+        String PM_SWAPInUseMemoryBytes = 
FBUtilities.prettyPrintMemory(totalswapMemoryBytes - swapMemoryBytes, " ");
+
+        probe.output().out.println("GC Threads: " + thread[1]);
+        probe.output().out.println("Duration: " + thread[0] + " ms");
+        probe.output().out.println("MemLock: " + jnaLockable + "\n");
+
+        long osInUse = totalMemoryBytes - freeMemoryBytes;
+        double ospercent = ((double)osInUse/totalMemoryBytes) * 100;
+        probe.output().out.println("OS Free Memory Bytes: " + 
PM_freeMemoryBytes);
+        probe.output().out.println("OS Total Memory Bytes: " + 
PM_totalMemoryBytes);
+        probe.output().out.println("OS In Use: " +  PM_OSInUseMemoryBytes + " 
/ " + PM_totalMemoryBytes + " (" + String.format("%.1f", ospercent) + "%)\n");
+
+        long swapInUse = (totalswapMemoryBytes - swapMemoryBytes);
+        double swapPercent = ((double)swapInUse/totalswapMemoryBytes) * 100;

Review Comment:
   do we divide by 0 here when we do not have swap enabled?



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