63 class ThreadProfilerMark: public StackObj { |
63 class ThreadProfilerMark: public StackObj { |
64 public: |
64 public: |
65 // For now, the only thread-specific region is the class loader. |
65 // For now, the only thread-specific region is the class loader. |
66 enum Region { noRegion, classLoaderRegion, extraRegion, maxRegion }; |
66 enum Region { noRegion, classLoaderRegion, extraRegion, maxRegion }; |
67 |
67 |
68 ThreadProfilerMark(Region) KERNEL_RETURN; |
68 ThreadProfilerMark(Region) NOT_FPROF_RETURN; |
69 ~ThreadProfilerMark() KERNEL_RETURN; |
69 ~ThreadProfilerMark() NOT_FPROF_RETURN; |
70 |
70 |
71 private: |
71 private: |
72 ThreadProfiler* _pp; |
72 ThreadProfiler* _pp; |
73 Region _r; |
73 Region _r; |
74 }; |
74 }; |
75 |
75 |
76 #ifndef FPROF_KERNEL |
76 #if INCLUDE_FPROF |
77 |
77 |
78 class IntervalData VALUE_OBJ_CLASS_SPEC { |
78 class IntervalData VALUE_OBJ_CLASS_SPEC { |
79 // Just to keep these things all together |
79 // Just to keep these things all together |
80 private: |
80 private: |
81 int _interpreted; |
81 int _interpreted; |
117 _compiling = 0; |
117 _compiling = 0; |
118 } |
118 } |
119 static void print_header(outputStream* st); |
119 static void print_header(outputStream* st); |
120 void print_data(outputStream* st); |
120 void print_data(outputStream* st); |
121 }; |
121 }; |
122 #endif // FPROF_KERNEL |
122 #endif // INCLUDE_FPROF |
123 |
123 |
124 class ThreadProfiler: public CHeapObj<mtInternal> { |
124 class ThreadProfiler: public CHeapObj<mtInternal> { |
125 public: |
125 public: |
126 ThreadProfiler() KERNEL_RETURN; |
126 ThreadProfiler() NOT_FPROF_RETURN; |
127 ~ThreadProfiler() KERNEL_RETURN; |
127 ~ThreadProfiler() NOT_FPROF_RETURN; |
128 |
128 |
129 // Resets the profiler |
129 // Resets the profiler |
130 void reset() KERNEL_RETURN; |
130 void reset() NOT_FPROF_RETURN; |
131 |
131 |
132 // Activates the profiler for a certain thread |
132 // Activates the profiler for a certain thread |
133 void engage() KERNEL_RETURN; |
133 void engage() NOT_FPROF_RETURN; |
134 |
134 |
135 // Deactivates the profiler |
135 // Deactivates the profiler |
136 void disengage() KERNEL_RETURN; |
136 void disengage() NOT_FPROF_RETURN; |
137 |
137 |
138 // Prints the collected profiling information |
138 // Prints the collected profiling information |
139 void print(const char* thread_name) KERNEL_RETURN; |
139 void print(const char* thread_name) NOT_FPROF_RETURN; |
140 |
140 |
141 // Garbage Collection Support |
141 // Garbage Collection Support |
142 void oops_do(OopClosure* f) KERNEL_RETURN; |
142 void oops_do(OopClosure* f) NOT_FPROF_RETURN; |
143 |
143 |
144 #ifndef FPROF_KERNEL |
144 #if INCLUDE_FPROF |
145 private: |
145 private: |
146 // for recording ticks. |
146 // for recording ticks. |
147 friend class ProfilerNode; |
147 friend class ProfilerNode; |
148 char* area_bottom; // preallocated area for pnodes |
148 char* area_bottom; // preallocated area for pnodes |
149 char* area_top; |
149 char* area_top; |
223 return _interval_data; |
223 return _interval_data; |
224 } |
224 } |
225 IntervalData* interval_data_ref() { |
225 IntervalData* interval_data_ref() { |
226 return &_interval_data; |
226 return &_interval_data; |
227 } |
227 } |
228 #endif // FPROF_KERNEL |
228 #endif // INCLUDE_FPROF |
229 }; |
229 }; |
230 |
230 |
231 class FlatProfiler: AllStatic { |
231 class FlatProfiler: AllStatic { |
232 public: |
232 public: |
233 static void reset() KERNEL_RETURN ; |
233 static void reset() NOT_FPROF_RETURN ; |
234 static void engage(JavaThread* mainThread, bool fullProfile) KERNEL_RETURN ; |
234 static void engage(JavaThread* mainThread, bool fullProfile) NOT_FPROF_RETURN ; |
235 static void disengage() KERNEL_RETURN ; |
235 static void disengage() NOT_FPROF_RETURN ; |
236 static void print(int unused) KERNEL_RETURN ; |
236 static void print(int unused) NOT_FPROF_RETURN ; |
237 static bool is_active() KERNEL_RETURN_(false) ; |
237 static bool is_active() NOT_FPROF_RETURN_(false) ; |
238 |
238 |
239 // This is NULL if each thread has its own thread profiler, |
239 // This is NULL if each thread has its own thread profiler, |
240 // else this is the single thread profiler used by all threads. |
240 // else this is the single thread profiler used by all threads. |
241 // In particular it makes a difference during garbage collection, |
241 // In particular it makes a difference during garbage collection, |
242 // where you only want to traverse each thread profiler once. |
242 // where you only want to traverse each thread profiler once. |
243 static ThreadProfiler* get_thread_profiler() KERNEL_RETURN_(NULL); |
243 static ThreadProfiler* get_thread_profiler() NOT_FPROF_RETURN_(NULL); |
244 |
244 |
245 // Garbage Collection Support |
245 // Garbage Collection Support |
246 static void oops_do(OopClosure* f) KERNEL_RETURN ; |
246 static void oops_do(OopClosure* f) NOT_FPROF_RETURN ; |
247 |
247 |
248 // Support for disassembler to inspect the PCRecorder |
248 // Support for disassembler to inspect the PCRecorder |
249 |
249 |
250 // Returns the start address for a given pc |
250 // Returns the start address for a given pc |
251 // NULL is returned if the PCRecorder is inactive |
251 // NULL is returned if the PCRecorder is inactive |
252 static address bucket_start_for(address pc) KERNEL_RETURN_(NULL); |
252 static address bucket_start_for(address pc) NOT_FPROF_RETURN_(NULL); |
253 |
253 |
254 enum { MillisecsPerTick = 10 }; // ms per profiling ticks |
254 enum { MillisecsPerTick = 10 }; // ms per profiling ticks |
255 |
255 |
256 // Returns the number of ticks recorded for the bucket |
256 // Returns the number of ticks recorded for the bucket |
257 // pc belongs to. |
257 // pc belongs to. |
258 static int bucket_count_for(address pc) KERNEL_RETURN_(0); |
258 static int bucket_count_for(address pc) NOT_FPROF_RETURN_(0); |
259 |
259 |
260 #ifndef FPROF_KERNEL |
260 #if INCLUDE_FPROF |
261 |
261 |
262 private: |
262 private: |
263 static bool full_profile() { |
263 static bool full_profile() { |
264 return full_profile_flag; |
264 return full_profile_flag; |
265 } |
265 } |
322 static void interval_record_thread(ThreadProfiler* tp); // extract ticks from ThreadProfiler. |
322 static void interval_record_thread(ThreadProfiler* tp); // extract ticks from ThreadProfiler. |
323 static void interval_print(); // print interval data. |
323 static void interval_print(); // print interval data. |
324 static void interval_reset(); // reset interval data. |
324 static void interval_reset(); // reset interval data. |
325 enum {interval_print_size = 10}; |
325 enum {interval_print_size = 10}; |
326 static IntervalData* interval_data; |
326 static IntervalData* interval_data; |
327 #endif // FPROF_KERNEL |
327 #endif // INCLUDE_FPROF |
328 }; |
328 }; |
329 |
329 |
330 #endif // SHARE_VM_RUNTIME_FPROFILER_HPP |
330 #endif // SHARE_VM_RUNTIME_FPROFILER_HPP |