I'm surprised that this turns out to be a bottleneck. All the work to create the threads should have been done when you stopped, so this should just be running over a vector that already exists and pulling a field out. Can you profile this and see what is actually slow?
Jim > On Mar 3, 2016, at 9:54 AM, Eugene Birukov via lldb-dev > <lldb-dev@lists.llvm.org> wrote: > > Hi, > > I am working on a custom debugger on Linux and I am using LLDB C++ API for > that. So far, from the functionality point of view the life is good, but I am > running into severe performance issue. > > The problem is that the target application has literally hundreds of threads, > and when the target process stops, I need to identify all the threads that > have non-trivial stop reason. So, I am doing something like that: > > // Loop over threads > int numThreads = m_Process.GetNumThreads(); > for (int threadIndex = 0; threadIndex < numThreads; ++threadIndex) > { > // Inspect the thread state > sbThread = m_Process.GetThreadAtIndex(threadIndex); > stopReason = sbThread.GetStopReason(); > ... > > > Well, this loop turns out to be a bottleneck. > > So, is there any way to find all the stopped threads without iterating over > the whole world? > > Thanks, > Eugene > > > _______________________________________________ > lldb-dev mailing list > lldb-dev@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev _______________________________________________ lldb-dev mailing list lldb-dev@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev