[autotest] Adjust the pause in each tick of the host scheduler

Add a global config to get a minimum tick time of the host scheduler.

BUG=chromium:448940
TEST=Test on the moblab
DEPLOY=scheduler,host_scheduler

Change-Id: I4889af69aef707f102fb8e7fdbf9a258ccd0df7d
Reviewed-on: https://chromium-review.googlesource.com/262489
Reviewed-by: Dan Shi <dshi@chromium.org>
Tested-by: Shuqian Zhao <shuqianz@chromium.org>
Commit-Queue: Shuqian Zhao <shuqianz@chromium.org>
diff --git a/scheduler/host_scheduler.py b/scheduler/host_scheduler.py
index c670355..c22b41c 100755
--- a/scheduler/host_scheduler.py
+++ b/scheduler/host_scheduler.py
@@ -476,9 +476,16 @@
         initialize(options.testing)
 
         host_scheduler = HostScheduler()
+        minimum_tick_sec = global_config.global_config.get_config_value(
+                'SCHEDULER', 'minimum_tick_sec', type=float)
         while not _shutdown:
+            start = time.time()
             host_scheduler.tick()
-            time.sleep(_tick_pause_sec)
+            curr_tick_sec = time.time() - start
+            if (minimum_tick_sec > curr_tick_sec):
+                time.sleep(minimum_tick_sec - curr_tick_sec)
+            else:
+                time.sleep(0.0001)
     except Exception:
         email_manager.manager.log_stacktrace(
                 'Uncaught exception; terminating host_scheduler.')