mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
6995781: Native Memory Tracking (Phase 1)
7151532: DCmd for hotspot native memory tracking Implementation of native memory tracking phase 1, which tracks VM native memory usage, and related DCmd Reviewed-by: acorn, coleenp, fparain
This commit is contained in:
parent
8e42425c92
commit
a39b17624a
315 changed files with 7245 additions and 1477 deletions
|
@ -384,7 +384,7 @@ rotatingFileStream::~rotatingFileStream() {
|
|||
if (_file != NULL) {
|
||||
if (_need_close) fclose(_file);
|
||||
_file = NULL;
|
||||
FREE_C_HEAP_ARRAY(char, _file_name);
|
||||
FREE_C_HEAP_ARRAY(char, _file_name, mtInternal);
|
||||
_file_name = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ rotatingFileStream::~rotatingFileStream() {
|
|||
rotatingFileStream::rotatingFileStream(const char* file_name) {
|
||||
_cur_file_num = 0;
|
||||
_bytes_writen = 0L;
|
||||
_file_name = NEW_C_HEAP_ARRAY(char, strlen(file_name)+10);
|
||||
_file_name = NEW_C_HEAP_ARRAY(char, strlen(file_name)+10, mtInternal);
|
||||
jio_snprintf(_file_name, strlen(file_name)+10, "%s.%d", file_name, _cur_file_num);
|
||||
_file = fopen(_file_name, "w");
|
||||
_need_close = true;
|
||||
|
@ -401,7 +401,7 @@ rotatingFileStream::rotatingFileStream(const char* file_name) {
|
|||
rotatingFileStream::rotatingFileStream(const char* file_name, const char* opentype) {
|
||||
_cur_file_num = 0;
|
||||
_bytes_writen = 0L;
|
||||
_file_name = NEW_C_HEAP_ARRAY(char, strlen(file_name)+10);
|
||||
_file_name = NEW_C_HEAP_ARRAY(char, strlen(file_name)+10, mtInternal);
|
||||
jio_snprintf(_file_name, strlen(file_name)+10, "%s.%d", file_name, _cur_file_num);
|
||||
_file = fopen(_file_name, opentype);
|
||||
_need_close = true;
|
||||
|
@ -524,7 +524,7 @@ static const char* make_log_name(const char* log_name, const char* force_directo
|
|||
}
|
||||
|
||||
// Create big enough buffer.
|
||||
char *buf = NEW_C_HEAP_ARRAY(char, buffer_length);
|
||||
char *buf = NEW_C_HEAP_ARRAY(char, buffer_length, mtInternal);
|
||||
|
||||
strcpy(buf, "");
|
||||
if (force_directory != NULL) {
|
||||
|
@ -549,7 +549,7 @@ void defaultStream::init_log() {
|
|||
// %%% Need a MutexLocker?
|
||||
const char* log_name = LogFile != NULL ? LogFile : "hotspot.log";
|
||||
const char* try_name = make_log_name(log_name, NULL);
|
||||
fileStream* file = new(ResourceObj::C_HEAP) fileStream(try_name);
|
||||
fileStream* file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
|
||||
if (!file->is_open()) {
|
||||
// Try again to open the file.
|
||||
char warnbuf[O_BUFLEN*2];
|
||||
|
@ -557,18 +557,18 @@ void defaultStream::init_log() {
|
|||
"Warning: Cannot open log file: %s\n", try_name);
|
||||
// Note: This feature is for maintainer use only. No need for L10N.
|
||||
jio_print(warnbuf);
|
||||
FREE_C_HEAP_ARRAY(char, try_name);
|
||||
FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
|
||||
try_name = make_log_name("hs_pid%p.log", os::get_temp_directory());
|
||||
jio_snprintf(warnbuf, sizeof(warnbuf),
|
||||
"Warning: Forcing option -XX:LogFile=%s\n", try_name);
|
||||
jio_print(warnbuf);
|
||||
delete file;
|
||||
file = new(ResourceObj::C_HEAP) fileStream(try_name);
|
||||
FREE_C_HEAP_ARRAY(char, try_name);
|
||||
file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
|
||||
FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
|
||||
}
|
||||
if (file->is_open()) {
|
||||
_log_file = file;
|
||||
xmlStream* xs = new(ResourceObj::C_HEAP) xmlStream(file);
|
||||
xmlStream* xs = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file);
|
||||
_outer_xmlStream = xs;
|
||||
if (this == tty) xtty = xs;
|
||||
// Write XML header.
|
||||
|
@ -815,7 +815,7 @@ void ttyLocker::break_tty_lock_for_safepoint(intx holder) {
|
|||
|
||||
void ostream_init() {
|
||||
if (defaultStream::instance == NULL) {
|
||||
defaultStream::instance = new(ResourceObj::C_HEAP) defaultStream();
|
||||
defaultStream::instance = new(ResourceObj::C_HEAP, mtInternal) defaultStream();
|
||||
tty = defaultStream::instance;
|
||||
|
||||
// We want to ensure that time stamps in GC logs consider time 0
|
||||
|
@ -833,9 +833,9 @@ void ostream_init_log() {
|
|||
gclog_or_tty = tty; // default to tty
|
||||
if (Arguments::gc_log_filename() != NULL) {
|
||||
fileStream * gclog = UseGCLogFileRotation ?
|
||||
new(ResourceObj::C_HEAP)
|
||||
new(ResourceObj::C_HEAP, mtInternal)
|
||||
rotatingFileStream(Arguments::gc_log_filename()) :
|
||||
new(ResourceObj::C_HEAP)
|
||||
new(ResourceObj::C_HEAP, mtInternal)
|
||||
fileStream(Arguments::gc_log_filename());
|
||||
if (gclog->is_open()) {
|
||||
// now we update the time stamp of the GC log to be synced up
|
||||
|
@ -940,7 +940,7 @@ void staticBufferStream::vprint_cr(const char* format, va_list argptr) {
|
|||
|
||||
bufferedStream::bufferedStream(size_t initial_size, size_t bufmax) : outputStream() {
|
||||
buffer_length = initial_size;
|
||||
buffer = NEW_C_HEAP_ARRAY(char, buffer_length);
|
||||
buffer = NEW_C_HEAP_ARRAY(char, buffer_length, mtInternal);
|
||||
buffer_pos = 0;
|
||||
buffer_fixed = false;
|
||||
buffer_max = bufmax;
|
||||
|
@ -971,7 +971,7 @@ void bufferedStream::write(const char* s, size_t len) {
|
|||
if (end < buffer_length * 2) {
|
||||
end = buffer_length * 2;
|
||||
}
|
||||
buffer = REALLOC_C_HEAP_ARRAY(char, buffer, end);
|
||||
buffer = REALLOC_C_HEAP_ARRAY(char, buffer, end, mtInternal);
|
||||
buffer_length = end;
|
||||
}
|
||||
}
|
||||
|
@ -989,7 +989,7 @@ char* bufferedStream::as_string() {
|
|||
|
||||
bufferedStream::~bufferedStream() {
|
||||
if (!buffer_fixed) {
|
||||
FREE_C_HEAP_ARRAY(char, buffer);
|
||||
FREE_C_HEAP_ARRAY(char, buffer, mtInternal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue