aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarat Dukhan <marat@fb.com>2018-12-26 20:23:13 -0800
committerMarat Dukhan <marat@fb.com>2018-12-26 20:23:13 -0800
commit40c5f3695b053e5c3d642d9bc34113f3baa71ef2 (patch)
treecc9808bcd43d72cf97a91fa70f92cf5b0da06876
parentc82f5e3d28f0e617b232c34173f0a07ef95e2b04 (diff)
downloadcpuinfo-40c5f3695b053e5c3d642d9bc34113f3baa71ef2.tar.gz
Log common issues in iOS initialization with lower severity
-rw-r--r--src/arm/mach/init.c10
-rw-r--r--src/mach/topology.c6
2 files changed, 11 insertions, 5 deletions
diff --git a/src/arm/mach/init.c b/src/arm/mach/init.c
index 91d0353..e326716 100644
--- a/src/arm/mach/init.c
+++ b/src/arm/mach/init.c
@@ -46,26 +46,26 @@ static uint32_t get_sys_info(int type_specifier, const char* name) {
uint32_t result = 0;
int mib[2] = { CTL_HW, type_specifier };
if (sysctl(mib, 2, NULL, &size, NULL, 0) != 0) {
- cpuinfo_log_error("sysctl(\"%s\") failed: %s", name, strerror(errno));
+ cpuinfo_log_info("sysctl(\"%s\") failed: %s", name, strerror(errno));
} else if (size == sizeof(uint32_t)) {
sysctl(mib, 2, &result, &size, NULL, 0);
cpuinfo_log_debug("%s: %"PRIu32 ", size = %lu", name, result, size);
} else {
- cpuinfo_log_warning("sysctl does not support non-integer lookup for (\"%s\")", name);
+ cpuinfo_log_info("sysctl does not support non-integer lookup for (\"%s\")", name);
}
return result;
}
-static uint64_t get_sys_info_by_name(const char* type_specifier) {
+static uint32_t get_sys_info_by_name(const char* type_specifier) {
size_t size = 0;
uint32_t result = 0;
if (sysctlbyname(type_specifier, NULL, &size, NULL, 0) != 0) {
- cpuinfo_log_error("sysctlbyname(\"%s\") failed: %s", type_specifier, strerror(errno));
+ cpuinfo_log_info("sysctlbyname(\"%s\") failed: %s", type_specifier, strerror(errno));
} else if (size == sizeof(uint32_t)) {
sysctlbyname(type_specifier, &result, &size, NULL, 0);
cpuinfo_log_debug("%s: %"PRIu32 ", size = %lu", type_specifier, result, size);
} else {
- cpuinfo_log_warning("sysctl does not support non-integer lookup for (\"%s\")", type_specifier);
+ cpuinfo_log_info("sysctl does not support non-integer lookup for (\"%s\")", type_specifier);
}
return result;
}
diff --git a/src/mach/topology.c b/src/mach/topology.c
index 614254b..b56343b 100644
--- a/src/mach/topology.c
+++ b/src/mach/topology.c
@@ -8,6 +8,8 @@
#include <cpuinfo/log.h>
#include <mach/api.h>
+#include <TargetConditionals.h>
+
struct cpuinfo_mach_topology cpuinfo_mach_detect_topology(void) {
int cores = 1;
@@ -29,6 +31,7 @@ struct cpuinfo_mach_topology cpuinfo_mach_detect_topology(void) {
}
int packages = 1;
+#if !TARGET_OS_IPHONE
size_t sizeof_packages = sizeof(packages);
if (sysctlbyname("hw.packages", &packages, &sizeof_packages, NULL, 0) != 0) {
cpuinfo_log_error("sysctlbyname(\"hw.packages\") failed: %s", strerror(errno));
@@ -36,6 +39,7 @@ struct cpuinfo_mach_topology cpuinfo_mach_detect_topology(void) {
cpuinfo_log_error("sysctlbyname(\"hw.packages\") returned invalid value %d", packages);
packages = 1;
}
+#endif
cpuinfo_log_debug("mach topology: packages = %d, cores = %d, threads = %d", packages, (int) cores, (int) threads);
struct cpuinfo_mach_topology topology = {
@@ -44,6 +48,7 @@ struct cpuinfo_mach_topology cpuinfo_mach_detect_topology(void) {
.threads = (uint32_t) threads
};
+#if !TARGET_OS_IPHONE
size_t cacheconfig_size = 0;
if (sysctlbyname("hw.cacheconfig", NULL, &cacheconfig_size, NULL, 0) != 0) {
cpuinfo_log_error("sysctlbyname(\"hw.cacheconfig\") failed: %s", strerror(errno));
@@ -63,5 +68,6 @@ struct cpuinfo_mach_topology cpuinfo_mach_detect_topology(void) {
}
}
}
+#endif
return topology;
}