8299672: Enhance HeapDump JFR event

Reviewed-by: rschmelter, clanger
This commit is contained in:
Matthias Baesken 2023-01-12 08:04:46 +00:00
parent d716ec5d30
commit 0ee8cac7c7
3 changed files with 15 additions and 6 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@ -1144,11 +1144,14 @@
<Field type="ulong" contentType="bytes" name="size" label="Size Written" />
</Event>
<Event name="HeapDump" category="Java Virtual Machine, Diagnostics" label="Heap Dump" stackTrace="true" thread="true">
<Field type="string" name="destination" label="Destination" />
<Event name="HeapDump" category="Java Virtual Machine, Diagnostics" label="Heap Dump" description="Information about a successfully written Java heap dump"
stackTrace="true" thread="true">
<Field type="string" name="destination" label="Destination Path of the Dump" />
<Field type="long" name="size" label="Size" />
<Field type="boolean" name="gcBeforeDump" label="GC Before Dump" />
<Field type="boolean" name="onOutOfMemoryError" label="On Out of Memory Error" />
<Field type="boolean" name="onOutOfMemoryError" label="Heap Dump on Out of Memory Error" />
<Field type="boolean" name="overwrite" label="Overwrite" description="Heap dump overwrites previous file location if it exists" />
<Field type="int" name="compression" label="Compression Level" description="Compression level of the dump, if larger than 0 we use gzip compression with this level" />
</Event>
<Event name="GCLocker" category="Java Virtual Machine, GC, Detailed" label="GC Locker" startTime="true" thread="true" stackTrace="true">

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -2425,7 +2425,11 @@ int HeapDumper::dump(const char* path, outputStream* out, int compression, bool
event.set_gcBeforeDump(_gc_before_heap_dump);
event.set_size(writer.bytes_written());
event.set_onOutOfMemoryError(_oome);
event.set_overwrite(overwrite);
event.set_compression(compression);
event.commit();
} else {
log_debug(cds, heap)("Error %s while dumping heap", error());
}
// print message in interactive case

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -65,6 +65,8 @@ public class TestHeapDump {
Events.assertField(e, "gcBeforeDump").equal(true);
Events.assertField(e, "onOutOfMemoryError").equal(false);
Events.assertField(e, "size").equal(Files.size(path));
Events.assertField(e, "compression").below(1);
Events.assertField(e, "overwrite").equal(false);
System.out.println(e);
}
}