+ size_t logicalcpu_size = sizeof(g_nlogicalcpu);
+ ret = sysctlbyname("hw.logicalcpu", &g_nlogicalcpu, &logicalcpu_size, NULL, 0);
+ if (ret) {
+ err(EX_OSERR, "Failed sysctlbyname(hw.logicalcpu)");
+ }
+
+ if (g_test_rt) {
+ if (g_numthreads == 0) {
+ g_numthreads = g_numcpus;
+ }
+ g_policy = MY_POLICY_REALTIME;
+ g_do_all_spin = TRUE;
+ g_histogram = true;
+ /* Don't change g_traceworthy_latency_ns if it's explicity been set to something other than the default */
+ if (g_traceworthy_latency_ns == TRACEWORTHY_NANOS) {
+ g_traceworthy_latency_ns = TRACEWORTHY_NANOS_TEST;
+ }
+ } else if (g_test_rt_smt) {
+ if (g_nlogicalcpu != 2 * g_nphysicalcpu) {
+ /* Not SMT */
+ printf("Attempt to run --test-rt-smt on a non-SMT device\n");
+ exit(0);
+ }
+
+ if (g_numthreads == 0) {
+ g_numthreads = g_nphysicalcpu;
+ }
+ g_policy = MY_POLICY_REALTIME;
+ g_do_all_spin = TRUE;
+ g_histogram = true;
+ } else if (g_test_rt_avoid0) {
+#if defined(__x86_64__) || defined(__i386__)
+ if (g_numthreads == 0) {
+ g_numthreads = g_nphysicalcpu - 1;
+ }
+ if (g_numthreads == 0) {
+ printf("Attempt to run --test-rt-avoid0 on a uniprocessor\n");
+ exit(0);
+ }
+ g_policy = MY_POLICY_REALTIME;
+ g_do_all_spin = TRUE;
+ g_histogram = true;
+#else
+ printf("Attempt to run --test-rt-avoid0 on a non-Intel device\n");
+ exit(0);
+#endif
+ } else if (g_numthreads == 0) {
+ g_numthreads = g_numcpus;
+ }
+
+ if (g_do_each_spin) {