diff options
| author | Todd E Brandt <todd.e.brandt@linux.intel.com> | 2014-06-10 10:31:22 -0400 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-06-10 20:16:48 -0400 |
| commit | e8bca479c3f269ebb3a3acea5ef63314bb677060 (patch) | |
| tree | 9c0663c4fe0150ebdd8f45084885ca23214e63ce /include | |
| parent | bb3632c6101b2fad07e6246721466b984b1e0e9d (diff) | |
PM / sleep: trace events for device PM callbacks
Adds two trace events which supply the same info that initcall_debug
provides, but via ftrace instead of dmesg. The existing initcall_debug
calls require the pm_print_times_enabled var to be set (either via
sysfs or via the kernel cmd line). The new trace events provide all the
same info as the initcall_debug prints but with less overhead, and also
with coverage of device prepare and complete device callbacks.
These events replace the device_pm_report_time event (which has been
removed). device_pm_callback_start is called first and provides the device
and callback info. device_pm_callback_end is called after with the
device name and error info. The time and pid are gathered from the trace
data headers.
Signed-off-by: Todd Brandt <todd.e.brandt@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/trace/events/power.h | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/include/trace/events/power.h b/include/trace/events/power.h index f88c8573e66c..d19840b0cac8 100644 --- a/include/trace/events/power.h +++ b/include/trace/events/power.h | |||
| @@ -93,6 +93,17 @@ TRACE_EVENT(pstate_sample, | |||
| 93 | #define PWR_EVENT_EXIT -1 | 93 | #define PWR_EVENT_EXIT -1 |
| 94 | #endif | 94 | #endif |
| 95 | 95 | ||
| 96 | #define pm_verb_symbolic(event) \ | ||
| 97 | __print_symbolic(event, \ | ||
| 98 | { PM_EVENT_SUSPEND, "suspend" }, \ | ||
| 99 | { PM_EVENT_RESUME, "resume" }, \ | ||
| 100 | { PM_EVENT_FREEZE, "freeze" }, \ | ||
| 101 | { PM_EVENT_QUIESCE, "quiesce" }, \ | ||
| 102 | { PM_EVENT_HIBERNATE, "hibernate" }, \ | ||
| 103 | { PM_EVENT_THAW, "thaw" }, \ | ||
| 104 | { PM_EVENT_RESTORE, "restore" }, \ | ||
| 105 | { PM_EVENT_RECOVER, "recover" }) | ||
| 106 | |||
| 96 | DEFINE_EVENT(cpu, cpu_frequency, | 107 | DEFINE_EVENT(cpu, cpu_frequency, |
| 97 | 108 | ||
| 98 | TP_PROTO(unsigned int frequency, unsigned int cpu_id), | 109 | TP_PROTO(unsigned int frequency, unsigned int cpu_id), |
| @@ -100,41 +111,54 @@ DEFINE_EVENT(cpu, cpu_frequency, | |||
| 100 | TP_ARGS(frequency, cpu_id) | 111 | TP_ARGS(frequency, cpu_id) |
| 101 | ); | 112 | ); |
| 102 | 113 | ||
| 103 | TRACE_EVENT(device_pm_report_time, | 114 | TRACE_EVENT(device_pm_callback_start, |
| 104 | 115 | ||
| 105 | TP_PROTO(struct device *dev, const char *pm_ops, s64 ops_time, | 116 | TP_PROTO(struct device *dev, const char *pm_ops, int event), |
| 106 | char *pm_event_str, int error), | ||
| 107 | 117 | ||
| 108 | TP_ARGS(dev, pm_ops, ops_time, pm_event_str, error), | 118 | TP_ARGS(dev, pm_ops, event), |
| 109 | 119 | ||
| 110 | TP_STRUCT__entry( | 120 | TP_STRUCT__entry( |
| 111 | __string(device, dev_name(dev)) | 121 | __string(device, dev_name(dev)) |
| 112 | __string(driver, dev_driver_string(dev)) | 122 | __string(driver, dev_driver_string(dev)) |
| 113 | __string(parent, dev->parent ? dev_name(dev->parent) : "none") | 123 | __string(parent, dev->parent ? dev_name(dev->parent) : "none") |
| 114 | __string(pm_ops, pm_ops ? pm_ops : "none ") | 124 | __string(pm_ops, pm_ops ? pm_ops : "none ") |
| 115 | __string(pm_event_str, pm_event_str) | 125 | __field(int, event) |
| 116 | __field(s64, ops_time) | ||
| 117 | __field(int, error) | ||
| 118 | ), | 126 | ), |
| 119 | 127 | ||
| 120 | TP_fast_assign( | 128 | TP_fast_assign( |
| 121 | const char *tmp = dev->parent ? dev_name(dev->parent) : "none"; | 129 | __assign_str(device, dev_name(dev)); |
| 122 | const char *tmp_i = pm_ops ? pm_ops : "none "; | 130 | __assign_str(driver, dev_driver_string(dev)); |
| 131 | __assign_str(parent, | ||
| 132 | dev->parent ? dev_name(dev->parent) : "none"); | ||
| 133 | __assign_str(pm_ops, pm_ops ? pm_ops : "none "); | ||
| 134 | __entry->event = event; | ||
| 135 | ), | ||
| 136 | |||
| 137 | TP_printk("%s %s, parent: %s, %s[%s]", __get_str(driver), | ||
| 138 | __get_str(device), __get_str(parent), __get_str(pm_ops), | ||
| 139 | pm_verb_symbolic(__entry->event)) | ||
| 140 | ); | ||
| 141 | |||
| 142 | TRACE_EVENT(device_pm_callback_end, | ||
| 143 | |||
| 144 | TP_PROTO(struct device *dev, int error), | ||
| 123 | 145 | ||
| 146 | TP_ARGS(dev, error), | ||
| 147 | |||
| 148 | TP_STRUCT__entry( | ||
| 149 | __string(device, dev_name(dev)) | ||
| 150 | __string(driver, dev_driver_string(dev)) | ||
| 151 | __field(int, error) | ||
| 152 | ), | ||
| 153 | |||
| 154 | TP_fast_assign( | ||
| 124 | __assign_str(device, dev_name(dev)); | 155 | __assign_str(device, dev_name(dev)); |
| 125 | __assign_str(driver, dev_driver_string(dev)); | 156 | __assign_str(driver, dev_driver_string(dev)); |
| 126 | __assign_str(parent, tmp); | ||
| 127 | __assign_str(pm_ops, tmp_i); | ||
| 128 | __assign_str(pm_event_str, pm_event_str); | ||
| 129 | __entry->ops_time = ops_time; | ||
| 130 | __entry->error = error; | 157 | __entry->error = error; |
| 131 | ), | 158 | ), |
| 132 | 159 | ||
| 133 | /* ops_str has an extra space at the end */ | 160 | TP_printk("%s %s, err=%d", |
| 134 | TP_printk("%s %s parent=%s state=%s ops=%snsecs=%lld err=%d", | 161 | __get_str(driver), __get_str(device), __entry->error) |
| 135 | __get_str(driver), __get_str(device), __get_str(parent), | ||
| 136 | __get_str(pm_event_str), __get_str(pm_ops), | ||
| 137 | __entry->ops_time, __entry->error) | ||
| 138 | ); | 162 | ); |
| 139 | 163 | ||
| 140 | TRACE_EVENT(suspend_resume, | 164 | TRACE_EVENT(suspend_resume, |
