JFR文件一旦转换为Json格式,是否可以编译回.jfr格式。

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

Can JFR files once printed as Json be compiled back to .jfr format

问题

我有一个使用 jfr print --json 命令创建的 JSON 文件,我能将它们转换回 .jfr 文件吗?

英文:

I have JSON file that I created using the jfr print --json command, will I be able to convert them back into an .jfr file?

答案1

得分: 2

在JDK中没有支持将JSON输出转换为二进制记录格式的功能,我不知道任何第三方工具可以做到这一点。二进制文件格式是未经记录的,并且需要大量处理才能将其压缩回其原始形式。

如果您想要过滤事件或清除记录,从JDK 19开始可以通过命令行和以编程方式进行操作。

$ jfr scrub --exclude-events 
  InitialEnvironmentVariable recording.jfr no-psw.jfr

对于早于JDK 19的JDK版本,您最好的选择是关闭不需要的事件。在JDK 17中,您可以通过命令行执行此操作:

$ java -XX:StartFlightRecording:
        jdk.InitialEnvironmentVariable#enabled=false ...

对于JDK 16或更早的版本,您需要创建自定义的.jfc文件。

英文:

There is no support in the JDK to convert a JSON printout into the binary recording format, and I'm not aware of any third-party tool that can do it. The binary file format is undocumented and it would require lots of processing to compress it back into its original form.

If you want to filter out events or scrub a recording, it's possible from JDK 19, both from command line and programmatically.

$ jfr scrub --exclude-events 
  InitialEnvironmentVariable recording.jfr no-psw.jfr

For JDKs prior to JDK 19, the best you can do is to turn off the events you don't want. In JDK 17, you can do that from command line:

$ java -XX:StartFlightRecording:
        jdk.InitialEnvironmentVariable#enabled=false ...

For JDK 16, or earlier, you need to create custom .jfc file.

huangapple
  • 本文由 发表于 2020年9月11日 19:58:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/63846646.html
匿名

发表评论

匿名网友

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

确定