8085865: hs_err improvement: Printing /proc/cpuinfo makes too long hs_err files
Summarize information from linux-x86; it's too long and redundant Reviewed-by: gtriantafill, dholmes, mgerdin, dcubed
This commit is contained in:
parent
709d3d936e
commit
29a1b9c2ed
@ -1653,7 +1653,7 @@ void os::print_memory_info(outputStream* st) {
|
||||
}
|
||||
}
|
||||
|
||||
void os::pd_print_cpu_info(outputStream* st) {
|
||||
void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
|
||||
// cpu
|
||||
st->print("CPU:");
|
||||
st->print("total %d", os::processor_count());
|
||||
|
@ -1706,7 +1706,7 @@ void os::print_os_info(outputStream* st) {
|
||||
os::Posix::print_load_average(st);
|
||||
}
|
||||
|
||||
void os::pd_print_cpu_info(outputStream* st) {
|
||||
void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
|
||||
// Nothing to do for now.
|
||||
}
|
||||
|
||||
|
@ -2215,12 +2215,52 @@ 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(" <Not Available>");
|
||||
// Print the first "model name" line and the first "flags" line
|
||||
// that we find and nothing more. We assume "model name" comes
|
||||
// before "flags" so if we find a second "model name", then the
|
||||
// "flags" field is considered missing.
|
||||
static bool print_model_name_and_flags(outputStream* st, char* buf, size_t buflen) {
|
||||
#if defined(IA32) || defined(AMD64)
|
||||
// Other platforms have less repetitive cpuinfo files
|
||||
FILE *fp = fopen("/proc/cpuinfo", "r");
|
||||
if (fp) {
|
||||
while (!feof(fp)) {
|
||||
if (fgets(buf, buflen, fp)) {
|
||||
// Assume model name comes before flags
|
||||
bool model_name_printed = false;
|
||||
if (strstr(buf, "model name") != NULL) {
|
||||
if (!model_name_printed) {
|
||||
st->print_raw("\nCPU Model and flags from /proc/cpuinfo:\n");
|
||||
st->print_raw(buf);
|
||||
model_name_printed = true;
|
||||
} else {
|
||||
// model name printed but not flags? Odd, just return
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// print the flags line too
|
||||
if (strstr(buf, "flags") != NULL) {
|
||||
st->print_raw(buf);
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
#endif // x86 platforms
|
||||
return false;
|
||||
}
|
||||
|
||||
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)) {
|
||||
st->print("\n/proc/cpuinfo:\n");
|
||||
if (!_print_ascii_file("/proc/cpuinfo", st)) {
|
||||
st->print_cr(" <Not Available>");
|
||||
}
|
||||
}
|
||||
st->cr();
|
||||
}
|
||||
|
||||
void os::print_siginfo(outputStream* st, void* siginfo) {
|
||||
|
@ -1996,7 +1996,7 @@ static bool check_addr0(outputStream* st) {
|
||||
return status;
|
||||
}
|
||||
|
||||
void os::pd_print_cpu_info(outputStream* st) {
|
||||
void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
|
||||
// Nothing to do for now.
|
||||
}
|
||||
|
||||
|
@ -1732,7 +1732,7 @@ void os::win32::print_windows_version(outputStream* st) {
|
||||
st->cr();
|
||||
}
|
||||
|
||||
void os::pd_print_cpu_info(outputStream* st) {
|
||||
void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
|
||||
// Nothing to do for now.
|
||||
}
|
||||
|
||||
|
@ -832,7 +832,7 @@ void os::print_environment_variables(outputStream* st, const char** env_list) {
|
||||
}
|
||||
}
|
||||
|
||||
void os::print_cpu_info(outputStream* st) {
|
||||
void os::print_cpu_info(outputStream* st, char* buf, size_t buflen) {
|
||||
// cpu
|
||||
st->print("CPU:");
|
||||
st->print("total %d", os::processor_count());
|
||||
@ -840,7 +840,7 @@ void os::print_cpu_info(outputStream* st) {
|
||||
// st->print("(active %d)", os::active_processor_count());
|
||||
st->print(" %s", VM_Version::cpu_features());
|
||||
st->cr();
|
||||
pd_print_cpu_info(st);
|
||||
pd_print_cpu_info(st, buf, buflen);
|
||||
}
|
||||
|
||||
void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) {
|
||||
|
@ -587,8 +587,8 @@ class os: AllStatic {
|
||||
// Output format may be different on different platforms.
|
||||
static void print_os_info(outputStream* st);
|
||||
static void print_os_info_brief(outputStream* st);
|
||||
static void print_cpu_info(outputStream* st);
|
||||
static void pd_print_cpu_info(outputStream* st);
|
||||
static void print_cpu_info(outputStream* st, char* buf, size_t buflen);
|
||||
static void pd_print_cpu_info(outputStream* st, char* buf, size_t buflen);
|
||||
static void print_memory_info(outputStream* st);
|
||||
static void print_dll_info(outputStream* st);
|
||||
static void print_environment_variables(outputStream* st, const char** env_list);
|
||||
|
@ -280,7 +280,8 @@ void VM_Version_init() {
|
||||
|
||||
#ifndef PRODUCT
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
os::print_cpu_info(tty);
|
||||
char buf[512];
|
||||
os::print_cpu_info(tty, buf, sizeof(buf));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -816,7 +816,7 @@ void VMError::report(outputStream* st) {
|
||||
|
||||
STEP(250, "(printing CPU info)" )
|
||||
if (_verbose) {
|
||||
os::print_cpu_info(st);
|
||||
os::print_cpu_info(st, buf, sizeof(buf));
|
||||
st->cr();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user