From 2ef0d54ffcddbd1dadd6cc546ce9df6c5c0bfb0f Mon Sep 17 00:00:00 2001
From: Craig Tiller <ctiller@google.com>
Date: Wed, 8 Feb 2017 13:53:18 -0800
Subject: [PATCH] Handle one core

---
 src/core/lib/profiling/basic_timers.c | 1 +
 tools/run_tests/run_microbenchmark.py | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/core/lib/profiling/basic_timers.c b/src/core/lib/profiling/basic_timers.c
index 1fbc9d7023..1f1987fb8e 100644
--- a/src/core/lib/profiling/basic_timers.c
+++ b/src/core/lib/profiling/basic_timers.c
@@ -43,6 +43,7 @@
 #include <grpc/support/thd.h>
 #include <grpc/support/time.h>
 #include <stdio.h>
+#include <string.h>
 
 #include "src/core/lib/support/env.h"
 
diff --git a/tools/run_tests/run_microbenchmark.py b/tools/run_tests/run_microbenchmark.py
index a5794dc9ee..096d7d78ab 100755
--- a/tools/run_tests/run_microbenchmark.py
+++ b/tools/run_tests/run_microbenchmark.py
@@ -101,7 +101,7 @@ for bm_name in sys.argv[1:]:
     if len(benchmarks) >= min(4, multiprocessing.cpu_count()):
       # run up to half the cpu count: each benchmark can use up to two cores
       # (one for the microbenchmark, one for the data flush)
-      jobset.run(benchmarks, maxjobs=multiprocessing.cpu_count()/2,
+      jobset.run(benchmarks, maxjobs=max(1, multiprocessing.cpu_count()/2),
                  add_env={'GRPC_TEST_PORT_SERVER': 'localhost:%d' % port_server_port})
       jobset.run(profile_analysis, maxjobs=multiprocessing.cpu_count())
       jobset.run(cleanup, maxjobs=multiprocessing.cpu_count())
@@ -110,7 +110,7 @@ for bm_name in sys.argv[1:]:
       cleanup = []
   # run the remaining benchmarks that weren't flushed
   if len(benchmarks):
-    jobset.run(benchmarks, maxjobs=multiprocessing.cpu_count()/2,
+    jobset.run(benchmarks, maxjobs=max(1, multiprocessing.cpu_count()/2),
                add_env={'GRPC_TEST_PORT_SERVER': 'localhost:%d' % port_server_port})
     jobset.run(profile_analysis, maxjobs=multiprocessing.cpu_count())
     jobset.run(cleanup, maxjobs=multiprocessing.cpu_count())
-- 
GitLab