mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8026324: hs_err improvement: Add summary section to hs_err file
8026333: hs_err improvement: Print GC Strategy 8026336: hs_err improvement: Print compilation mode, server, client or tiered Added command line, summary cpu and os information to summary section. Moved time of crash and duration in summary section. Add GC strategy and compiler setting (tiered) to enhanced version string in error report. Moved the stack trace sooner in hs_err file. Reviewed-by: dholmes, ctornqvi, ddmitriev
This commit is contained in:
parent
d7f565d9eb
commit
24c0f4e471
12 changed files with 478 additions and 152 deletions
|
@ -1600,24 +1600,6 @@ void* os::dll_lookup(void* handle, const char* name) {
|
|||
return dlsym(handle, name);
|
||||
}
|
||||
|
||||
|
||||
static bool _print_ascii_file(const char* filename, outputStream* st) {
|
||||
int fd = ::open(filename, O_RDONLY);
|
||||
if (fd == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char buf[32];
|
||||
int bytes;
|
||||
while ((bytes = ::read(fd, buf, sizeof(buf))) > 0) {
|
||||
st->print_raw(buf, bytes);
|
||||
}
|
||||
|
||||
::close(fd);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int _print_dll_info_cb(const char * name, address base_address, address top_address, void * param) {
|
||||
outputStream * out = (outputStream *) param;
|
||||
out->print_cr(PTR_FORMAT " \t%s", base_address, name);
|
||||
|
@ -1678,15 +1660,38 @@ int os::get_loaded_modules_info(os::LoadedModulesCallbackFunc callback, void *pa
|
|||
#endif
|
||||
}
|
||||
|
||||
void os::print_os_info_brief(outputStream* st) {
|
||||
st->print("Bsd");
|
||||
void os::get_summary_os_info(char* buf, size_t buflen) {
|
||||
// These buffers are small because we want this to be brief
|
||||
// and not use a lot of stack while generating the hs_err file.
|
||||
char os[100];
|
||||
size_t size = sizeof(os);
|
||||
int mib_kern[] = { CTL_KERN, KERN_OSTYPE };
|
||||
if (sysctl(mib_kern, 2, os, &size, NULL, 0) < 0) {
|
||||
#ifdef __APPLE__
|
||||
strncpy(os, "Darwin", sizeof(os));
|
||||
#elif __OpenBSD__
|
||||
strncpy(os, "OpenBSD", sizeof(os));
|
||||
#else
|
||||
strncpy(os, "BSD", sizeof(os));
|
||||
#endif
|
||||
}
|
||||
|
||||
char release[100];
|
||||
size = sizeof(release);
|
||||
int mib_release[] = { CTL_KERN, KERN_OSRELEASE };
|
||||
if (sysctl(mib_release, 2, release, &size, NULL, 0) < 0) {
|
||||
// if error, leave blank
|
||||
strncpy(release, "", sizeof(release));
|
||||
}
|
||||
snprintf(buf, buflen, "%s %s", os, release);
|
||||
}
|
||||
|
||||
void os::print_os_info_brief(outputStream* st) {
|
||||
os::Posix::print_uname_info(st);
|
||||
}
|
||||
|
||||
void os::print_os_info(outputStream* st) {
|
||||
st->print("OS:");
|
||||
st->print("Bsd");
|
||||
|
||||
os::Posix::print_uname_info(st);
|
||||
|
||||
|
@ -1699,6 +1704,33 @@ void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
|
|||
// Nothing to do for now.
|
||||
}
|
||||
|
||||
void os::get_summary_cpu_info(char* buf, size_t buflen) {
|
||||
unsigned int mhz;
|
||||
size_t size = sizeof(mhz);
|
||||
int mib[] = { CTL_HW, HW_CPU_FREQ };
|
||||
if (sysctl(mib, 2, &mhz, &size, NULL, 0) < 0) {
|
||||
mhz = 1; // looks like an error but can be divided by
|
||||
} else {
|
||||
mhz /= 1000000; // reported in millions
|
||||
}
|
||||
|
||||
char model[100];
|
||||
size = sizeof(model);
|
||||
int mib_model[] = { CTL_HW, HW_MODEL };
|
||||
if (sysctl(mib_model, 2, model, &size, NULL, 0) < 0) {
|
||||
strncpy(model, cpu_arch, sizeof(model));
|
||||
}
|
||||
|
||||
char machine[100];
|
||||
size = sizeof(machine);
|
||||
int mib_machine[] = { CTL_HW, HW_MACHINE };
|
||||
if (sysctl(mib_machine, 2, machine, &size, NULL, 0) < 0) {
|
||||
strncpy(machine, "", sizeof(machine));
|
||||
}
|
||||
|
||||
snprintf(buf, buflen, "%s %s %d MHz", model, machine, mhz);
|
||||
}
|
||||
|
||||
void os::print_memory_info(outputStream* st) {
|
||||
|
||||
st->print("Memory:");
|
||||
|
@ -1709,11 +1741,6 @@ void os::print_memory_info(outputStream* st) {
|
|||
st->print("(" UINT64_FORMAT "k free)",
|
||||
os::available_memory() >> 10);
|
||||
st->cr();
|
||||
|
||||
// meminfo
|
||||
st->print("\n/proc/meminfo:\n");
|
||||
_print_ascii_file("/proc/meminfo", st);
|
||||
st->cr();
|
||||
}
|
||||
|
||||
void os::print_siginfo(outputStream* st, void* siginfo) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue