Skip to content

Commit 1343911

Browse files
committed
8340334: Update jcmd VM.events max parameter to be INT
Reviewed-by: cjplummer, kevinw
1 parent 400eb9b commit 1343911

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

src/hotspot/share/services/diagnosticCommand.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -884,21 +884,17 @@ void CodeHeapAnalyticsDCmd::execute(DCmdSource source, TRAPS) {
884884
EventLogDCmd::EventLogDCmd(outputStream* output, bool heap) :
885885
DCmdWithParser(output, heap),
886886
_log("log", "Name of log to be printed. If omitted, all logs are printed.", "STRING", false, nullptr),
887-
_max("max", "Maximum number of events to be printed (newest first). If omitted, all events are printed.", "STRING", false, nullptr)
887+
_max("max", "Maximum number of events to be printed (newest first). If omitted or zero, all events are printed.", "INT", false, "0")
888888
{
889889
_dcmdparser.add_dcmd_option(&_log);
890890
_dcmdparser.add_dcmd_option(&_max);
891891
}
892892

893893
void EventLogDCmd::execute(DCmdSource source, TRAPS) {
894-
const char* max_value = _max.value();
895-
int max = -1;
896-
if (max_value != nullptr) {
897-
char* endptr = nullptr;
898-
if (!parse_integer(max_value, &max)) {
899-
output()->print_cr("Invalid max option: \"%s\".", max_value);
900-
return;
901-
}
894+
int max = (int)_max.value();
895+
if (max < 0) {
896+
output()->print_cr("Invalid max option: \"%d\".", max);
897+
return;
902898
}
903899
const char* log_name = _log.value();
904900
if (log_name != nullptr) {

src/hotspot/share/services/diagnosticCommand.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ class ClassesDCmd : public DCmdWithParser {
889889
class EventLogDCmd : public DCmdWithParser {
890890
protected:
891891
DCmdArgument<char*> _log;
892-
DCmdArgument<char*> _max;
892+
DCmdArgument<jlong> _max;
893893
public:
894894
static int num_arguments() { return 2; }
895895
EventLogDCmd(outputStream* output, bool heap);

src/jdk.jcmd/share/man/jcmd.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ The following commands are available:
836836
- `log`: (Optional) Name of log to be printed.
837837
If omitted, all logs are printed. (STRING, no default value)
838838
- `max`: (Optional) Maximum number of events to be printed (newest first).
839-
If omitted, all events are printed. (STRING, no default value)
839+
If omitted or zero, all events are printed. (INT, 0)
840840

841841
`VM.flags` \[*options*\]
842842
: Print the VM flag options and their current values.

0 commit comments

Comments
 (0)