67 lines
2.0 KiB
Diff
67 lines
2.0 KiB
Diff
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
|
|
|