From 6921eca982212a5811d4c96d75150641889bff8d Mon Sep 17 00:00:00 2001 From: nloodin Date: Thu, 10 May 2012 15:44:19 +0200 Subject: 7165755: OS Information much longer on linux than other platforms Reviewed-by: sla, dholmes --- src/os/linux/vm/os_linux.cpp | 116 ++++++++++++++++++------------------------- src/os/linux/vm/os_linux.hpp | 4 ++ 2 files changed, 51 insertions(+), 69 deletions(-) (limited to 'src/os/linux') diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp index 0297df4dc..53457ec8d 100644 --- a/src/os/linux/vm/os_linux.cpp +++ b/src/os/linux/vm/os_linux.cpp @@ -2020,15 +2020,43 @@ void os::print_dll_info(outputStream *st) { } } +void os::print_os_info_brief(outputStream* st) { + os::Linux::print_distro_info(st); + + os::Posix::print_uname_info(st); + + os::Linux::print_libversion_info(st); + +} void os::print_os_info(outputStream* st) { st->print("OS:"); - // Try to identify popular distros. - // Most Linux distributions have /etc/XXX-release file, which contains - // the OS version string. Some have more than one /etc/XXX-release file - // (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.), - // so the order is important. + os::Linux::print_distro_info(st); + + os::Posix::print_uname_info(st); + + // Print warning if unsafe chroot environment detected + if (unsafe_chroot_detected) { + st->print("WARNING!! "); + st->print_cr(unstable_chroot_error); + } + + os::Linux::print_libversion_info(st); + + os::Posix::print_rlimit_info(st); + + os::Posix::print_load_average(st); + + os::Linux::print_full_memory_info(st); +} + +// Try to identify popular distros. +// Most Linux distributions have /etc/XXX-release file, which contains +// the OS version string. Some have more than one /etc/XXX-release file +// (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.), +// so the order is important. +void os::Linux::print_distro_info(outputStream* st) { if (!_print_ascii_file("/etc/mandrake-release", st) && !_print_ascii_file("/etc/sun-release", st) && !_print_ascii_file("/etc/redhat-release", st) && @@ -2041,23 +2069,9 @@ void os::print_os_info(outputStream* st) { st->print("Linux"); } st->cr(); +} - // kernel - st->print("uname:"); - struct utsname name; - uname(&name); - st->print(name.sysname); st->print(" "); - st->print(name.release); st->print(" "); - st->print(name.version); st->print(" "); - st->print(name.machine); - st->cr(); - - // Print warning if unsafe chroot environment detected - if (unsafe_chroot_detected) { - st->print("WARNING!! "); - st->print_cr(unstable_chroot_error); - } - +void os::Linux::print_libversion_info(outputStream* st) { // libc, pthread st->print("libc:"); st->print(os::Linux::glibc_version()); st->print(" "); @@ -2066,56 +2080,12 @@ void os::print_os_info(outputStream* st) { st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed"); } st->cr(); - - // rlimit - st->print("rlimit:"); - struct rlimit rlim; - - st->print(" STACK "); - getrlimit(RLIMIT_STACK, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%uk", rlim.rlim_cur >> 10); - - st->print(", CORE "); - getrlimit(RLIMIT_CORE, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%uk", rlim.rlim_cur >> 10); - - st->print(", NPROC "); - getrlimit(RLIMIT_NPROC, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%d", rlim.rlim_cur); - - st->print(", NOFILE "); - getrlimit(RLIMIT_NOFILE, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%d", rlim.rlim_cur); - - st->print(", AS "); - getrlimit(RLIMIT_AS, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%uk", rlim.rlim_cur >> 10); - st->cr(); - - // load average - st->print("load average:"); - double loadavg[3]; - os::loadavg(loadavg, 3); - st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]); - st->cr(); - - // meminfo - st->print("\n/proc/meminfo:\n"); - _print_ascii_file("/proc/meminfo", st); - st->cr(); } -void os::pd_print_cpu_info(outputStream* st) { - st->print("\n/proc/cpuinfo:\n"); - if (!_print_ascii_file("/proc/cpuinfo", st)) { - st->print(" "); - } - st->cr(); +void os::Linux::print_full_memory_info(outputStream* st) { + st->print("\n/proc/meminfo:\n"); + _print_ascii_file("/proc/meminfo", st); + st->cr(); } void os::print_memory_info(outputStream* st) { @@ -2138,6 +2108,14 @@ void os::print_memory_info(outputStream* st) { st->cr(); } +void os::pd_print_cpu_info(outputStream* st) { + st->print("\n/proc/cpuinfo:\n"); + if (!_print_ascii_file("/proc/cpuinfo", st)) { + st->print(" "); + } + st->cr(); +} + // Taken from /usr/include/bits/siginfo.h Supposed to be architecture specific // but they're the same for all the linux arch that we support // and they're the same for solaris but there's no common place to put this. diff --git a/src/os/linux/vm/os_linux.hpp b/src/os/linux/vm/os_linux.hpp index ec32232f4..7c19517e2 100644 --- a/src/os/linux/vm/os_linux.hpp +++ b/src/os/linux/vm/os_linux.hpp @@ -89,6 +89,10 @@ class Linux { static bool hugetlbfs_sanity_check(bool warn, size_t page_size); + static void print_full_memory_info(outputStream* st); + static void print_distro_info(outputStream* st); + static void print_libversion_info(outputStream* st); + public: static void init_thread_fpu_state(); static int get_fpu_control_word(); -- cgit v1.2.3