diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index aae4d4d5cc7..7ee23c4670a 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -2726,39 +2726,5 @@ void os::jfr_report_memory_info() {} #endif // INCLUDE_JFR void os::print_open_file_descriptors(outputStream* st) { - char fd_dir[32]; - snprintf(fd_dir, sizeof(fd_dir), "/proc/%d/fd", getpid()); - DIR* dirp = opendir(fd_dir); - int fds = 0; - const int TIMEOUT_MS = 50; - struct timespec start, now; - clock_gettime(CLOCK_MONOTONIC, &start); - struct dirent* dentp; - bool timed_out = false; - - if (dirp == nullptr) { - st->print_cr("OpenFileDescriptorCount = unknown"); - return; - } - - // limit proc file read to 50ms - while ((dentp = readdir(dirp)) != nullptr) { - if (isdigit(dentp->d_name[0])) fds++; - if (fds % 100 == 0) { - clock_gettime(CLOCK_MONOTONIC, &now); - long elapsed_ms = (now.tv_sec - start.tv_sec) * 1000L + - (now.tv_nsec - start.tv_nsec) / 1000000L; - if (elapsed_ms > TIMEOUT_MS) { - timed_out = true; - break; - } - } - } - - closedir(dirp); - if (timed_out) { - st->print_cr("OpenFileDescriptorCount > %d", fds - 1); // minus the opendir fd itself - } else { - st->print_cr("OpenFileDescriptorCount = %d", fds - 1); - } + // File descriptor counting not supported on AIX } diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index e21b8226028..4570ccf8c89 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -1467,6 +1467,8 @@ void os::print_os_info(outputStream* st) { os::Posix::print_rlimit_info(st); + os::print_open_file_descriptors(st); + os::Posix::print_load_average(st); VM_Version::print_platform_virtualization_info(st); @@ -2592,24 +2594,24 @@ void os::print_open_file_descriptors(outputStream* st) { kres = pid_for_task(mach_task_self(), &my_pid); if (kres != KERN_SUCCESS) { - st->print_cr("OpenFileDescriptorCount = unknown"); + st->print_cr("Open File Descriptors: unknown"); return; } res = proc_pidinfo(my_pid, PROC_PIDLISTFDS, 0, fds, MAX_SAFE_FDS * sizeof(struct proc_fdinfo)); if (res <= 0) { - st->print_cr("OpenFileDescriptorCount = unknown"); + st->print_cr("Open File Descriptors: unknown"); return; } nfiles = res / sizeof(struct proc_fdinfo); if (nfiles >= MAX_SAFE_FDS) { - st->print_cr("OpenFileDescriptorCount = unknown"); + st->print_cr("Open File Descriptors > 1024"); return; } - st->print_cr("OpenFileDescriptorCount = %d", nfiles); + st->print_cr("Open File Descriptors: %d", nfiles); #else - st->print_cr("OpenFileDescriptorCount = unknown"); + st->print_cr("Open File Descriptors: unknown"); #endif } \ No newline at end of file diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 606aaa9ce61..9f9153d8458 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -2094,6 +2094,9 @@ void os::print_os_info(outputStream* st) { os::Posix::print_rlimit_info(st); + os::print_open_file_descriptors(st); + st->cr(); + os::Posix::print_load_average(st); st->cr(); @@ -5393,7 +5396,7 @@ void os::print_open_file_descriptors(outputStream* st) { bool timed_out = false; if (dirp == nullptr) { - st->print_cr("OpenFileDescriptorCount = unknown"); + st->print_cr("Open File Descriptors: unknown"); return; } @@ -5413,9 +5416,9 @@ void os::print_open_file_descriptors(outputStream* st) { closedir(dirp); if (timed_out) { - st->print_cr("OpenFileDescriptorCount > %d", fds - 1); // minus the opendir fd itself + st->print_cr("Open File Descriptors > %d", fds - 1); // minus the opendir fd itself } else { - st->print_cr("OpenFileDescriptorCount = %d", fds - 1); + st->print_cr("Open File Descriptors: %d", fds - 1); } } diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index 71095e7ac28..a290602e0be 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -1228,12 +1228,6 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } -#ifndef _WIN32 - STEP_IF("printing open file descriptor count", _verbose) - os::print_open_file_descriptors(st); - st->cr(); -#endif - STEP_IF("printing GC information", _verbose) if (Universe::heap() != nullptr) { Universe::heap()->print_gc_on(st); @@ -1439,12 +1433,6 @@ void VMError::print_vm_info(outputStream* st) { st->cr(); } - // STEP("printing number of open file descriptors") - #ifndef _WIN32 - os::print_open_file_descriptors(st); - st->cr(); - #endif - // Take heap lock over heap, GC and metaspace printing so that information // is consistent. if (Universe::is_fully_initialized()) {