xref: /openbmc/linux/Documentation/trace/events-power.rst (revision ead5d1f4d877e92c051e1a1ade623d0d30e71619)
147e073d2SChangbin Du=============================
247e073d2SChangbin DuSubsystem Trace Points: power
347e073d2SChangbin Du=============================
447e073d2SChangbin Du
547e073d2SChangbin DuThe power tracing system captures events related to power transitions
647e073d2SChangbin Duwithin the kernel. Broadly speaking there are three major subheadings:
747e073d2SChangbin Du
847e073d2SChangbin Du  - Power state switch which reports events related to suspend (S-states),
947e073d2SChangbin Du    cpuidle (C-states) and cpufreq (P-states)
1047e073d2SChangbin Du  - System clock related changes
1147e073d2SChangbin Du  - Power domains related changes and transitions
1247e073d2SChangbin Du
1347e073d2SChangbin DuThis document describes what each of the tracepoints is and why they
1447e073d2SChangbin Dumight be useful.
1547e073d2SChangbin Du
1647e073d2SChangbin DuCf. include/trace/events/power.h for the events definitions.
1747e073d2SChangbin Du
1847e073d2SChangbin Du1. Power state switch events
1947e073d2SChangbin Du============================
2047e073d2SChangbin Du
2147e073d2SChangbin Du1.1 Trace API
2247e073d2SChangbin Du-----------------
2347e073d2SChangbin Du
2447e073d2SChangbin DuA 'cpu' event class gathers the CPU-related events: cpuidle and
2547e073d2SChangbin Ducpufreq.
2647e073d2SChangbin Du::
2747e073d2SChangbin Du
2847e073d2SChangbin Du  cpu_idle		"state=%lu cpu_id=%lu"
2947e073d2SChangbin Du  cpu_frequency		"state=%lu cpu_id=%lu"
30601b2185SRuchi Kandoi  cpu_frequency_limits	"min=%lu max=%lu cpu_id=%lu"
3147e073d2SChangbin Du
3247e073d2SChangbin DuA suspend event is used to indicate the system going in and out of the
3347e073d2SChangbin Dususpend mode:
3447e073d2SChangbin Du::
3547e073d2SChangbin Du
3647e073d2SChangbin Du  machine_suspend		"state=%lu"
3747e073d2SChangbin Du
3847e073d2SChangbin Du
3947e073d2SChangbin DuNote: the value of '-1' or '4294967295' for state means an exit from the current state,
4047e073d2SChangbin Dui.e. trace_cpu_idle(4, smp_processor_id()) means that the system
4147e073d2SChangbin Duenters the idle state 4, while trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id())
4247e073d2SChangbin Dumeans that the system exits the previous idle state.
4347e073d2SChangbin Du
4447e073d2SChangbin DuThe event which has 'state=4294967295' in the trace is very important to the user
4547e073d2SChangbin Duspace tools which are using it to detect the end of the current state, and so to
4647e073d2SChangbin Ducorrectly draw the states diagrams and to calculate accurate statistics etc.
4747e073d2SChangbin Du
4847e073d2SChangbin Du2. Clocks events
4947e073d2SChangbin Du================
5047e073d2SChangbin DuThe clock events are used for clock enable/disable and for
5147e073d2SChangbin Duclock rate change.
5247e073d2SChangbin Du::
5347e073d2SChangbin Du
5447e073d2SChangbin Du  clock_enable		"%s state=%lu cpu_id=%lu"
5547e073d2SChangbin Du  clock_disable		"%s state=%lu cpu_id=%lu"
5647e073d2SChangbin Du  clock_set_rate		"%s state=%lu cpu_id=%lu"
5747e073d2SChangbin Du
5847e073d2SChangbin DuThe first parameter gives the clock name (e.g. "gpio1_iclk").
5947e073d2SChangbin DuThe second parameter is '1' for enable, '0' for disable, the target
6047e073d2SChangbin Duclock rate for set_rate.
6147e073d2SChangbin Du
6247e073d2SChangbin Du3. Power domains events
6347e073d2SChangbin Du=======================
6447e073d2SChangbin DuThe power domain events are used for power domains transitions
6547e073d2SChangbin Du::
6647e073d2SChangbin Du
6747e073d2SChangbin Du  power_domain_target	"%s state=%lu cpu_id=%lu"
6847e073d2SChangbin Du
6947e073d2SChangbin DuThe first parameter gives the power domain name (e.g. "mpu_pwrdm").
7047e073d2SChangbin DuThe second parameter is the power domain target state.
7147e073d2SChangbin Du
7247e073d2SChangbin Du4. PM QoS events
7347e073d2SChangbin Du================
7447e073d2SChangbin DuThe PM QoS events are used for QoS add/update/remove request and for
7547e073d2SChangbin Dutarget/flags update.
7647e073d2SChangbin Du::
7747e073d2SChangbin Du
7847e073d2SChangbin Du  pm_qos_update_target               "action=%s prev_value=%d curr_value=%d"
7947e073d2SChangbin Du  pm_qos_update_flags                "action=%s prev_value=0x%x curr_value=0x%x"
8047e073d2SChangbin Du
8147e073d2SChangbin DuThe first parameter gives the QoS action name (e.g. "ADD_REQ").
8247e073d2SChangbin DuThe second parameter is the previous QoS value.
8347e073d2SChangbin DuThe third parameter is the current QoS value to update.
8447e073d2SChangbin Du
85*333eed7dSRafael J. WysockiThere are also events used for device PM QoS add/update/remove request.
8647e073d2SChangbin Du::
8747e073d2SChangbin Du
8847e073d2SChangbin Du  dev_pm_qos_add_request             "device=%s type=%s new_value=%d"
8947e073d2SChangbin Du  dev_pm_qos_update_request          "device=%s type=%s new_value=%d"
9047e073d2SChangbin Du  dev_pm_qos_remove_request          "device=%s type=%s new_value=%d"
9147e073d2SChangbin Du
9247e073d2SChangbin DuThe first parameter gives the device name which tries to add/update/remove
9347e073d2SChangbin DuQoS requests.
9447e073d2SChangbin DuThe second parameter gives the request type (e.g. "DEV_PM_QOS_RESUME_LATENCY").
9547e073d2SChangbin DuThe third parameter is value to be added/updated/removed.
96*333eed7dSRafael J. Wysocki
97*333eed7dSRafael J. WysockiAnd, there are events used for CPU latency QoS add/update/remove request.
98*333eed7dSRafael J. Wysocki::
99*333eed7dSRafael J. Wysocki
100*333eed7dSRafael J. Wysocki  pm_qos_add_request        "value=%d"
101*333eed7dSRafael J. Wysocki  pm_qos_update_request     "value=%d"
102*333eed7dSRafael J. Wysocki  pm_qos_remove_request     "value=%d"
103*333eed7dSRafael J. Wysocki
104*333eed7dSRafael J. WysockiThe parameter is the value to be added/updated/removed.
105