comparison src/share/vm/runtime/fprofiler.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 1d1603768966
children 1d7922586cf6
comparison
equal deleted inserted replaced
6174:74533f63b116 6197:d2a62e0f25eb
68 IntervalData* FlatProfiler::interval_data = NULL; 68 IntervalData* FlatProfiler::interval_data = NULL;
69 69
70 ThreadProfiler::ThreadProfiler() { 70 ThreadProfiler::ThreadProfiler() {
71 // Space for the ProfilerNodes 71 // Space for the ProfilerNodes
72 const int area_size = 1 * ProfilerNodeSize * 1024; 72 const int area_size = 1 * ProfilerNodeSize * 1024;
73 area_bottom = AllocateHeap(area_size, "fprofiler"); 73 area_bottom = AllocateHeap(area_size, mtInternal);
74 area_top = area_bottom; 74 area_top = area_bottom;
75 area_limit = area_bottom + area_size; 75 area_limit = area_bottom + area_size;
76 76
77 // ProfilerNode pointer table 77 // ProfilerNode pointer table
78 table = NEW_C_HEAP_ARRAY(ProfilerNode*, table_size); 78 table = NEW_C_HEAP_ARRAY(ProfilerNode*, table_size, mtInternal);
79 initialize(); 79 initialize();
80 engaged = false; 80 engaged = false;
81 } 81 }
82 82
83 ThreadProfiler::~ThreadProfiler() { 83 ThreadProfiler::~ThreadProfiler() {
155 address PCRecorder::base = NULL; 155 address PCRecorder::base = NULL;
156 156
157 void PCRecorder::init() { 157 void PCRecorder::init() {
158 MutexLockerEx lm(CodeCache_lock, Mutex::_no_safepoint_check_flag); 158 MutexLockerEx lm(CodeCache_lock, Mutex::_no_safepoint_check_flag);
159 int s = size(); 159 int s = size();
160 counters = NEW_C_HEAP_ARRAY(int, s); 160 counters = NEW_C_HEAP_ARRAY(int, s, mtInternal);
161 for (int index = 0; index < s; index++) { 161 for (int index = 0; index < s; index++) {
162 counters[index] = 0; 162 counters[index] = 0;
163 } 163 }
164 base = CodeCache::first_address(); 164 base = CodeCache::first_address();
165 } 165 }
848 848
849 // Try not to wait for the Threads_lock 849 // Try not to wait for the Threads_lock
850 if (Threads_lock->try_lock()) { 850 if (Threads_lock->try_lock()) {
851 { // Threads_lock scope 851 { // Threads_lock scope
852 maxthreads = Threads::number_of_threads(); 852 maxthreads = Threads::number_of_threads();
853 threadsList = NEW_C_HEAP_ARRAY(JavaThread *, maxthreads); 853 threadsList = NEW_C_HEAP_ARRAY(JavaThread *, maxthreads, mtInternal);
854 suspendedthreadcount = 0; 854 suspendedthreadcount = 0;
855 for (JavaThread* tp = Threads::first(); tp != NULL; tp = tp->next()) { 855 for (JavaThread* tp = Threads::first(); tp != NULL; tp = tp->next()) {
856 if (tp->is_Compiler_thread()) { 856 if (tp->is_Compiler_thread()) {
857 // Only record ticks for active compiler threads 857 // Only record ticks for active compiler threads
858 CompilerThread* cthread = (CompilerThread*)tp; 858 CompilerThread* cthread = (CompilerThread*)tp;
1193 initialize(); 1193 initialize();
1194 } 1194 }
1195 1195
1196 void FlatProfiler::allocate_table() { 1196 void FlatProfiler::allocate_table() {
1197 { // Bytecode table 1197 { // Bytecode table
1198 bytecode_ticks = NEW_C_HEAP_ARRAY(int, Bytecodes::number_of_codes); 1198 bytecode_ticks = NEW_C_HEAP_ARRAY(int, Bytecodes::number_of_codes, mtInternal);
1199 bytecode_ticks_stub = NEW_C_HEAP_ARRAY(int, Bytecodes::number_of_codes); 1199 bytecode_ticks_stub = NEW_C_HEAP_ARRAY(int, Bytecodes::number_of_codes, mtInternal);
1200 for(int index = 0; index < Bytecodes::number_of_codes; index++) { 1200 for(int index = 0; index < Bytecodes::number_of_codes; index++) {
1201 bytecode_ticks[index] = 0; 1201 bytecode_ticks[index] = 0;
1202 bytecode_ticks_stub[index] = 0; 1202 bytecode_ticks_stub[index] = 0;
1203 } 1203 }
1204 } 1204 }
1205 1205
1206 if (ProfilerRecordPC) PCRecorder::init(); 1206 if (ProfilerRecordPC) PCRecorder::init();
1207 1207
1208 interval_data = NEW_C_HEAP_ARRAY(IntervalData, interval_print_size); 1208 interval_data = NEW_C_HEAP_ARRAY(IntervalData, interval_print_size, mtInternal);
1209 FlatProfiler::interval_reset(); 1209 FlatProfiler::interval_reset();
1210 } 1210 }
1211 1211
1212 void FlatProfiler::engage(JavaThread* mainThread, bool fullProfile) { 1212 void FlatProfiler::engage(JavaThread* mainThread, bool fullProfile) {
1213 full_profile_flag = fullProfile; 1213 full_profile_flag = fullProfile;