Mercurial > hg > graal-compiler
diff src/share/vm/utilities/ostream.cpp @ 18041:52b4284cb496
Merge with jdk8u20-b26
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 15 Oct 2014 16:02:50 +0200 |
parents | 4ca6dc0799b6 78bbf4d43a14 |
children | 7848fc12602b |
line wrap: on
line diff
--- a/src/share/vm/utilities/ostream.cpp Thu Oct 16 10:21:29 2014 +0200 +++ b/src/share/vm/utilities/ostream.cpp Wed Oct 15 16:02:50 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,9 @@ #ifdef TARGET_OS_FAMILY_windows # include "os_windows.inline.hpp" #endif +#ifdef TARGET_OS_FAMILY_aix +# include "os_aix.inline.hpp" +#endif #ifdef TARGET_OS_FAMILY_bsd # include "os_bsd.inline.hpp" #endif @@ -265,7 +268,7 @@ size_t limit = (len + 16) / 16 * 16; for (size_t i = 0; i < limit; ++i) { if (i % 16 == 0) { - indent().print("%07x:", i); + indent().print(SIZE_FORMAT_HEX_W(07)":", i); } if (i % 2 == 0) { print(" "); @@ -286,7 +289,7 @@ } } } - print_cr(""); + cr(); } } } @@ -603,7 +606,7 @@ // memory usage and command line flags into header void gcLogFileStream::dump_loggc_header() { if (is_open()) { - print_cr(Abstract_VM_Version::internal_vm_info_string()); + print_cr("%s", Abstract_VM_Version::internal_vm_info_string()); os::print_memory_info(this); print("CommandLine flags: "); CommandLineFlags::printSetFlags(this); @@ -659,13 +662,13 @@ // write to gc log file at safepoint. If in future, changes made for mutator threads or // concurrent GC threads to run parallel with VMThread at safepoint, write and rotate_log // must be synchronized. -void gcLogFileStream::rotate_log() { +void gcLogFileStream::rotate_log(bool force, outputStream* out) { char time_msg[FILENAMEBUFLEN]; char time_str[EXTRACHARLEN]; char current_file_name[FILENAMEBUFLEN]; char renamed_file_name[FILENAMEBUFLEN]; - if (_bytes_written < (jlong)GCLogFileSize) { + if (!should_rotate(force)) { return; } @@ -682,6 +685,11 @@ jio_snprintf(time_msg, sizeof(time_msg), "File %s rotated at %s\n", _file_name, os::local_time_string((char *)time_str, sizeof(time_str))); write(time_msg, strlen(time_msg)); + + if (out != NULL) { + out->print("%s", time_msg); + } + dump_loggc_header(); return; } @@ -703,12 +711,18 @@ _file_name, _cur_file_num); jio_snprintf(current_file_name, filename_len + EXTRACHARLEN, "%s.%d" CURRENTAPPX, _file_name, _cur_file_num); - jio_snprintf(time_msg, sizeof(time_msg), "%s GC log file has reached the" - " maximum size. Saved as %s\n", - os::local_time_string((char *)time_str, sizeof(time_str)), - renamed_file_name); + + const char* msg = force ? "GC log rotation request has been received." + : "GC log file has reached the maximum size."; + jio_snprintf(time_msg, sizeof(time_msg), "%s %s Saved as %s\n", + os::local_time_string((char *)time_str, sizeof(time_str)), + msg, renamed_file_name); write(time_msg, strlen(time_msg)); + if (out != NULL) { + out->print("%s", time_msg); + } + fclose(_file); _file = NULL; @@ -749,6 +763,11 @@ os::local_time_string((char *)time_str, sizeof(time_str)), current_file_name); write(time_msg, strlen(time_msg)); + + if (out != NULL) { + out->print("%s", time_msg); + } + dump_loggc_header(); // remove the existing file if (access(current_file_name, F_OK) == 0) { @@ -826,7 +845,7 @@ xs->head("hotspot_log version='%d %d'" " process='%d' time_ms='"INT64_FORMAT"'", LOG_MAJOR_VERSION, LOG_MINOR_VERSION, - os::current_process_id(), time_ms); + os::current_process_id(), (int64_t)time_ms); // Write VM version header immediately. xs->head("vm_version"); xs->head("name"); xs->text("%s", VM_Version::vm_name()); xs->cr(); @@ -1238,7 +1257,7 @@ #ifndef PRODUCT -#if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE) +#if defined(SOLARIS) || defined(LINUX) || defined(AIX) || defined(_ALLBSD_SOURCE) #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h>