<rdar://problem/13282582>

Really don't call sysctl again when we already have the result.

llvm-svn: 176062
This commit is contained in:
Han Ming Ong 2013-02-26 00:04:29 +00:00
parent d882998eff
commit f4124aea41
1 changed files with 5 additions and 2 deletions

View File

@ -296,8 +296,11 @@ MachTask::GetProfileData ()
static int32_t numCPU = -1;
int32_t mib[] = {CTL_HW, HW_AVAILCPU};
size_t len = sizeof(numCPU);
if (numCPU == -1)
{
if (sysctl(mib, sizeof(mib) / sizeof(int32_t), &numCPU, &len, NULL, 0) != 0)
return result;
}
mach_port_t localHost = mach_host_self();
struct host_cpu_load_info host_info;