1*47e073d2SChangbin Du============================= 2*47e073d2SChangbin DuSubsystem Trace Points: power 3*47e073d2SChangbin Du============================= 4*47e073d2SChangbin Du 5*47e073d2SChangbin DuThe power tracing system captures events related to power transitions 6*47e073d2SChangbin Duwithin the kernel. Broadly speaking there are three major subheadings: 7*47e073d2SChangbin Du 8*47e073d2SChangbin Du - Power state switch which reports events related to suspend (S-states), 9*47e073d2SChangbin Du cpuidle (C-states) and cpufreq (P-states) 10*47e073d2SChangbin Du - System clock related changes 11*47e073d2SChangbin Du - Power domains related changes and transitions 12*47e073d2SChangbin Du 13*47e073d2SChangbin DuThis document describes what each of the tracepoints is and why they 14*47e073d2SChangbin Dumight be useful. 15*47e073d2SChangbin Du 16*47e073d2SChangbin DuCf. include/trace/events/power.h for the events definitions. 17*47e073d2SChangbin Du 18*47e073d2SChangbin Du1. Power state switch events 19*47e073d2SChangbin Du============================ 20*47e073d2SChangbin Du 21*47e073d2SChangbin Du1.1 Trace API 22*47e073d2SChangbin Du----------------- 23*47e073d2SChangbin Du 24*47e073d2SChangbin DuA 'cpu' event class gathers the CPU-related events: cpuidle and 25*47e073d2SChangbin Ducpufreq. 26*47e073d2SChangbin Du:: 27*47e073d2SChangbin Du 28*47e073d2SChangbin Du cpu_idle "state=%lu cpu_id=%lu" 29*47e073d2SChangbin Du cpu_frequency "state=%lu cpu_id=%lu" 30*47e073d2SChangbin Du 31*47e073d2SChangbin DuA suspend event is used to indicate the system going in and out of the 32*47e073d2SChangbin Dususpend mode: 33*47e073d2SChangbin Du:: 34*47e073d2SChangbin Du 35*47e073d2SChangbin Du machine_suspend "state=%lu" 36*47e073d2SChangbin Du 37*47e073d2SChangbin Du 38*47e073d2SChangbin DuNote: the value of '-1' or '4294967295' for state means an exit from the current state, 39*47e073d2SChangbin Dui.e. trace_cpu_idle(4, smp_processor_id()) means that the system 40*47e073d2SChangbin Duenters the idle state 4, while trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id()) 41*47e073d2SChangbin Dumeans that the system exits the previous idle state. 42*47e073d2SChangbin Du 43*47e073d2SChangbin DuThe event which has 'state=4294967295' in the trace is very important to the user 44*47e073d2SChangbin Duspace tools which are using it to detect the end of the current state, and so to 45*47e073d2SChangbin Ducorrectly draw the states diagrams and to calculate accurate statistics etc. 46*47e073d2SChangbin Du 47*47e073d2SChangbin Du2. Clocks events 48*47e073d2SChangbin Du================ 49*47e073d2SChangbin DuThe clock events are used for clock enable/disable and for 50*47e073d2SChangbin Duclock rate change. 51*47e073d2SChangbin Du:: 52*47e073d2SChangbin Du 53*47e073d2SChangbin Du clock_enable "%s state=%lu cpu_id=%lu" 54*47e073d2SChangbin Du clock_disable "%s state=%lu cpu_id=%lu" 55*47e073d2SChangbin Du clock_set_rate "%s state=%lu cpu_id=%lu" 56*47e073d2SChangbin Du 57*47e073d2SChangbin DuThe first parameter gives the clock name (e.g. "gpio1_iclk"). 58*47e073d2SChangbin DuThe second parameter is '1' for enable, '0' for disable, the target 59*47e073d2SChangbin Duclock rate for set_rate. 60*47e073d2SChangbin Du 61*47e073d2SChangbin Du3. Power domains events 62*47e073d2SChangbin Du======================= 63*47e073d2SChangbin DuThe power domain events are used for power domains transitions 64*47e073d2SChangbin Du:: 65*47e073d2SChangbin Du 66*47e073d2SChangbin Du power_domain_target "%s state=%lu cpu_id=%lu" 67*47e073d2SChangbin Du 68*47e073d2SChangbin DuThe first parameter gives the power domain name (e.g. "mpu_pwrdm"). 69*47e073d2SChangbin DuThe second parameter is the power domain target state. 70*47e073d2SChangbin Du 71*47e073d2SChangbin Du4. PM QoS events 72*47e073d2SChangbin Du================ 73*47e073d2SChangbin DuThe PM QoS events are used for QoS add/update/remove request and for 74*47e073d2SChangbin Dutarget/flags update. 75*47e073d2SChangbin Du:: 76*47e073d2SChangbin Du 77*47e073d2SChangbin Du pm_qos_add_request "pm_qos_class=%s value=%d" 78*47e073d2SChangbin Du pm_qos_update_request "pm_qos_class=%s value=%d" 79*47e073d2SChangbin Du pm_qos_remove_request "pm_qos_class=%s value=%d" 80*47e073d2SChangbin Du pm_qos_update_request_timeout "pm_qos_class=%s value=%d, timeout_us=%ld" 81*47e073d2SChangbin Du 82*47e073d2SChangbin DuThe first parameter gives the QoS class name (e.g. "CPU_DMA_LATENCY"). 83*47e073d2SChangbin DuThe second parameter is value to be added/updated/removed. 84*47e073d2SChangbin DuThe third parameter is timeout value in usec. 85*47e073d2SChangbin Du:: 86*47e073d2SChangbin Du 87*47e073d2SChangbin Du pm_qos_update_target "action=%s prev_value=%d curr_value=%d" 88*47e073d2SChangbin Du pm_qos_update_flags "action=%s prev_value=0x%x curr_value=0x%x" 89*47e073d2SChangbin Du 90*47e073d2SChangbin DuThe first parameter gives the QoS action name (e.g. "ADD_REQ"). 91*47e073d2SChangbin DuThe second parameter is the previous QoS value. 92*47e073d2SChangbin DuThe third parameter is the current QoS value to update. 93*47e073d2SChangbin Du 94*47e073d2SChangbin DuAnd, there are also events used for device PM QoS add/update/remove request. 95*47e073d2SChangbin Du:: 96*47e073d2SChangbin Du 97*47e073d2SChangbin Du dev_pm_qos_add_request "device=%s type=%s new_value=%d" 98*47e073d2SChangbin Du dev_pm_qos_update_request "device=%s type=%s new_value=%d" 99*47e073d2SChangbin Du dev_pm_qos_remove_request "device=%s type=%s new_value=%d" 100*47e073d2SChangbin Du 101*47e073d2SChangbin DuThe first parameter gives the device name which tries to add/update/remove 102*47e073d2SChangbin DuQoS requests. 103*47e073d2SChangbin DuThe second parameter gives the request type (e.g. "DEV_PM_QOS_RESUME_LATENCY"). 104*47e073d2SChangbin DuThe third parameter is value to be added/updated/removed. 105