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