Skip to content
Permalink
Browse files
8246926: Clean up newlines and whitespaces in hs_err files
Reviewed-by: dholmes, eosterlund, iklam
  • Loading branch information
stefank committed Jun 10, 2020
1 parent 90a774b commit 8e865fc569cf29ccad746b77f6f73de53f303788
Showing 9 changed files with 60 additions and 53 deletions.
@@ -1368,7 +1368,7 @@ void os::print_os_info_brief(outputStream* st) {
}

void os::print_os_info(outputStream* st) {
st->print("OS:");
st->print_cr("OS:");

os::Posix::print_uname_info(st);

@@ -2069,8 +2069,8 @@ static bool _print_ascii_file(const char* filename, outputStream* st, const char
return true;
}

static void _print_ascii_file_h(const char* header, const char* filename, outputStream* st) {
st->print_cr("%s:", header);
static void _print_ascii_file_h(const char* header, const char* filename, outputStream* st, bool same_line = true) {
st->print("%s:%c", header, same_line ? ' ' : '\n');
if (!_print_ascii_file(filename, st)) {
st->print_cr("<Not Available>");
}
@@ -2085,7 +2085,7 @@ void os::print_dll_info(outputStream *st) {
jio_snprintf(fname, sizeof(fname), "/proc/%d/maps", pid);

if (!_print_ascii_file(fname, st)) {
st->print("Can not get library information for pid = %d\n", pid);
st->print_cr("Can not get library information for pid = %d", pid);
}
}

@@ -2137,7 +2137,7 @@ void os::print_os_info_brief(outputStream* st) {
}

void os::print_os_info(outputStream* st) {
st->print("OS:");
st->print_cr("OS:");

os::Linux::print_distro_info(st);

@@ -2147,23 +2147,29 @@ void os::print_os_info(outputStream* st) {

// Print warning if unsafe chroot environment detected
if (unsafe_chroot_detected) {
st->print("WARNING!! ");
st->print_cr("%s", unstable_chroot_error);
st->print_cr("WARNING!! %s", unstable_chroot_error);
}

os::Linux::print_libversion_info(st);

os::Posix::print_rlimit_info(st);

os::Posix::print_load_average(st);
st->cr();

os::Linux::print_full_memory_info(st);
st->cr();

os::Linux::print_proc_sys_info(st);
st->cr();

os::Linux::print_ld_preload_file(st);
if (os::Linux::print_ld_preload_file(st)) {
st->cr();
}

os::Linux::print_container_info(st);
if (os::Linux::print_container_info(st)) {
st->cr();
}

VM_Version::print_platform_virtualization_info(st);

@@ -2224,9 +2230,8 @@ void os::Linux::print_distro_info(outputStream* st) {
st->print("Debian ");
_print_ascii_file("/etc/debian_version", st);
} else {
st->print("Linux");
st->print_cr("Linux");
}
st->cr();
}

static void parse_os_info_helper(FILE* fp, char* distro, size_t length, bool get_first_line) {
@@ -2295,14 +2300,13 @@ void os::get_summary_os_info(char* buf, size_t buflen) {

void os::Linux::print_libversion_info(outputStream* st) {
// libc, pthread
st->print("libc:");
st->print("libc: ");
st->print("%s ", os::Linux::glibc_version());
st->print("%s ", os::Linux::libpthread_version());
st->cr();
}

void os::Linux::print_proc_sys_info(outputStream* st) {
st->cr();
_print_ascii_file_h("/proc/sys/kernel/threads-max (system-wide limit on the number of threads)",
"/proc/sys/kernel/threads-max", st);
_print_ascii_file_h("/proc/sys/vm/max_map_count (maximum number of memory map areas a process may have)",
@@ -2312,7 +2316,7 @@ void os::Linux::print_proc_sys_info(outputStream* st) {
}

void os::Linux::print_full_memory_info(outputStream* st) {
_print_ascii_file_h("\n/proc/meminfo", "/proc/meminfo", st);
_print_ascii_file_h("/proc/meminfo", "/proc/meminfo", st, false);
st->cr();

// some information regarding THPs; for details see
@@ -2323,9 +2327,8 @@ void os::Linux::print_full_memory_info(outputStream* st) {
"/sys/kernel/mm/transparent_hugepage/defrag", st);
}

void os::Linux::print_ld_preload_file(outputStream* st) {
_print_ascii_file("/etc/ld.so.preload", st, "\n/etc/ld.so.preload:");
st->cr();
bool os::Linux::print_ld_preload_file(outputStream* st) {
return _print_ascii_file("/etc/ld.so.preload", st, "/etc/ld.so.preload:");
}

void os::Linux::print_uptime_info(outputStream* st) {
@@ -2336,97 +2339,97 @@ void os::Linux::print_uptime_info(outputStream* st) {
}
}


void os::Linux::print_container_info(outputStream* st) {
bool os::Linux::print_container_info(outputStream* st) {
if (!OSContainer::is_containerized()) {
return;
return false;
}

st->print("container (cgroup) information:\n");
st->print_cr("container (cgroup) information:");

const char *p_ct = OSContainer::container_type();
st->print("container_type: %s\n", p_ct != NULL ? p_ct : "not supported");
st->print_cr("container_type: %s", p_ct != NULL ? p_ct : "not supported");

char *p = OSContainer::cpu_cpuset_cpus();
st->print("cpu_cpuset_cpus: %s\n", p != NULL ? p : "not supported");
st->print_cr("cpu_cpuset_cpus: %s", p != NULL ? p : "not supported");
free(p);

p = OSContainer::cpu_cpuset_memory_nodes();
st->print("cpu_memory_nodes: %s\n", p != NULL ? p : "not supported");
st->print_cr("cpu_memory_nodes: %s", p != NULL ? p : "not supported");
free(p);

int i = OSContainer::active_processor_count();
st->print("active_processor_count: ");
if (i > 0) {
st->print("%d\n", i);
st->print_cr("%d", i);
} else {
st->print("not supported\n");
st->print_cr("not supported");
}

i = OSContainer::cpu_quota();
st->print("cpu_quota: ");
if (i > 0) {
st->print("%d\n", i);
st->print_cr("%d", i);
} else {
st->print("%s\n", i == OSCONTAINER_ERROR ? "not supported" : "no quota");
st->print_cr("%s", i == OSCONTAINER_ERROR ? "not supported" : "no quota");
}

i = OSContainer::cpu_period();
st->print("cpu_period: ");
if (i > 0) {
st->print("%d\n", i);
st->print_cr("%d", i);
} else {
st->print("%s\n", i == OSCONTAINER_ERROR ? "not supported" : "no period");
st->print_cr("%s", i == OSCONTAINER_ERROR ? "not supported" : "no period");
}

i = OSContainer::cpu_shares();
st->print("cpu_shares: ");
if (i > 0) {
st->print("%d\n", i);
st->print_cr("%d", i);
} else {
st->print("%s\n", i == OSCONTAINER_ERROR ? "not supported" : "no shares");
st->print_cr("%s", i == OSCONTAINER_ERROR ? "not supported" : "no shares");
}

jlong j = OSContainer::memory_limit_in_bytes();
st->print("memory_limit_in_bytes: ");
if (j > 0) {
st->print(JLONG_FORMAT "\n", j);
st->print_cr(JLONG_FORMAT, j);
} else {
st->print("%s\n", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
st->print_cr("%s", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
}

j = OSContainer::memory_and_swap_limit_in_bytes();
st->print("memory_and_swap_limit_in_bytes: ");
if (j > 0) {
st->print(JLONG_FORMAT "\n", j);
st->print_cr(JLONG_FORMAT, j);
} else {
st->print("%s\n", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
st->print_cr("%s", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
}

j = OSContainer::memory_soft_limit_in_bytes();
st->print("memory_soft_limit_in_bytes: ");
if (j > 0) {
st->print(JLONG_FORMAT "\n", j);
st->print_cr(JLONG_FORMAT, j);
} else {
st->print("%s\n", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
st->print_cr("%s", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
}

j = OSContainer::OSContainer::memory_usage_in_bytes();
st->print("memory_usage_in_bytes: ");
if (j > 0) {
st->print(JLONG_FORMAT "\n", j);
st->print_cr(JLONG_FORMAT, j);
} else {
st->print("%s\n", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
st->print_cr("%s", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
}

j = OSContainer::OSContainer::memory_max_usage_in_bytes();
st->print("memory_max_usage_in_bytes: ");
if (j > 0) {
st->print(JLONG_FORMAT "\n", j);
st->print_cr(JLONG_FORMAT, j);
} else {
st->print("%s\n", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
st->print_cr("%s", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
}
st->cr();

return true;
}

void os::Linux::print_steal_info(outputStream* st) {
@@ -2556,8 +2559,9 @@ static void print_sys_devices_cpu_info(outputStream* st, char* buf, size_t bufle
void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
// Only print the model name if the platform provides this as a summary
if (!print_model_name_and_flags(st, buf, buflen)) {
_print_ascii_file_h("\n/proc/cpuinfo", "/proc/cpuinfo", st);
_print_ascii_file_h("/proc/cpuinfo", "/proc/cpuinfo", st, false);
}
st->cr();
print_sys_devices_cpu_info(st, buf, buflen);
}

@@ -102,12 +102,12 @@ class Linux {
static bool release_memory_special_huge_tlbfs(char* base, size_t bytes);

static void print_full_memory_info(outputStream* st);
static void print_container_info(outputStream* st);
static bool print_container_info(outputStream* st);
static void print_steal_info(outputStream* st);
static void print_distro_info(outputStream* st);
static void print_libversion_info(outputStream* st);
static void print_proc_sys_info(outputStream* st);
static void print_ld_preload_file(outputStream* st);
static bool print_ld_preload_file(outputStream* st);
static void print_uptime_info(outputStream* st);

public:
@@ -396,7 +396,7 @@ struct tm* os::gmtime_pd(const time_t* clock, struct tm* res) {
}

void os::Posix::print_load_average(outputStream* st) {
st->print("load average:");
st->print("load average: ");
double loadavg[3];
int res = os::loadavg(loadavg, 3);
if (res != -1) {
@@ -490,7 +490,7 @@ void os::Posix::print_rlimit_info(outputStream* st) {

void os::Posix::print_uname_info(outputStream* st) {
// kernel
st->print("uname:");
st->print("uname: ");
struct utsname name;
uname(&name);
st->print("%s ", name.sysname);
@@ -1607,7 +1607,7 @@ void os::print_os_info(outputStream* st) {
st->print("N/A ");
}
#endif
st->print("OS:");
st->print_cr("OS:");
os::win32::print_windows_version(st);

os::win32::print_uptime_info(st);
@@ -2555,7 +2555,10 @@ void G1CollectedHeap::print_extended_on(outputStream* st) const {
print_on(st);

// Print the per-region information.
print_regions_on(st);
if (_hrm != NULL) {
st->cr();
print_regions_on(st);
}
}

void G1CollectedHeap::print_on_error(outputStream* st) const {
@@ -959,7 +959,7 @@ void os::print_environment_variables(outputStream* st, const char** env_list) {
void os::print_cpu_info(outputStream* st, char* buf, size_t buflen) {
// cpu
st->print("CPU:");
st->print("total %d", os::processor_count());
st->print(" total %d", os::processor_count());
// It's not safe to query number of active processors after crash
// st->print("(active %d)", os::active_processor_count()); but we can
// print the initial number of active processors.
@@ -878,7 +878,7 @@ void VMError::report(outputStream* st, bool _verbose) {

if (_verbose) {
// Safepoint state
st->print("VM state:");
st->print("VM state: ");

if (SafepointSynchronize::is_synchronizing()) st->print("synchronizing");
else if (SafepointSynchronize::is_at_safepoint()) st->print("at safepoint");
@@ -45,7 +45,7 @@ static void analyzeOutputForOsLog(OutputAnalyzer output) throws Exception {
}

static void analyzeOutputForOsCpuLog(OutputAnalyzer output) throws Exception {
output.shouldContain("CPU:total");
output.shouldContain("CPU: total");
output.shouldHaveExitValue(0);
}

0 comments on commit 8e865fc

Please sign in to comment.