OSDN Git Service

STPK-1429 Add a trace warning of unusually high sysfs read times
authorPatrick Porlan <patrick.porlan@intel.com>
Thu, 26 Jun 2014 13:17:09 +0000 (15:17 +0200)
committerPatrick Porlan <patrick.porlan@intel.com>
Thu, 26 Jun 2014 13:31:17 +0000 (15:31 +0200)
It looks like some sensors (proximity on MRD 7 perhaps) have
acquisition times in the order of several hundred ms. Help
flag those with a trace warning of combined (all channels)
acquisition times larger than 100 ms. None of the T100 sensors
(magnetometer, temperature, ALS) have this problem though.

Issue: STPK-1429

Change-Id: I04ee59f63184c89eae26e46460f4dcb675b91131
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
control.c

index 92dbf6f..d2d6d0c 100644 (file)
--- a/control.c
+++ b/control.c
@@ -441,6 +441,7 @@ static int propagate_sensor_report(int s, struct sensors_event_t* data)
        int c;
        unsigned char* current_sample;
        int64_t current_ts = get_timestamp();
+       int64_t delta;
 
        memset(data, 0, sizeof(sensors_event_t));
 
@@ -498,6 +499,14 @@ static int propagate_sensor_report(int s, struct sensors_event_t* data)
                        ALOGV("\tfield %d: %f\n", c, data->data[c]);
                }
 
+               /* Control acquisition time and flag anything beyond 100 ms */
+               delta = get_timestamp() - current_ts;
+
+               if (delta > 100 * 1000 * 1000) {
+                       ALOGI("Sensor %d (%s) sampling time: %d ms\n", s,
+                       sensor_info[s].friendly_name, (int) (delta / 1000000));
+               }
+
                return sensor_info[s].ops.finalize(s, data);
        }