Ming Lei | 53b615c | 2011-09-27 22:53:27 +0200 | [diff] [blame] | 1 | |
| 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM rpm |
| 4 | |
| 5 | #if !defined(_TRACE_RUNTIME_POWER_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define _TRACE_RUNTIME_POWER_H |
| 7 | |
| 8 | #include <linux/ktime.h> |
| 9 | #include <linux/tracepoint.h> |
| 10 | #include <linux/device.h> |
| 11 | |
| 12 | /* |
| 13 | * The rpm_internal events are used for tracing some important |
| 14 | * runtime pm internal functions. |
| 15 | */ |
| 16 | DECLARE_EVENT_CLASS(rpm_internal, |
| 17 | |
| 18 | TP_PROTO(struct device *dev, int flags), |
| 19 | |
| 20 | TP_ARGS(dev, flags), |
| 21 | |
| 22 | TP_STRUCT__entry( |
| 23 | __string( name, dev_name(dev) ) |
| 24 | __field( int, flags ) |
| 25 | __field( int , usage_count ) |
| 26 | __field( int , disable_depth ) |
| 27 | __field( int , runtime_auto ) |
| 28 | __field( int , request_pending ) |
| 29 | __field( int , irq_safe ) |
| 30 | __field( int , child_count ) |
| 31 | ), |
| 32 | |
| 33 | TP_fast_assign( |
| 34 | __assign_str(name, dev_name(dev)); |
| 35 | __entry->flags = flags; |
| 36 | __entry->usage_count = atomic_read( |
| 37 | &dev->power.usage_count); |
| 38 | __entry->disable_depth = dev->power.disable_depth; |
| 39 | __entry->runtime_auto = dev->power.runtime_auto; |
| 40 | __entry->request_pending = dev->power.request_pending; |
| 41 | __entry->irq_safe = dev->power.irq_safe; |
| 42 | __entry->child_count = atomic_read( |
| 43 | &dev->power.child_count); |
| 44 | ), |
| 45 | |
| 46 | TP_printk("%s flags-%x cnt-%-2d dep-%-2d auto-%-1d p-%-1d" |
| 47 | " irq-%-1d child-%d", |
| 48 | __get_str(name), __entry->flags, |
| 49 | __entry->usage_count, |
| 50 | __entry->disable_depth, |
| 51 | __entry->runtime_auto, |
| 52 | __entry->request_pending, |
| 53 | __entry->irq_safe, |
| 54 | __entry->child_count |
| 55 | ) |
| 56 | ); |
| 57 | DEFINE_EVENT(rpm_internal, rpm_suspend, |
| 58 | |
| 59 | TP_PROTO(struct device *dev, int flags), |
| 60 | |
| 61 | TP_ARGS(dev, flags) |
| 62 | ); |
| 63 | DEFINE_EVENT(rpm_internal, rpm_resume, |
| 64 | |
| 65 | TP_PROTO(struct device *dev, int flags), |
| 66 | |
| 67 | TP_ARGS(dev, flags) |
| 68 | ); |
| 69 | DEFINE_EVENT(rpm_internal, rpm_idle, |
| 70 | |
| 71 | TP_PROTO(struct device *dev, int flags), |
| 72 | |
| 73 | TP_ARGS(dev, flags) |
| 74 | ); |
| 75 | |
| 76 | TRACE_EVENT(rpm_return_int, |
| 77 | TP_PROTO(struct device *dev, unsigned long ip, int ret), |
| 78 | TP_ARGS(dev, ip, ret), |
| 79 | |
| 80 | TP_STRUCT__entry( |
| 81 | __string( name, dev_name(dev)) |
| 82 | __field( unsigned long, ip ) |
| 83 | __field( int, ret ) |
| 84 | ), |
| 85 | |
| 86 | TP_fast_assign( |
| 87 | __assign_str(name, dev_name(dev)); |
| 88 | __entry->ip = ip; |
| 89 | __entry->ret = ret; |
| 90 | ), |
| 91 | |
| 92 | TP_printk("%pS:%s ret=%d", (void *)__entry->ip, __get_str(name), |
| 93 | __entry->ret) |
| 94 | ); |
| 95 | |
| 96 | #endif /* _TRACE_RUNTIME_POWER_H */ |
| 97 | |
| 98 | /* This part must be outside protection */ |
| 99 | #include <trace/define_trace.h> |