提交 0cdc0d61 编写于 作者: E ehelin

8036701: Add trace event when a metaspace throws out of memory error

Reviewed-by: stefank, mgerdin
上级 b81066f5
......@@ -3370,7 +3370,7 @@ MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
}
if (result == NULL) {
report_metadata_oome(loader_data, word_size, mdtype, CHECK_NULL);
report_metadata_oome(loader_data, word_size, type, mdtype, CHECK_NULL);
}
// Zero initialize.
......@@ -3384,7 +3384,9 @@ size_t Metaspace::class_chunk_size(size_t word_size) {
return class_vsm()->calc_chunk_size(word_size);
}
void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_size, MetadataType mdtype, TRAPS) {
void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_size, MetaspaceObj::Type type, MetadataType mdtype, TRAPS) {
tracer()->report_metadata_oom(loader_data, word_size, type, mdtype);
// If result is still null, we are out of memory.
if (Verbose && TraceMetadataChunkAllocation) {
gclog_or_tty->print_cr("Metaspace allocation failed for size "
......
......@@ -238,7 +238,7 @@ class Metaspace : public CHeapObj<mtClass> {
static void purge();
static void report_metadata_oome(ClassLoaderData* loader_data, size_t word_size,
MetadataType mdtype, TRAPS);
MetaspaceObj::Type type, MetadataType mdtype, TRAPS);
static const char* metadata_type_name(Metaspace::MetadataType mdtype);
......
......@@ -44,7 +44,22 @@ void MetaspaceTracer::report_metaspace_allocation_failure(ClassLoaderData *cld,
size_t word_size,
MetaspaceObj::Type objtype,
Metaspace::MetadataType mdtype) const {
EventMetaspaceAllocationFailure event;
send_allocation_failure_event<EventMetaspaceAllocationFailure>(cld, word_size, objtype, mdtype);
}
void MetaspaceTracer::report_metadata_oom(ClassLoaderData *cld,
size_t word_size,
MetaspaceObj::Type objtype,
Metaspace::MetadataType mdtype) const {
send_allocation_failure_event<EventMetaspaceOOM>(cld, word_size, objtype, mdtype);
}
template <typename E>
void MetaspaceTracer::send_allocation_failure_event(ClassLoaderData *cld,
size_t word_size,
MetaspaceObj::Type objtype,
Metaspace::MetadataType mdtype) const {
E event;
if (event.should_commit()) {
if (cld->is_anonymous()) {
event.set_classLoader(NULL);
......
......@@ -32,6 +32,11 @@
class ClassLoaderData;
class MetaspaceTracer : public CHeapObj<mtTracing> {
template <typename E>
void send_allocation_failure_event(ClassLoaderData *cld,
size_t word_size,
MetaspaceObj::Type objtype,
Metaspace::MetadataType mdtype) const;
public:
void report_gc_threshold(size_t old_val,
size_t new_val,
......@@ -40,6 +45,11 @@ class MetaspaceTracer : public CHeapObj<mtTracing> {
size_t word_size,
MetaspaceObj::Type objtype,
Metaspace::MetadataType mdtype) const;
void report_metadata_oom(ClassLoaderData *cld,
size_t word_size,
MetaspaceObj::Type objtype,
Metaspace::MetadataType mdtype) const;
};
#endif // SHARE_VM_MEMORY_METASPACE_TRACER_HPP
......@@ -213,6 +213,14 @@ Declares a structure type that can be used in other events.
<value type="METASPACEOBJTYPE" field="metaspaceObjectType" label="Metaspace Object Type" />
</event>
<event id="MetaspaceOOM" path="vm/gc/metaspace/out_of_memory" label="Metaspace Out of Memory" is_instant="true" has_stacktrace="true">
<value type="CLASS" field="classLoader" label="Class Loader" />
<value type="BOOLEAN" field="anonymousClassLoader" label="Anonymous Class Loader" />
<value type="BYTES64" field="size" label="Size" />
<value type="METADATATYPE" field="metadataType" label="Metadata Type" />
<value type="METASPACEOBJTYPE" field="metaspaceObjectType" label="Metaspace Object Type" />
</event>
<event id="PSHeapSummary" path="vm/gc/heap/ps_summary" label="Parallel Scavenge Heap Summary" is_instant="true">
<value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
<value type="GCWHEN" field="when" label="When" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册