# 调试

Source: [https://docs.qualcomm.com/doc/80-70014-30Y/topic/thermal-debug.html](https://docs.qualcomm.com/doc/80-70014-30Y/topic/thermal-debug.html)

温控日志有助于了解 thermal zone 的活动配置以及现有的温控调节级别。要检索温控配置和活动调节级别，可使用 ftrace 日志或 dmesg 日志。

## ftrace 方法

要启用温控 ftace 日志，可运行以下命令：

echo 1 > /sys/kernel/tracing/events/thermal/enableCopy to clipboard

以下是不同温控事件的日志片段：

    /* In the following snippet, "gpuss-0" represents thermal zone and “temp” indicates existing temperature of thermal zone */
    irq/40-c22a000.-189     [000] .....   190.395326: thermal_temperature: 
    thermal_zone=gpuss-0 id=40 temp_prev=90300 
    temp=95000 
    /*In the following snippet, “trip” indicates trip level and trip level 1 is triggered for gpuss-0 thermal zone*/
    irq/40-c22a000.-189     [000] .....   190.395445: 
    thermal_zone_trip: thermal_zone=gpuss-0 id=40 trip=1 trip_type=PASSIVE 
    /*In the following snippet, “target” represents active mitigation level of cooling device*/
    irq/40-c22a000.-189    [000] .....   190.395675: 
    cdev_update: type=devfreq-xxxx target=1 Copy to clipboard

## Dmesg 方法

要在 Dmesg 日志中启用温控框架日志，可运行以下命令：

mount -t debugfs none /sys/kernel/debugCopy to clipboard

echo "module thermal_sys +p" >/sys/kernel/debug/dynamic_debug/controlCopy to clipboard

Note: 在内核配置文件中设置 `CONFIG_DYNAMIC_DEBUG`

以下是不同温控事件的日志片段：

    /* Following snippets indicates thermal zone multiple trip temperature configurations */
    [1579197.331791] thermal thermal_zone12: Trip0[type=1,temp=115000]:trend=2,throttle=0
    [1579197.341448] thermal thermal_zone12: Trip1[type=1,temp=50000]:trend=2,throttle=0
    [1579197.350110] thermal thermal_zone12: Trip2[type=1,temp=110000]:trend=2,throttle=0
    
    /* Following log snippet indicates present temperature of thermal zone 12 and sensor id 
    represents sensor associated with a thermal zone */
    [1579362.994130] get_temp_tsens_valid:Sensor_id: 3 name:cpu-1-0-0 temp: 50200
    [1579362.994664] thermal thermal_zone12: new temperature boundaries: 49000 < x < 110000
    
    Copy to clipboard

**Parent Topic:** [温控](https://docs.qualcomm.com/doc/80-70014-30Y/topic/thermalmanagement.html)

Last Published: Aug 20, 2024

[Previous Topic
定制](https://docs.qualcomm.com/bundle/publicresource/80-70014-30Y/topics/customize.md) [Next Topic
参考资料](https://docs.qualcomm.com/bundle/publicresource/80-70014-30Y/topics/references.md)