thetumbled commented on code in PR #17820:
URL: https://github.com/apache/pulsar/pull/17820#discussion_r1005150306
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/LinuxInfoUtils.java:
##########
@@ -72,6 +73,26 @@ public static boolean isCGroupEnabled() {
}
}
+ /**
+ * Get total cpu count.
+ * @return Total cpu count
+ */
+ public static int getTotalCpuCount() throws IOException {
+ int totalCpuCount = 0;
+ String[] ranges =
readTrimStringFromFile(Paths.get(CGROUPS_CPU_CPUSET_CPUS)).split(",");
+ for (String range : ranges) {
+ if (!range.contains("-")) {
+ totalCpuCount++;
+ } else {
+ int dashIndex = range.indexOf('-');
+ int left = Integer.parseInt(range.substring(0, dashIndex));
Review Comment:
done.
--
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]