From 00a5799698583ad375c6b0812fb9dcd0250a0670 Mon Sep 17 00:00:00 2001 From: Han Ming Ong Date: Fri, 25 Jan 2013 18:32:24 +0000 Subject: [PATCH] Get the number of threads correct. llvm-svn: 173466 --- lldb/tools/debugserver/source/MacOSX/MachTask.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lldb/tools/debugserver/source/MacOSX/MachTask.cpp b/lldb/tools/debugserver/source/MacOSX/MachTask.cpp index 4455cc814f6c..41766f5cc90d 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachTask.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachTask.cpp @@ -232,7 +232,7 @@ MachTask::GetMemoryRegionInfo (nub_addr_t addr, DNBRegionInfo *region_info) } while (0) // We should consider moving this into each MacThread. -static void get_threads_profile_data(task_t task, nub_process_t pid, int &num_threads, std::vector &threads_id, std::vector &threads_name, std::vector &threads_used_usec) +static void get_threads_profile_data(task_t task, nub_process_t pid, std::vector &threads_id, std::vector &threads_name, std::vector &threads_used_usec) { kern_return_t kr; thread_act_array_t threads; @@ -242,7 +242,6 @@ static void get_threads_profile_data(task_t task, nub_process_t pid, int &num_th if (kr != KERN_SUCCESS) return; - num_threads = tcnt; for (int i = 0; i < tcnt; i++) { thread_identifier_info_data_t identifier_info; mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT; @@ -303,7 +302,6 @@ MachTask::GetProfileData () uint64_t elapsed_usec = 0; uint64_t task_used_usec = 0; - int num_threads = 0; std::vector threads_id; std::vector threads_name; std::vector threads_used_usec; @@ -315,7 +313,7 @@ MachTask::GetProfileData () TIME_VALUE_TO_TIMEVAL(&task_info.system_time, &tv); timeradd(¤t_used_time, &tv, ¤t_used_time); task_used_usec = current_used_time.tv_sec * 1000000ULL + current_used_time.tv_usec; - get_threads_profile_data(task, m_process->ProcessID(), num_threads, threads_id, threads_name, threads_used_usec); + get_threads_profile_data(task, m_process->ProcessID(), threads_id, threads_name, threads_used_usec); struct timeval current_elapsed_time; int res = gettimeofday(¤t_elapsed_time, NULL); @@ -338,6 +336,7 @@ MachTask::GetProfileData () profile_data_stream << "elapsed_usec:" << elapsed_usec << ';'; profile_data_stream << "task_used_usec:" << task_used_usec << ';'; + int num_threads = threads_id.size(); for (int i=0; i