This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SensorService will cause system performance slow down in TI-Android-GingerBread-2.3.4-DevKit-2.1

Dears,

I had ported TI-Android-GingerBread-2.3.4-DevKit-2.1 to AM3730 and all functionalities are OK.

We have 5 sensors in my device -> G-sensor, E-compass, Gyroscope, Proximity sensor and Light sensor.

Recently, I met a problem that is the system performance will slow down when I enable HAL for sensors.

I used DDMS to debug and I found a message -> "The CPU utilization for SensorService is 72%"

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

There are some scenarios will cause system performance slow down and please refer to the following for detail:

1. Everything will be fine if I enable G-sensor, E-compass and Gyroscope. (Disable Proximity sensor and Light sensor)

2. Performance will slow down if enable G-sensor, E-compass, Gyroscope and Proximity sensor. (Disable Light sensor)

3. Performance will slow down if enable G-sensor, E-compass, Gyroscope and Light sensor. (Disable Proximity sensor)

4. Performance will slow down if enable G-sensor, E-compass, Gyroscope, Proximity sensor and Light sensor.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I think the root cause are Proximity sensor and Light sensor but I have no idea to find out it.

Anyone has a good idea for this issue ?

Best regards,

Jake

  • Hi Jake,

    Would try to enable only light sensor and observe the CPU usage ?

    you can use $ adb shell dumpsys cpuinfo to get  usage.

    DDMS will help you to find out more about specific service usage.

    -

    satish

  • Dear Satish,

    OK, I will try it and reply the results.

    Thanks for your suggestion and reply.

    Jake

  • Hi Lian,

    By default sensors should get disabled when android boots up.

    A particular sensor should be enabled only when some application is using it.

    1. Please check whether you are getting any sensors events once android boots up. you can use getevent command to check the same.

    2. You can set the polling delay of a particular sensor by writing into sysfs entries. Try by increasing the polling interval.

     

    Thanks and Regards,

    Pankaj Bharadiya.

     

  • Dear Bharadiya,

    Thanks for your reply .

    Basically, we usually use input event concept to implement driver for sensors, for example: G-sensor and E-compass...etc.

    But I used Sysfs concept to implement drivers for Proximity sensor and Light sensor and modified HAL to match it.

    (I used input event concept to implement drivers for G-sensor, E-compass and Gyroscope)

    It means I will create a sysfs node for get sensor output data and feedback it to the framework, so the polling time is depend on the applicatoin if the it access the sysfs node.

    regards,

    Jake

  • Hi Jake,

    Can you confirm that Sensor enable/disable functionality working fine?

    Please put a log in readEvent funtion. This log should not appear if  sensor is properly disabled.

    How you are reading data in HAL from sysfs interface in case of light and proximity sensors?

    Regards,

    Pankaj Bharadiya