From 0332aa6be038c5088f6dcc2e9834cc66691ea091 Mon Sep 17 00:00:00 2001 From: Patrick Porlan Date: Mon, 26 May 2014 10:39:07 +0200 Subject: [PATCH] STPK-1429 Remove articifial delay between poll exits I introduced a minimum 1 ms delay between poll operations early in development as a way to limit CPU usage in case of problems with a sensor. That has become a significant source of jitter now that we control a bunch of sensors from that loop, and never was a good way to handle misbehaving sensors anyway (we yet have to devise one). This commits removes this forced gap between the last poll exit and the next poll entry. Issue: STPK-1429 Change-Id: I1b59ffbd71cad608456b98a336089c9057874aee Signed-off-by: Patrick Porlan --- control.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/control.c b/control.c index e204cbe..6cfbef3 100644 --- a/control.c +++ b/control.c @@ -30,9 +30,6 @@ static int64_t last_poll_exit_ts; static int active_poll_sensors; /* Number of enabled poll-mode sensors */ -/* Cap the time between poll operations to this, to counter runaway polls */ -#define POLL_MIN_INTERVAL 1000 /* uS */ - #define INVALID_DEV_NUM ((uint32_t) -1) @@ -621,12 +618,6 @@ return_first_available_sensor_report: } await_event: - /* Keep a minimum time interval between poll operations */ - delta = (get_timestamp() - last_poll_exit_ts)/1000; - - if (delta > 0 && delta < POLL_MIN_INTERVAL) - usleep(POLL_MIN_INTERVAL - delta); - ALOGV("Awaiting sensor data\n"); nfds = epoll_wait(poll_fd, ev, MAX_DEVICES, get_poll_time()); @@ -786,9 +777,9 @@ int sensor_set_delay(int s, int64_t ns) } } - /* Cap sampling rate */ + /* Cap sampling rate at 1000 events per second for now*/ - limit = 1000000/POLL_MIN_INTERVAL; + limit = 1000; if (max_supported_rate && new_sampling_rate > max_supported_rate) limit = max_supported_rate; -- 2.11.0