Java Flight Recorder(JFR)适用于OpenJDK 8和OpenJDK 11的虚拟机选项综合列表

huangapple go评论76阅读模式
英文:

Java Flight Recorder comprehensive list of VM options for OpenJDK 8 & OpenJDK 11

问题

有没有一种方法可以获得Java Flight Recorder(JFR)的虚拟机选项的综合列表。
我特别关注OpenJDK 8和OpenJDK 11。

到目前为止,我发现这个列表非常有用。
https://chriswhocodes.com/hotspot_options_jdk8.html

另外,

java -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version

是否有任何资源可以提供JFR可用选项的列表?

英文:

Is there a way to get a comprehensive list of VM options for Java Flight Recorder (JFR).
I am particularly interested in OpenJdk 8 & OpenJdk 11

so far I find this list quite usefull
https://chriswhocodes.com/hotspot_options_jdk8.html

also

java -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version

Is there any resource that would provide list of options available for JFR?

答案1

得分: 11

我认为关于JFR的VM选项的最全面和最新的描述可以在jcmd JFR.start和JFR.configure的文档中找到。

https://docs.oracle.com/en/java/javase/15/docs/specs/man/jcmd.html

-XX:StartFlightRecording:

  • delay(可选)
    开始记录之前等待的时间长度(整数后跟's'表示秒,'m'表示分钟,'h'表示小时)

  • disk:(可选)在记录时将数据同时写入磁盘的标志(布尔值,true)

  • dumponexit:(可选)在Java虚拟机(JVM)关闭时将记录写入磁盘的标志。如果设置为'true'并且未为文件名提供值,则记录将被写入到启动进程的目录中的文件中。文件名是系统生成的名称,其中包含进程ID、记录ID和当前时间戳。 (例如:hotspot-pid-33507-id-1-2019_12_12_10_41.jfr)(布尔值,false)

  • duration:(可选)记录的持续时间。请注意,0s表示永远(整数后跟's'表示秒,'m'表示分钟,'h'表示小时)

  • filename:(可选)停止记录时写入飞行记录数据的文件的名称。如果未提供文件名,则从PID和当前日期生成文件名,并放置在启动进程的目录中。文件名也可以是一个目录,在这种情况下,文件名是在指定目录中从PID和当前日期生成的。(字符串,无默认值)

  • maxage:(可选)在磁盘上保留记录数据的最长时间。仅当disk参数设置为true时,此参数才有效。注意,0s表示永远。(整数后跟's'表示秒,'m'表示分钟,'h'表示小时,0s)

  • maxsize:(可选)在磁盘上保留的数据的最大大小(以字节为单位),如果没有使用以下后缀之一:'m'或'M'表示兆字节,'g'或'G'表示千兆字节。仅当disk参数设置为'true'时,此参数才有效。该值不能小于使用JFR.configure命令设置的maxchunksize参数的值。(字符串,0(无最大大小))

  • name:(可选)记录的名称。如果未提供名称,则会生成一个名称。请记下在命令的响应中显示的生成的名称,以便您可以在其他命令中使用它。(字符串,默认系统生成的名称)

  • path-to-gc-root:(可选)在记录结束时保存到垃圾收集(GC)根的路径的标志。路径信息对于查找内存泄漏很有用,但收集它很耗时。只有在怀疑应用程序存在内存泄漏时,才打开此标志。如果settings参数设置为'profile',则所收集的信息包括从分配潜在泄漏对象的位置获取的堆栈跟踪。(布尔值,false)

  • settings:(可选)标识要记录哪些事件的设置文件的名称。要指定多个文件,请使用逗号(',')分隔名称。如果文件不在JAVA-HOME/lib/jfr中,则包括路径。以下配置文件在JDK的JAVA-HOME/lib/jfr目录中包含:'default.jfc':收集一组预定义的信息,开销很低,因此对性能影响最小,可以与连续运行的记录一起使用;'profile.jfc':提供比'default.jfc'配置文件更多的数据,但开销更大,对性能影响更大。在需要更多信息的短时间内使用此配置。使用'none'以启动没有预定义配置文件的记录。(字符串,JAVA-HOME/lib/jfr/default.jfc)

-XX:FlightRecorderOptions:

除了repositorypathmemorysize和可能的stackdepth,我不会更改以下任何选项。它们是遗留选项或为JVM支持工程师提供解决方法的选项。使用非默认值会增加崩溃或与性能相关的问题的风险。

  • globalbuffercount:(可选)全局缓冲区的数量。此选项是一个遗留选项:更改memorysize参数以改变全局缓冲区的数量。一旦JFR被初始化,无法更改此值。(字符串,默认由memorysize的值确定)

  • globalbuffersize:(可选)全局缓冲区的大小,以字节为单位。此选项是一个遗留选项:更改memorysize参数以改变全局缓冲区的大小。一旦JFR被初始化,无法更改此值。(字符串,默认由memorysize的值确定)

  • maxchunksize:(可选)单个数据块的最大大小,以字节为单位,如果没有使用以下后缀之一:'m'或'M'表示兆字节,'g'或'G'表示千兆字节。一旦JFR被初始化,无法更改此值。(字符串,12M)

  • memorysize:(可选)总内存大小,以字节为单位,如果没有使用以下后缀之一:'m'或'M'表示兆字节,'g'或'G'表示千兆字节。一旦JFR被初始化,无法更改此值。(字符串,10M)

  • repositorypath:(可选)存储记录的位置,直到将它们写入永久文件为止。(字符串,默认位置是操作系统的临时目录。在Linux操作系统中,临时目录是/tmp。在Windows上,临时目录由TMP环境变量指定。)

  • stackdepth:(可选)堆栈跟踪的

