From a2597443b73b60db159d4d6d1a025798e84de727 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 5 Jul 2006 19:20:12 +0000 Subject: [PATCH] unhardcode cpu vendor --- src/os/darwin/darwin_sigar.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/os/darwin/darwin_sigar.c b/src/os/darwin/darwin_sigar.c index 562b157b..1dcd0d57 100644 --- a/src/os/darwin/darwin_sigar.c +++ b/src/os/darwin/darwin_sigar.c @@ -1316,6 +1316,19 @@ int sigar_cpu_info_list_get(sigar_t *sigar, mhz = sigar_cpu_mhz_from_model(model); } +#ifdef DARWIN + size = sizeof(vendor); + if (sysctlbyname("machdep.cpu.vendor", &vendor, &size, NULL, 0) < 0) { + SIGAR_SSTRCPY(vendor, "Apple"); + } + else { + /* GenuineIntel -> Intel */ + if (strstr(vendor, "Intel")) { + SIGAR_SSTRCPY(vendor, "Intel"); + } + } +#endif + if ((ptr = strchr(model, ' '))) { *ptr = '\0'; if (strstr(model, "Intel")) { @@ -1351,11 +1364,8 @@ int sigar_cpu_info_list_get(sigar_t *sigar, SIGAR_CPU_INFO_LIST_GROW(cpu_infos); info = &cpu_infos->data[cpu_infos->number++]; -#ifdef DARWIN - SIGAR_SSTRCPY(info->vendor, "Apple"); -#else + SIGAR_SSTRCPY(info->vendor, vendor); -#endif SIGAR_SSTRCPY(info->model, model); sigar_cpu_model_adjust(sigar, info);