Skip to content

Commit

Permalink
8316885: jcmd: Compiler.CodeHeap_Analytics cmd does not inform about …
Browse files Browse the repository at this point in the history
…missing aggregate
  • Loading branch information
RealLucy committed Sep 25, 2023
1 parent 0f0c5b2 commit 5e77d5b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/hotspot/share/code/codeHeapState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1216,13 +1216,15 @@ 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;
}

const char* heapName = get_heapName(heap);
get_HeapStatGlobals(out, heapName);

if ((StatArray == nullptr) || (TopSizeArray == nullptr) || (used_topSizeBlocks == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
Expand Down Expand Up @@ -1426,13 +1428,15 @@ 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;
}

const char* heapName = get_heapName(heap);
get_HeapStatGlobals(out, heapName);

if ((StatArray == nullptr) || (FreeArray == nullptr) || (alloc_granules == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
Expand Down Expand Up @@ -1600,13 +1604,15 @@ 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;
}

const char* heapName = get_heapName(heap);
get_HeapStatGlobals(out, heapName);

if ((StatArray == nullptr) || (alloc_granules == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
Expand Down Expand Up @@ -1758,13 +1764,15 @@ 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;
}

const char* heapName = get_heapName(heap);
get_HeapStatGlobals(out, heapName);

if ((StatArray == nullptr) || (alloc_granules == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
Expand Down Expand Up @@ -1927,13 +1935,15 @@ 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;
}

const char* heapName = get_heapName(heap);
get_HeapStatGlobals(out, heapName);

if ((StatArray == nullptr) || (alloc_granules == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
Expand Down Expand Up @@ -2039,13 +2049,15 @@ 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;
}

const char* heapName = get_heapName(heap);
get_HeapStatGlobals(out, heapName);

if ((StatArray == nullptr) || (alloc_granules == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/code/codeHeapState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5e77d5b

Please sign in to comment.