@@ -40,12 +40,6 @@ static inline int cmp64(u64 a, u64 b) {
4040}
4141
4242
43- union CallTraceBuffer {
44- ASGCT_CallFrame _asgct_frames[MAX_STACK_FRAMES];
45- jvmtiFrameInfo _jvmti_frames[MAX_STACK_FRAMES];
46- };
47-
48-
4943class CallTraceSample {
5044 private:
5145 u64 _samples;
@@ -130,7 +124,7 @@ class Profiler {
130124 MethodSample _methods[MAX_CALLTRACES];
131125
132126 SpinLock _locks[CONCURRENCY_LEVEL];
133- CallTraceBuffer _calltrace_buffer[CONCURRENCY_LEVEL];
127+ ASGCT_CallFrame _calltrace_buffer[CONCURRENCY_LEVEL][MAX_STACK_FRAMES ];
134128 ASGCT_CallFrame* _frame_buffer;
135129 int _frame_buffer_size;
136130 volatile int _frame_buffer_index;
@@ -153,14 +147,14 @@ class Profiler {
153147 const char * findNativeMethod (const void * address);
154148 int getNativeTrace (int tid, ASGCT_CallFrame* frames);
155149 int getJavaTraceAsync (void * ucontext, ASGCT_CallFrame* frames, int max_depth);
156- int getJavaTraceJVMTI (jvmtiFrameInfo* jvmti_frames, ASGCT_CallFrame* frames, int max_depth);
157150 int makeEventFrame (ASGCT_CallFrame* frames, jint event_type, jmethodID event);
158151 bool fillTopFrame (const void * pc, ASGCT_CallFrame* frame);
159152 u64 hashCallTrace (int num_frames, ASGCT_CallFrame* frames);
160153 void storeCallTrace (int num_frames, ASGCT_CallFrame* frames, u64 counter);
161154 void copyToFrameBuffer (int num_frames, ASGCT_CallFrame* frames, CallTraceSample* trace);
162155 u64 hashMethod (jmethodID method);
163156 void storeMethod (jmethodID method, jint bci, u64 counter);
157+ void initStateLock ();
164158 void resetSymbols ();
165159 void setSignalHandler ();
166160 void runInternal (Arguments& args, std::ostream& out);
@@ -177,14 +171,15 @@ class Profiler {
177171 _java_methods (),
178172 _runtime_stubs (" [stubs]" ),
179173 _native_lib_count (0 ) {
180- pthread_mutex_init (&_state_lock, NULL );
174+ initStateLock ( );
181175 }
182176
183177 u64 total_samples () { return _total_samples; }
184178 u64 total_counter () { return _total_counter; }
185179 time_t uptime () { return time (NULL ) - _start_time; }
186180
187181 void run (Arguments& args);
182+ void shutdown (Arguments& args);
188183 Error start (const char * event, long interval, int frame_buffer_size, bool threads);
189184 Error stop ();
190185 void dumpSummary (std::ostream& out);
@@ -194,11 +189,6 @@ class Profiler {
194189 void recordSample (void * ucontext, u64 counter, jint event_type, jmethodID event);
195190 NativeCodeCache* jvmLibrary ();
196191
197- static void JNICALL VMDeath (jvmtiEnv* jvmti, JNIEnv* jni) {
198- MutexLocker ml (_instance._state_lock );
199- _instance._state = TERMINATED;
200- }
201-
202192 // CompiledMethodLoad is also needed to enable DebugNonSafepoints info by default
203193 static void JNICALL CompiledMethodLoad (jvmtiEnv* jvmti, jmethodID method,
204194 jint code_size, const void * code_addr,
0 commit comments