最近的項目有需求要獲取CPU的溫度,在網上找了一些資料,基本算是解決了問題:linux
進入adb shell執行下面的命令:android
shell@android:/ $ cat /etc/thermald.conf
這個不一樣設備獲得的結果多是不已樣的,有這樣的:shell
sampling 5000 [tsens_tz_sensor0] sampling 5000 thresholds 10 thresholds_clr 5 actions none action_info 0 [tsens_tz_sensor1] sampling 5000 thresholds 60 thresholds_clr 57 actions none action_info 0 [tsens_tz_sensor2] sampling 5000 thresholds 60 thresholds_clr 57 actions none action_info 0 [tsens_tz_sensor3] sampling 5000 thresholds 60 thresholds_clr 57 actions none action_info 0 [tsens_tz_sensor4] sampling 5000 thresholds 60 thresholds_clr 57 actions none action_info 0 [tsens_tz_sensor5] sampling 5000 thresholds 60 thresholds_clr 57 actions none action_info 0 [tsens_tz_sensor6] sampling 5000 thresholds 60 thresholds_clr 57 actions none action_info 0 [tsens_tz_sensor7] sampling 1500 thresholds 95 120 thresholds_clr 87 115 actions cpu cpu+shutdown action_info 384000 384000+5000 [tsens_tz_sensor8] sampling 1500 thresholds 95 120 thresholds_clr 87 115 actions cpu cpu+shutdown action_info 384000 384000+5000 [tsens_tz_sensor9] sampling 1500 thresholds 95 120 thresholds_clr 87 115 actions cpu cpu+shutdown action_info 384000 384000+5000 [tsens_tz_sensor10] sampling 1500 thresholds 95 120 thresholds_clr 87 115 actions cpu cpu+shutdown action_info 384000 384000+5000 [batt_therm] sampling 1500 thresholds 410 420 430 440 450 thresholds_clr 400 410 420 430 440 actions cpu+lcd+battery cpu+lcd+battery cpu+lcd+battery cpu+lcd+battery cpu+lcd+battery action_info 1350000+192+0 1134000+181+1 1026000+181+1 918000+171+2 810000+171+3
這樣的:spa
sampling 5000 [tsens_tz_sensor0] sampling 1000 thresholds 60 90 95 100 105 110 115 120 thresholds_clr 57 85 90 95 100 105 110 115 actions cpu cpu cpu cpu cpu cpu cpu shutdown action_info 1512000 1188000 918000 756000 648000 540000 486000 5000 [tsens_tz_sensor1] sampling 1000 thresholds 60 90 95 100 105 110 115 120 thresholds_clr 57 85 90 95 100 105 110 115 actions cpu cpu cpu cpu cpu cpu cpu shutdown action_info 1512000 1188000 918000 756000 648000 540000 486000 5000 [tsens_tz_sensor2] sampling 1000 thresholds 60 90 95 100 105 110 115 120 thresholds_clr 57 85 90 95 100 105 110 115 actions cpu cpu cpu cpu cpu cpu cpu shutdown action_info 1512000 1188000 918000 756000 648000 540000 486000 5000 [tsens_tz_sensor3] sampling 1000 thresholds 60 90 95 100 105 110 115 120 thresholds_clr 57 85 90 95 100 105 110 115 actions cpu cpu cpu cpu cpu cpu cpu shutdown action_info 1512000 1188000 918000 756000 648000 540000 486000 5000 [tsens_tz_sensor4] sampling 1000 thresholds 60 90 95 100 105 110 115 120 thresholds_clr 57 85 90 95 100 105 110 115 actions cpu cpu cpu cpu cpu cpu cpu shutdown action_info 1512000 1188000 918000 756000 648000 540000 486000 5000 [tsens_tz_sensor5] sampling 1000 thresholds 60 90 95 100 105 110 115 120 thresholds_clr 57 85 90 95 100 105 110 115 actions cpu cpu cpu cpu cpu cpu cpu shutdown action_info 1512000 1188000 918000 756000 648000 540000 486000 5000 [tsens_tz_sensor6] sampling 1000 thresholds 60 90 95 100 105 110 115 120 thresholds_clr 57 85 90 95 100 105 110 115 actions cpu cpu cpu cpu cpu cpu cpu shutdown action_info 1512000 1188000 918000 756000 648000 540000 486000 5000 [tsens_tz_sensor7] sampling 1000 thresholds 60 90 95 100 105 110 115 120 thresholds_clr 57 85 90 95 100 105 110 115 actions cpu cpu cpu cpu cpu cpu cpu shutdown action_info 1512000 1188000 918000 756000 648000 540000 486000 5000 [tsens_tz_sensor8] sampling 1000 thresholds 60 90 95 100 105 110 115 120 thresholds_clr 57 85 90 95 100 105 110 115 actions cpu cpu cpu cpu cpu cpu cpu shutdown action_info 1512000 1188000 918000 756000 648000 540000 486000 5000 [tsens_tz_sensor9] sampling 1000 thresholds 60 90 95 100 105 110 115 120 thresholds_clr 57 85 90 95 100 105 110 115 actions cpu cpu cpu cpu cpu cpu cpu shutdown action_info 1512000 1188000 918000 756000 648000 540000 486000 5000 [tsens_tz_sensor10] sampling 1000 thresholds 60 90 95 100 105 110 115 120 thresholds_clr 57 85 90 95 100 105 110 115 actions cpu cpu cpu cpu cpu cpu cpu shutdown action_info 1512000 1188000 918000 756000 648000 540000 486000 5000
還有壓根就不能執行的狀況。code
我的理解,這個就是對應不一樣設備的溫度傳感器。blog
而後,咱們能夠看到,有的傳感器是針對CPU的。那麼到下面的目錄:io
shell@android:/sys/class/thermal $class
你能夠找到這些傳感器,而後進入對應的傳感器,用cat指令能夠知道溫度了。cpu
shell@android:/sys/class/thermal/thermal_zone7 $ cat temp
## cat type 的話應該能夠獲取傳感器的類型信息。
雖然解決了問題,可是不是很理解。好比,這個是linux系統的通用設置嗎? 其餘傳感器都對應了什麼? 等等。項目