1 Star 0 Fork 84

zhaosai/openjdk-1.8.0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Record-the-number-of-processes-to-errlog-file.patch.patch 1.97 KB
一键复制 编辑 原始数据 按行查看 历史
DXwangg 提交于 2023-09-26 09:10 +08:00 . Add feature and bug fix for 8u382
From 752494be2626cb819c92269e26f53833b2538160 Mon Sep 17 00:00:00 2001
Date: Thu, 21 Sep 2023 14:46:56 +0800
Subject: Record-the-number-of-processes-to-errlog-file.patch
---
hotspot/src/os/linux/vm/os_linux.cpp | 24 ++++++++++++++++++++++++
hotspot/src/os/linux/vm/os_linux.hpp | 1 +
2 files changed, 25 insertions(+)
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index 72839eb5a..a1cc85ca3 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -2256,6 +2256,10 @@ void os::print_os_info(outputStream* st) {
os::Posix::print_load_average(st);
+ if (ExtensiveErrorReports) {
+ os::Linux::print_system_process_count(st);
+ }
+
os::Linux::print_system_memory_info(st);
st->cr();
@@ -2323,6 +2327,26 @@ void os::Linux::print_libversion_info(outputStream* st) {
st->cr();
}
+void os::Linux::print_system_process_count(outputStream* st) {
+ // system process count
+ DIR *dir = opendir("/proc");
+ if (dir == NULL) {
+ return;
+ }
+
+ st->print("system process count:");
+ uint count = 0;
+ struct dirent *ptr;
+ while ((ptr = readdir(dir)) != NULL) {
+ if(ptr->d_type == DT_DIR && isdigit((ptr->d_name)[0])) {
+ count++;
+ }
+ }
+ (void) closedir(dir);
+ st->print("%u", count);
+ st->cr();
+}
+
void os::Linux::print_system_memory_info(outputStream* st) {
st->print("\n/proc/meminfo:\n");
_print_ascii_file("/proc/meminfo", st);
diff --git a/hotspot/src/os/linux/vm/os_linux.hpp b/hotspot/src/os/linux/vm/os_linux.hpp
index a516335d2..19dde2e58 100644
--- a/hotspot/src/os/linux/vm/os_linux.hpp
+++ b/hotspot/src/os/linux/vm/os_linux.hpp
@@ -124,6 +124,7 @@ class Linux {
static void print_container_info(outputStream* st);
static void print_distro_info(outputStream* st);
static void print_libversion_info(outputStream* st);
+ static void print_system_process_count(outputStream* st);
static void print_proc_sys_info(outputStream* st);
public:
--
2.22.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhaosai-Simon/openjdk-1.8.0.git
git@gitee.com:zhaosai-Simon/openjdk-1.8.0.git
zhaosai-Simon
openjdk-1.8.0
openjdk-1.8.0
master

搜索帮助