英文:

I think the most comprehensive and up-to-date description of the VM option for JFR can be found in the documentation of jcmd JFR.start and JFR.configure

https://docs.oracle.com/en/java/javase/15/docs/specs/man/jcmd.html

-XX:StartFlightRecording:

  • delay (Optional)
    Length of time to wait before starting to record (INTEGER followed by
    's' for seconds 'm' for minutes or 'h' for hours)

  • disk: (Optional) Flag for also writing the data to disk while recording (BOOLEAN, true)

  • dumponexit: (Optional) Flag for writing the recording to disk when the Java Virtual Machine (JVM) shuts down. If set to 'true' and no value is given for filename, the recording is written to a file in the directory where the process was started. The file name is a system-generated name that contains the process ID, the recording ID and the current time stamp. (For example: hotspot-pid-33507-id-1-2019_12_12_10_41.jfr) (BOOLEAN, false)

  • duration: (Optional) Length of time to record. Note that 0s means forever (INTEGER followed by 's' for seconds 'm' for minutes or 'h' for hours)

  • filename: (Optional) Name of the file to which the flight recording data is written when the recording is stopped. If no filename is given, a filename is generated from the PID and the current date and is placed in the directory where the process was started. The filename may also be a directory in which case, the filename is generated from the PID and the current date in the specified directory. (STRING, no default value)

  • maxage: (Optional) Maximum time to keep the recorded data on disk. This parameter is valid only when the disk parameter is set to true. Note 0s means forever. (INTEGER followed by 's' for seconds 'm' for minutes or 'h' for hours, 0s)

  • maxsize: (Optional) Maximum size of the data to keep on disk in bytes if one of the following suffixes is not used: 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. This parameter is valid only when the disk parameter is set to 'true'. The value must not be less than the value for the maxchunksize parameter set with the JFR.configure command. (STRING, 0 (no maximum size))

  • name: (Optional) Name of the recording. If no name is provided, a name is generated. Make note of the generated name that is shown in the response to the command so that you can use it with other commands. (STRING, system-generated default name)

  • path-to-gc-root: (Optional) Flag for saving the path to garbage collection (GC) roots at the end of a recording. The path information is useful for finding memory leaks but collecting it is time consuming. Turn on this flag only when you have an application that you suspect has a memory leak. If the settings parameter is set to 'profile', then the information collected includes the stack trace from where the potential leaking object was allocated. (BOOLEAN, false)

  • settings: (Optional) Name of the settings file that identifies which events to record. To specify more than one file, separate the names with a comma (','). Include the path if the file is not in JAVA-HOME/lib/jfr. The following profiles are included with the JDK in the JAVA-HOME/lib/jfr directory: 'default.jfc': collects a predefined set of information with low overhead, so it has minimal impact on performance and can be used with recordings that run continuously; 'profile.jfc': Provides more data than the 'default.jfc' profile, but with more overhead and impact on performance. Use this configuration for short periods of time when more information is needed. Use 'none' to start a recording without a predefined configuration file. (STRING, JAVA-HOME/lib/jfr/default.jfc)

-XX:FlightRecorderOptions:

Besides repositorypath, memorysize and perhaps stackdepth, I would not change any of the below options. They are legacy or there for JVM support engineers to provide workarounds. Using non-default values will increase the risk of crashes or performance related problem.

  • globalbuffercount: (Optional) Number of global buffers. This option is a legacy option: change the memorysize parameter to alter the number of global buffers. This value cannot be changed once JFR has been initalized. (STRING, default determined by the value for memorysize)

  • globalbuffersize: (Optional) Size of the global buffers, in bytes. This option is a legacy option: change the memorysize parameter to alter the size of the global buffers. This value cannot be changed once JFR has been initalized. (STRING, default determined by the value for memorysize)

  • maxchunksize: (Optional) Maximum size of an individual data chunk in bytes if one of the following suffixes is not used: 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. This value cannot be changed once JFR has been initialized. (STRING, 12M)

  • memorysize: (Optional) Overall memory size, in bytes if one of the following suffixes is not used: 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. This value cannot be changed once JFR has been initialized. (STRING, 10M)

  • repositorypath: (Optional) Path to the location where recordings are stored until they are written to a permanent file. (STRING, The default location is the temporary directory for the operating system. On Linux operating systems, the temporary directory is /tmp. On Windows, the temporary directory is specified by the TMP environment variable.)

  • stackdepth: (Optional) Stack depth for stack traces. Setting this value greater than the default of 64 may cause a performance degradation. This value cannot be changed once JFR has been initialized. (LONG, 64)

  • thread_buffer_size: (Optional) Local buffer size for each thread in bytes if one of the following suffixes is not used: 'k' or 'K' for kilobytes or 'm' or 'M' for megabytes. Overriding this parameter could reduce performance and is not recommended. This value cannot be changed once JFR has been initialized. (STRING, 8k)

  • samplethreads: (Optional) Flag for activating thread sampling. (BOOLEAN, true)

huangapple
  • 本文由 发表于 2020年9月30日 20:59:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/64138134.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定