Merge
This commit is contained in:
commit
c68110a135
@ -464,7 +464,7 @@ void LogConfiguration::print_command_line_help(FILE* out) {
|
|||||||
" -Xlog:gc=debug:file=gc.txt:none\n"
|
" -Xlog:gc=debug:file=gc.txt:none\n"
|
||||||
"\t Log messages tagged with 'gc' tag using 'debug' level to file 'gc.txt' with no decorations.\n\n"
|
"\t Log messages tagged with 'gc' tag using 'debug' level to file 'gc.txt' with no decorations.\n\n"
|
||||||
|
|
||||||
" -Xlog:gc=trace:file=gctrace.txt:uptimemillis,pids:filecount=5,filesize=1024\n"
|
" -Xlog:gc=trace:file=gctrace.txt:uptimemillis,pids:filecount=5,filesize=1m\n"
|
||||||
"\t Log messages tagged with 'gc' tag using 'trace' level to a rotating fileset of 5 files of size 1MB,\n"
|
"\t Log messages tagged with 'gc' tag using 'trace' level to a rotating fileset of 5 files of size 1MB,\n"
|
||||||
"\t using the base name 'gctrace.txt', with 'uptimemillis' and 'pid' decorations.\n\n"
|
"\t using the base name 'gctrace.txt', with 'uptimemillis' and 'pid' decorations.\n\n"
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "logging/logConfiguration.hpp"
|
#include "logging/logConfiguration.hpp"
|
||||||
#include "logging/logFileOutput.hpp"
|
#include "logging/logFileOutput.hpp"
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
|
#include "runtime/arguments.hpp"
|
||||||
#include "runtime/os.inline.hpp"
|
#include "runtime/os.inline.hpp"
|
||||||
#include "utilities/globalDefinitions.hpp"
|
#include "utilities/globalDefinitions.hpp"
|
||||||
#include "utilities/defaultStream.hpp"
|
#include "utilities/defaultStream.hpp"
|
||||||
@ -187,14 +188,15 @@ bool LogFileOutput::parse_options(const char* options, outputStream* errstream)
|
|||||||
}
|
}
|
||||||
_file_count = static_cast<uint>(value);
|
_file_count = static_cast<uint>(value);
|
||||||
} else if (strcmp(FileSizeOptionKey, key) == 0) {
|
} else if (strcmp(FileSizeOptionKey, key) == 0) {
|
||||||
size_t value = parse_value(value_str);
|
julong value;
|
||||||
if (value == SIZE_MAX || value > SIZE_MAX / K) {
|
success = Arguments::atojulong(value_str, &value);
|
||||||
|
if (!success || (value > SIZE_MAX)) {
|
||||||
errstream->print_cr("Invalid option: %s must be in range [0, "
|
errstream->print_cr("Invalid option: %s must be in range [0, "
|
||||||
SIZE_FORMAT "]", FileSizeOptionKey, SIZE_MAX / K);
|
SIZE_FORMAT "]", FileSizeOptionKey, SIZE_MAX);
|
||||||
success = false;
|
success = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_rotate_size = value * K;
|
_rotate_size = static_cast<size_t>(value);
|
||||||
} else {
|
} else {
|
||||||
errstream->print_cr("Invalid option '%s' for log file output.", key);
|
errstream->print_cr("Invalid option '%s' for log file output.", key);
|
||||||
success = false;
|
success = false;
|
||||||
|
@ -778,8 +778,8 @@ char* ArgumentBootClassPath::add_jars_to_path(char* path, const char* directory)
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parses a memory size specification string.
|
// Parses a size specification string.
|
||||||
static bool atomull(const char *s, julong* result) {
|
bool Arguments::atojulong(const char *s, julong* result) {
|
||||||
julong n = 0;
|
julong n = 0;
|
||||||
int args_read = 0;
|
int args_read = 0;
|
||||||
bool is_hex = false;
|
bool is_hex = false;
|
||||||
@ -885,7 +885,7 @@ static bool set_numeric_flag(const char* name, char* value, Flag::Flags origin)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the sign first since atomull() parses only unsigned values.
|
// Check the sign first since atojulong() parses only unsigned values.
|
||||||
if (*value == '-') {
|
if (*value == '-') {
|
||||||
if (!result->is_intx() && !result->is_int()) {
|
if (!result->is_intx() && !result->is_int()) {
|
||||||
return false;
|
return false;
|
||||||
@ -893,7 +893,7 @@ static bool set_numeric_flag(const char* name, char* value, Flag::Flags origin)
|
|||||||
value++;
|
value++;
|
||||||
is_neg = true;
|
is_neg = true;
|
||||||
}
|
}
|
||||||
if (!atomull(value, &v)) {
|
if (!Arguments::atojulong(value, &v)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (result->is_int()) {
|
if (result->is_int()) {
|
||||||
@ -2693,12 +2693,12 @@ bool Arguments::parse_uintx(const char* value,
|
|||||||
uintx* uintx_arg,
|
uintx* uintx_arg,
|
||||||
uintx min_size) {
|
uintx min_size) {
|
||||||
|
|
||||||
// Check the sign first since atomull() parses only unsigned values.
|
// Check the sign first since atojulong() parses only unsigned values.
|
||||||
bool value_is_positive = !(*value == '-');
|
bool value_is_positive = !(*value == '-');
|
||||||
|
|
||||||
if (value_is_positive) {
|
if (value_is_positive) {
|
||||||
julong n;
|
julong n;
|
||||||
bool good_return = atomull(value, &n);
|
bool good_return = atojulong(value, &n);
|
||||||
if (good_return) {
|
if (good_return) {
|
||||||
bool above_minimum = n >= min_size;
|
bool above_minimum = n >= min_size;
|
||||||
bool value_is_too_large = n > max_uintx;
|
bool value_is_too_large = n > max_uintx;
|
||||||
@ -2715,7 +2715,7 @@ bool Arguments::parse_uintx(const char* value,
|
|||||||
Arguments::ArgsRange Arguments::parse_memory_size(const char* s,
|
Arguments::ArgsRange Arguments::parse_memory_size(const char* s,
|
||||||
julong* long_arg,
|
julong* long_arg,
|
||||||
julong min_size) {
|
julong min_size) {
|
||||||
if (!atomull(s, long_arg)) return arg_unreadable;
|
if (!atojulong(s, long_arg)) return arg_unreadable;
|
||||||
return check_memory_size(*long_arg, min_size);
|
return check_memory_size(*long_arg, min_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -729,6 +729,8 @@ class Arguments : AllStatic {
|
|||||||
static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen);
|
static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen);
|
||||||
|
|
||||||
static void check_unsupported_dumping_properties() NOT_CDS_RETURN;
|
static void check_unsupported_dumping_properties() NOT_CDS_RETURN;
|
||||||
|
|
||||||
|
static bool atojulong(const char *s, julong* result);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Disable options not supported in this release, with a warning if they
|
// Disable options not supported in this release, with a warning if they
|
||||||
|
@ -75,7 +75,7 @@ public class TestLogRotation {
|
|||||||
ArrayList<String> args = new ArrayList();
|
ArrayList<String> args = new ArrayList();
|
||||||
String[] logOpts = new String[]{
|
String[] logOpts = new String[]{
|
||||||
"-cp", System.getProperty("java.class.path"),
|
"-cp", System.getProperty("java.class.path"),
|
||||||
"-Xlog:gc=debug:" + logFileName + "::filesize=" + logFileSizeK + ",filecount=" + numberOfFiles,
|
"-Xlog:gc=debug:" + logFileName + "::filesize=" + logFileSizeK + "k,filecount=" + numberOfFiles,
|
||||||
"-XX:-DisableExplicitGC", // to ensure that System.gc() works
|
"-XX:-DisableExplicitGC", // to ensure that System.gc() works
|
||||||
"-Xmx128M"};
|
"-Xmx128M"};
|
||||||
// System.getProperty("test.java.opts") is '' if no options is set
|
// System.getProperty("test.java.opts") is '' if no options is set
|
||||||
|
Loading…
x
Reference in New Issue
Block a user