comparison src/share/vm/compiler/compileLog.cpp @ 6197:d2a62e0f25eb

6995781: Native Memory Tracking (Phase 1) 7151532: DCmd for hotspot native memory tracking Summary: Implementation of native memory tracking phase 1, which tracks VM native memory usage, and related DCmd Reviewed-by: acorn, coleenp, fparain
author zgu
date Thu, 28 Jun 2012 17:03:16 -0400
parents f95d63e2154a
children da91efe96a93
comparison
equal deleted inserted replaced
6174:74533f63b116 6197:d2a62e0f25eb
35 // ------------------------------------------------------------------ 35 // ------------------------------------------------------------------
36 // CompileLog::CompileLog 36 // CompileLog::CompileLog
37 CompileLog::CompileLog(const char* file, FILE* fp, intx thread_id) 37 CompileLog::CompileLog(const char* file, FILE* fp, intx thread_id)
38 : _context(_context_buffer, sizeof(_context_buffer)) 38 : _context(_context_buffer, sizeof(_context_buffer))
39 { 39 {
40 initialize(new(ResourceObj::C_HEAP) fileStream(fp)); 40 initialize(new(ResourceObj::C_HEAP, mtCompiler) fileStream(fp));
41 _file = file; 41 _file = file;
42 _file_end = 0; 42 _file_end = 0;
43 _thread_id = thread_id; 43 _thread_id = thread_id;
44 44
45 _identities_limit = 0; 45 _identities_limit = 0;
46 _identities_capacity = 400; 46 _identities_capacity = 400;
47 _identities = NEW_C_HEAP_ARRAY(char, _identities_capacity); 47 _identities = NEW_C_HEAP_ARRAY(char, _identities_capacity, mtCompiler);
48 48
49 // link into the global list 49 // link into the global list
50 { MutexLocker locker(CompileTaskAlloc_lock); 50 { MutexLocker locker(CompileTaskAlloc_lock);
51 _next = _first; 51 _next = _first;
52 _first = this; 52 _first = this;
54 } 54 }
55 55
56 CompileLog::~CompileLog() { 56 CompileLog::~CompileLog() {
57 delete _out; 57 delete _out;
58 _out = NULL; 58 _out = NULL;
59 FREE_C_HEAP_ARRAY(char, _identities); 59 FREE_C_HEAP_ARRAY(char, _identities, mtCompiler);
60 } 60 }
61 61
62 62
63 // Advance kind up to a null or space, return this tail. 63 // Advance kind up to a null or space, return this tail.
64 // Make sure kind is null-terminated, not space-terminated. 64 // Make sure kind is null-terminated, not space-terminated.
107 if (id < _identities_limit && _identities[id] != 0) return id; 107 if (id < _identities_limit && _identities[id] != 0) return id;
108 // Lengthen the array, if necessary. 108 // Lengthen the array, if necessary.
109 if (id >= _identities_capacity) { 109 if (id >= _identities_capacity) {
110 int new_cap = _identities_capacity * 2; 110 int new_cap = _identities_capacity * 2;
111 if (new_cap <= id) new_cap = id + 100; 111 if (new_cap <= id) new_cap = id + 100;
112 _identities = REALLOC_C_HEAP_ARRAY(char, _identities, new_cap); 112 _identities = REALLOC_C_HEAP_ARRAY(char, _identities, new_cap, mtCompiler);
113 _identities_capacity = new_cap; 113 _identities_capacity = new_cap;
114 } 114 }
115 while (id >= _identities_limit) { 115 while (id >= _identities_limit) {
116 _identities[_identities_limit++] = 0; 116 _identities[_identities_limit++] = 0;
117 } 117 }