@@ -197,27 +197,26 @@ void WallClockJVMTI::timerLoop() {
197197 bool do_filter = threadFilter->enabled ();
198198 int self = OS::threadId ();
199199
200- // If filtering is enabled, collect the filtered TIDs first
201- std::vector<int > filtered_tids;
202- if (do_filter) {
203- Profiler::instance ()->threadFilter ()->collect (filtered_tids);
204- // Sort the TIDs for efficient lookup
205- std::sort (filtered_tids.begin (), filtered_tids.end ());
206- }
200+ // If filtering is enabled, collect the filtered TIDs first
201+ std::vector<int > filtered_tids;
202+ if (do_filter) {
203+ Profiler::instance ()->threadFilter ()->collect (filtered_tids);
204+ // Sort the TIDs for efficient lookup
205+ std::sort (filtered_tids.begin (), filtered_tids.end ());
206+ }
207207
208- for (int i = 0 ; i < threads_count; i++) {
209- jthread thread = threads_ptr[i];
210- if (thread != nullptr ) {
211- ddprof::VMThread* nThread = static_cast <ddprof::VMThread*>(VMThread::fromJavaThread (jni, thread));
212- if (nThread == nullptr ) {
213- continue ;
214- }
215- int tid = nThread->osThreadId ();
216- if (tid != self && (!do_filter ||
217- // Use binary search to efficiently find if tid is in filtered_tids
218- std::binary_search (filtered_tids.begin (), filtered_tids.end (), tid))) {
219- threads.push_back ({nThread, thread});
220- }
208+ for (int i = 0 ; i < threads_count; i++) {
209+ jthread thread = threads_ptr[i];
210+ if (thread != nullptr ) {
211+ ddprof::VMThread* nThread = static_cast <ddprof::VMThread*>(VMThread::fromJavaThread (jni, thread));
212+ if (nThread == nullptr ) {
213+ continue ;
214+ }
215+ int tid = nThread->osThreadId ();
216+ if (tid != self && (!do_filter ||
217+ // Use binary search to efficiently find if tid is in filtered_tids
218+ std::binary_search (filtered_tids.begin (), filtered_tids.end (), tid))) {
219+ threads.push_back ({nThread, thread});
221220 }
222221 }
223222 }
0 commit comments