mirror of
https://github.com/darlinghq/darling-openjdk.git
synced 2025-03-03 05:26:55 +00:00
8227692: Remove develop feature PrintMallocStatistics
Reviewed-by: coleenp, dcubed
This commit is contained in:
parent
781b790f18
commit
d2611c4e2c
@ -259,25 +259,6 @@ void AllocatedObj::print_value_on(outputStream* st) const {
|
||||
st->print("AllocatedObj(" INTPTR_FORMAT ")", p2i(this));
|
||||
}
|
||||
|
||||
AllocStats::AllocStats() {
|
||||
start_mallocs = os::num_mallocs;
|
||||
start_frees = os::num_frees;
|
||||
start_malloc_bytes = os::alloc_bytes;
|
||||
start_mfree_bytes = os::free_bytes;
|
||||
start_res_bytes = Arena::_bytes_allocated;
|
||||
}
|
||||
|
||||
julong AllocStats::num_mallocs() { return os::num_mallocs - start_mallocs; }
|
||||
julong AllocStats::alloc_bytes() { return os::alloc_bytes - start_malloc_bytes; }
|
||||
julong AllocStats::num_frees() { return os::num_frees - start_frees; }
|
||||
julong AllocStats::free_bytes() { return os::free_bytes - start_mfree_bytes; }
|
||||
julong AllocStats::resource_bytes() { return Arena::_bytes_allocated - start_res_bytes; }
|
||||
void AllocStats::print() {
|
||||
tty->print_cr(UINT64_FORMAT " mallocs (" UINT64_FORMAT "MB), "
|
||||
UINT64_FORMAT " frees (" UINT64_FORMAT "MB), " UINT64_FORMAT "MB resrc",
|
||||
num_mallocs(), alloc_bytes()/M, num_frees(), free_bytes()/M, resource_bytes()/M);
|
||||
}
|
||||
|
||||
ReallocMark::ReallocMark() {
|
||||
#ifdef ASSERT
|
||||
Thread *thread = Thread::current();
|
||||
|
@ -507,23 +507,6 @@ protected:
|
||||
#define FREE_C_HEAP_OBJ(objname)\
|
||||
FreeHeap((char*)objname);
|
||||
|
||||
// for statistics
|
||||
#ifndef PRODUCT
|
||||
class AllocStats : StackObj {
|
||||
julong start_mallocs, start_frees;
|
||||
julong start_malloc_bytes, start_mfree_bytes, start_res_bytes;
|
||||
public:
|
||||
AllocStats();
|
||||
|
||||
julong num_mallocs(); // since creation of receiver
|
||||
julong alloc_bytes();
|
||||
julong num_frees();
|
||||
julong free_bytes();
|
||||
julong resource_bytes();
|
||||
void print();
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
//------------------------------ReallocMark---------------------------------
|
||||
// Code which uses REALLOC_RESOURCE_ARRAY should check an associated
|
||||
|
@ -34,16 +34,13 @@
|
||||
// Explicit C-heap memory management
|
||||
|
||||
#ifndef PRODUCT
|
||||
// Increments unsigned long value for statistics (not atomic on MP).
|
||||
// Increments unsigned long value for statistics (not atomic on MP, but avoids word-tearing on 32 bit).
|
||||
inline void inc_stat_counter(volatile julong* dest, julong add_value) {
|
||||
#if defined(SPARC) || defined(X86)
|
||||
// Sparc and X86 have atomic jlong (8 bytes) instructions
|
||||
julong value = Atomic::load(dest);
|
||||
value += add_value;
|
||||
Atomic::store(value, dest);
|
||||
#else
|
||||
// possible word-tearing during load/store
|
||||
#ifdef _LP64
|
||||
*dest += add_value;
|
||||
#else
|
||||
julong value = Atomic::load(dest);
|
||||
Atomic::store(value + add_value, dest);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
@ -475,10 +475,6 @@ void* Arena::internal_malloc_4(size_t x) {
|
||||
|
||||
#ifndef PRODUCT
|
||||
|
||||
julong Arena::_bytes_allocated = 0;
|
||||
|
||||
void Arena::inc_bytes_allocated(size_t x) { inc_stat_counter(&_bytes_allocated, x); }
|
||||
|
||||
// debugging code
|
||||
inline void Arena::free_all(char** start, char** end) {
|
||||
for (char** p = start; p < end; p++) if (*p) os::free(*p);
|
||||
|
@ -106,11 +106,8 @@ protected:
|
||||
void* grow(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
|
||||
size_t _size_in_bytes; // Size of arena (used for native memory tracking)
|
||||
|
||||
NOT_PRODUCT(static julong _bytes_allocated;) // total #bytes allocated since start
|
||||
friend class AllocStats;
|
||||
debug_only(void* malloc(size_t size);)
|
||||
debug_only(void* internal_malloc_4(size_t x);)
|
||||
NOT_PRODUCT(void inc_bytes_allocated(size_t x);)
|
||||
|
||||
void signal_out_of_memory(size_t request, const char* whence) const;
|
||||
|
||||
@ -148,7 +145,6 @@ protected:
|
||||
debug_only(if (UseMallocOnly) return malloc(x);)
|
||||
if (!check_for_overflow(x, "Arena::Amalloc", alloc_failmode))
|
||||
return NULL;
|
||||
NOT_PRODUCT(inc_bytes_allocated(x);)
|
||||
if (_hwm + x > _max) {
|
||||
return grow(x, alloc_failmode);
|
||||
} else {
|
||||
@ -163,7 +159,6 @@ protected:
|
||||
debug_only(if (UseMallocOnly) return malloc(x);)
|
||||
if (!check_for_overflow(x, "Arena::Amalloc_4", alloc_failmode))
|
||||
return NULL;
|
||||
NOT_PRODUCT(inc_bytes_allocated(x);)
|
||||
if (_hwm + x > _max) {
|
||||
return grow(x, alloc_failmode);
|
||||
} else {
|
||||
@ -185,7 +180,6 @@ protected:
|
||||
#endif
|
||||
if (!check_for_overflow(x, "Arena::Amalloc_D", alloc_failmode))
|
||||
return NULL;
|
||||
NOT_PRODUCT(inc_bytes_allocated(x);)
|
||||
if (_hwm + x > _max) {
|
||||
return grow(x, alloc_failmode); // grow() returns a result aligned >= 8 bytes.
|
||||
} else {
|
||||
|
@ -466,9 +466,6 @@ const size_t minimumSymbolTableSize = 1024;
|
||||
develop(bool, UseMallocOnly, false, \
|
||||
"Use only malloc/free for allocation (no resource area/arena)") \
|
||||
\
|
||||
develop(bool, PrintMallocStatistics, false, \
|
||||
"Print malloc/free statistics") \
|
||||
\
|
||||
develop(bool, ZapResourceArea, trueInDebug, \
|
||||
"Zap freed resource/arena space with 0xABABABAB") \
|
||||
\
|
||||
|
@ -203,9 +203,6 @@ void print_bytecode_count() {
|
||||
}
|
||||
}
|
||||
|
||||
AllocStats alloc_stats;
|
||||
|
||||
|
||||
|
||||
// General statistics printing (profiling ...)
|
||||
void print_statistics() {
|
||||
@ -329,11 +326,6 @@ void print_statistics() {
|
||||
}
|
||||
|
||||
print_bytecode_count();
|
||||
if (PrintMallocStatistics) {
|
||||
tty->print("allocation stats: ");
|
||||
alloc_stats.print();
|
||||
tty->cr();
|
||||
}
|
||||
|
||||
if (PrintSystemDictionaryAtExit) {
|
||||
ResourceMark rm;
|
||||
|
Loading…
x
Reference in New Issue
Block a user