mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-15 16:44:36 +02:00
8216995: Clean up JFR command line processing
Reviewed-by: gziemski, mgronlun
This commit is contained in:
parent
53c8dfdd07
commit
045cf9733d
2 changed files with 10 additions and 17 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -44,31 +44,22 @@
|
||||||
#include "logging/logStream.hpp"
|
#include "logging/logStream.hpp"
|
||||||
#include "memory/resourceArea.inline.hpp"
|
#include "memory/resourceArea.inline.hpp"
|
||||||
#include "runtime/handles.inline.hpp"
|
#include "runtime/handles.inline.hpp"
|
||||||
#include "runtime/flags/jvmFlag.hpp"
|
#include "runtime/globals_extension.hpp"
|
||||||
#include "runtime/globals.hpp"
|
|
||||||
#include "utilities/growableArray.hpp"
|
#include "utilities/growableArray.hpp"
|
||||||
|
|
||||||
static bool is_disabled_on_command_line() {
|
|
||||||
static const size_t length = strlen("FlightRecorder");
|
|
||||||
static JVMFlag* const flight_recorder_flag = JVMFlag::find_flag("FlightRecorder", length);
|
|
||||||
assert(flight_recorder_flag != NULL, "invariant");
|
|
||||||
return flight_recorder_flag->is_command_line() ? !FlightRecorder : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JfrRecorder::is_disabled() {
|
bool JfrRecorder::is_disabled() {
|
||||||
return is_disabled_on_command_line();
|
// True if -XX:-FlightRecorder has been explicitly set on the
|
||||||
}
|
// command line
|
||||||
|
return FLAG_IS_CMDLINE(FlightRecorder) ? !FlightRecorder : false;
|
||||||
static bool set_flight_recorder_flag(bool flag_value) {
|
|
||||||
JVMFlag::boolAtPut((char*)"FlightRecorder", &flag_value, JVMFlag::MANAGEMENT);
|
|
||||||
return FlightRecorder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _enabled = false;
|
static bool _enabled = false;
|
||||||
|
|
||||||
static bool enable() {
|
static bool enable() {
|
||||||
assert(!_enabled, "invariant");
|
assert(!_enabled, "invariant");
|
||||||
_enabled = set_flight_recorder_flag(true);
|
FLAG_SET_MGMT(bool, FlightRecorder, true);
|
||||||
|
_enabled = FlightRecorder;
|
||||||
|
assert(_enabled, "invariant");
|
||||||
return _enabled;
|
return _enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,6 +305,8 @@ typedef enum {
|
||||||
#define FLAG_SET_CMDLINE(type, name, value) (JVMFlagEx::setOnCmdLine(FLAG_MEMBER_WITH_TYPE(name, type)), \
|
#define FLAG_SET_CMDLINE(type, name, value) (JVMFlagEx::setOnCmdLine(FLAG_MEMBER_WITH_TYPE(name, type)), \
|
||||||
JVMFlagEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name, type), (type)(value), JVMFlag::COMMAND_LINE))
|
JVMFlagEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name, type), (type)(value), JVMFlag::COMMAND_LINE))
|
||||||
#define FLAG_SET_ERGO(type, name, value) (JVMFlagEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name, type), (type)(value), JVMFlag::ERGONOMIC))
|
#define FLAG_SET_ERGO(type, name, value) (JVMFlagEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name, type), (type)(value), JVMFlag::ERGONOMIC))
|
||||||
|
#define FLAG_SET_MGMT(type, name, value) (JVMFlagEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name, type), (type)(value), JVMFlag::MANAGEMENT))
|
||||||
|
|
||||||
#define FLAG_SET_ERGO_IF_DEFAULT(type, name, value) \
|
#define FLAG_SET_ERGO_IF_DEFAULT(type, name, value) \
|
||||||
do { \
|
do { \
|
||||||
if (FLAG_IS_DEFAULT(name)) { \
|
if (FLAG_IS_DEFAULT(name)) { \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue