8316885: jcmd: Compiler.CodeHeap_Analytics cmd does not inform about missing aggregate

Reviewed-by: kvn, mdoerr
This commit is contained in:
Lutz Schmidt 2023-09-28 11:50:51 +00:00
parent d0c1444d92
commit 1230aed61d
2 changed files with 21 additions and 0 deletions

View File

@ -1216,6 +1216,7 @@ void CodeHeapState::aggregate(outputStream* out, CodeHeap* heap, size_t granular
void CodeHeapState::print_usedSpace(outputStream* out, CodeHeap* heap) {
if (!initialization_complete) {
print_aggregate_missing(out, nullptr);
return;
}
@ -1223,6 +1224,7 @@ void CodeHeapState::print_usedSpace(outputStream* out, CodeHeap* heap) {
get_HeapStatGlobals(out, heapName);
if ((StatArray == nullptr) || (TopSizeArray == nullptr) || (used_topSizeBlocks == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
@ -1426,6 +1428,7 @@ void CodeHeapState::print_usedSpace(outputStream* out, CodeHeap* heap) {
void CodeHeapState::print_freeSpace(outputStream* out, CodeHeap* heap) {
if (!initialization_complete) {
print_aggregate_missing(out, nullptr);
return;
}
@ -1433,6 +1436,7 @@ void CodeHeapState::print_freeSpace(outputStream* out, CodeHeap* heap) {
get_HeapStatGlobals(out, heapName);
if ((StatArray == nullptr) || (FreeArray == nullptr) || (alloc_granules == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
@ -1600,6 +1604,7 @@ void CodeHeapState::print_freeSpace(outputStream* out, CodeHeap* heap) {
void CodeHeapState::print_count(outputStream* out, CodeHeap* heap) {
if (!initialization_complete) {
print_aggregate_missing(out, nullptr);
return;
}
@ -1607,6 +1612,7 @@ void CodeHeapState::print_count(outputStream* out, CodeHeap* heap) {
get_HeapStatGlobals(out, heapName);
if ((StatArray == nullptr) || (alloc_granules == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
@ -1758,6 +1764,7 @@ void CodeHeapState::print_count(outputStream* out, CodeHeap* heap) {
void CodeHeapState::print_space(outputStream* out, CodeHeap* heap) {
if (!initialization_complete) {
print_aggregate_missing(out, nullptr);
return;
}
@ -1765,6 +1772,7 @@ void CodeHeapState::print_space(outputStream* out, CodeHeap* heap) {
get_HeapStatGlobals(out, heapName);
if ((StatArray == nullptr) || (alloc_granules == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
@ -1927,6 +1935,7 @@ void CodeHeapState::print_space(outputStream* out, CodeHeap* heap) {
void CodeHeapState::print_age(outputStream* out, CodeHeap* heap) {
if (!initialization_complete) {
print_aggregate_missing(out, nullptr);
return;
}
@ -1934,6 +1943,7 @@ void CodeHeapState::print_age(outputStream* out, CodeHeap* heap) {
get_HeapStatGlobals(out, heapName);
if ((StatArray == nullptr) || (alloc_granules == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
@ -2039,6 +2049,7 @@ void CodeHeapState::print_age(outputStream* out, CodeHeap* heap) {
void CodeHeapState::print_names(outputStream* out, CodeHeap* heap) {
if (!initialization_complete) {
print_aggregate_missing(out, nullptr);
return;
}
@ -2046,6 +2057,7 @@ void CodeHeapState::print_names(outputStream* out, CodeHeap* heap) {
get_HeapStatGlobals(out, heapName);
if ((StatArray == nullptr) || (alloc_granules == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
@ -2343,6 +2355,14 @@ void CodeHeapState::print_line_delim(outputStream* out, bufferedStream* ast, cha
}
}
void CodeHeapState::print_aggregate_missing(outputStream* out, const char* heapName) {
if (heapName == nullptr) {
out->print_cr("No aggregated code heap data available. Run function aggregate first.");
} else {
out->print_cr("No aggregated data available for heap %s. Run function aggregate first.", heapName);
}
}
// Find out which blob type we have at hand.
// Return "noType" if anything abnormal is detected.
CodeHeapState::blobType CodeHeapState::get_cbType(CodeBlob* cb) {

View File

@ -91,6 +91,7 @@ class CodeHeapState : public CHeapObj<mtCode> {
static void print_age_single(outputStream *ast, int age);
static void print_line_delim(outputStream* out, bufferedStream *sst, char* low_bound, unsigned int ix, unsigned int gpl);
static void print_line_delim(outputStream* out, outputStream *sst, char* low_bound, unsigned int ix, unsigned int gpl);
static void print_aggregate_missing(outputStream* out, const char* heapName);
static blobType get_cbType(CodeBlob* cb);
static bool blob_access_is_safe(CodeBlob* this_blob);
static bool nmethod_access_is_safe(nmethod* nm);