8340334: Update jcmd VM.events max parameter to be INT
Reviewed-by: cjplummer, kevinw
This commit is contained in:
parent
400eb9b10a
commit
13439113c3
@ -884,21 +884,17 @@ void CodeHeapAnalyticsDCmd::execute(DCmdSource source, TRAPS) {
|
|||||||
EventLogDCmd::EventLogDCmd(outputStream* output, bool heap) :
|
EventLogDCmd::EventLogDCmd(outputStream* output, bool heap) :
|
||||||
DCmdWithParser(output, heap),
|
DCmdWithParser(output, heap),
|
||||||
_log("log", "Name of log to be printed. If omitted, all logs are printed.", "STRING", false, nullptr),
|
_log("log", "Name of log to be printed. If omitted, all logs are printed.", "STRING", false, nullptr),
|
||||||
_max("max", "Maximum number of events to be printed (newest first). If omitted, all events are printed.", "STRING", false, nullptr)
|
_max("max", "Maximum number of events to be printed (newest first). If omitted or zero, all events are printed.", "INT", false, "0")
|
||||||
{
|
{
|
||||||
_dcmdparser.add_dcmd_option(&_log);
|
_dcmdparser.add_dcmd_option(&_log);
|
||||||
_dcmdparser.add_dcmd_option(&_max);
|
_dcmdparser.add_dcmd_option(&_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventLogDCmd::execute(DCmdSource source, TRAPS) {
|
void EventLogDCmd::execute(DCmdSource source, TRAPS) {
|
||||||
const char* max_value = _max.value();
|
int max = (int)_max.value();
|
||||||
int max = -1;
|
if (max < 0) {
|
||||||
if (max_value != nullptr) {
|
output()->print_cr("Invalid max option: \"%d\".", max);
|
||||||
char* endptr = nullptr;
|
return;
|
||||||
if (!parse_integer(max_value, &max)) {
|
|
||||||
output()->print_cr("Invalid max option: \"%s\".", max_value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const char* log_name = _log.value();
|
const char* log_name = _log.value();
|
||||||
if (log_name != nullptr) {
|
if (log_name != nullptr) {
|
||||||
|
@ -889,7 +889,7 @@ public:
|
|||||||
class EventLogDCmd : public DCmdWithParser {
|
class EventLogDCmd : public DCmdWithParser {
|
||||||
protected:
|
protected:
|
||||||
DCmdArgument<char*> _log;
|
DCmdArgument<char*> _log;
|
||||||
DCmdArgument<char*> _max;
|
DCmdArgument<jlong> _max;
|
||||||
public:
|
public:
|
||||||
static int num_arguments() { return 2; }
|
static int num_arguments() { return 2; }
|
||||||
EventLogDCmd(outputStream* output, bool heap);
|
EventLogDCmd(outputStream* output, bool heap);
|
||||||
|
@ -836,7 +836,7 @@ The following commands are available:
|
|||||||
- `log`: (Optional) Name of log to be printed.
|
- `log`: (Optional) Name of log to be printed.
|
||||||
If omitted, all logs are printed. (STRING, no default value)
|
If omitted, all logs are printed. (STRING, no default value)
|
||||||
- `max`: (Optional) Maximum number of events to be printed (newest first).
|
- `max`: (Optional) Maximum number of events to be printed (newest first).
|
||||||
If omitted, all events are printed. (STRING, no default value)
|
If omitted or zero, all events are printed. (INT, 0)
|
||||||
|
|
||||||
`VM.flags` \[*options*\]
|
`VM.flags` \[*options*\]
|
||||||
: Print the VM flag options and their current values.
|
: Print the VM flag options and their current values.
|
||||||
|
Loading…
Reference in New Issue
Block a user