英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论