123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499 |
- #undef TRACE_SYSTEM
- #define TRACE_SYSTEM power
- #if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
- #define _TRACE_POWER_H
- #include <linux/ktime.h>
- #include <linux/pm_qos.h>
- #include <linux/tracepoint.h>
- DECLARE_EVENT_CLASS(cpu,
- TP_PROTO(unsigned int state, unsigned int cpu_id),
- TP_ARGS(state, cpu_id),
- TP_STRUCT__entry(
- __field( u32, state )
- __field( u32, cpu_id )
- ),
- TP_fast_assign(
- __entry->state = state;
- __entry->cpu_id = cpu_id;
- ),
- TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry->state,
- (unsigned long)__entry->cpu_id)
- );
- DEFINE_EVENT(cpu, cpu_idle,
- TP_PROTO(unsigned int state, unsigned int cpu_id),
- TP_ARGS(state, cpu_id)
- );
- /* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */
- #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING
- #define _PWR_EVENT_AVOID_DOUBLE_DEFINING
- #define PWR_EVENT_EXIT -1
- #endif
- DEFINE_EVENT(cpu, cpu_frequency,
- TP_PROTO(unsigned int frequency, unsigned int cpu_id),
- TP_ARGS(frequency, cpu_id)
- );
- TRACE_EVENT(cpu_frequency_switch_start,
- TP_PROTO(unsigned int start_freq, unsigned int end_freq,
- unsigned int cpu_id),
- TP_ARGS(start_freq, end_freq, cpu_id),
- TP_STRUCT__entry(
- __field( u32, start_freq )
- __field( u32, end_freq )
- __field( u32, cpu_id )
- ),
- TP_fast_assign(
- __entry->start_freq = start_freq;
- __entry->end_freq = end_freq;
- __entry->cpu_id = cpu_id;
- ),
- TP_printk("start=%lu end=%lu cpu_id=%lu",
- (unsigned long)__entry->start_freq,
- (unsigned long)__entry->end_freq,
- (unsigned long)__entry->cpu_id)
- );
- TRACE_EVENT(cpu_frequency_switch_end,
- TP_PROTO(unsigned int cpu_id),
- TP_ARGS(cpu_id),
- TP_STRUCT__entry(
- __field( u32, cpu_id )
- ),
- TP_fast_assign(
- __entry->cpu_id = cpu_id;
- ),
- TP_printk("cpu_id=%lu", (unsigned long)__entry->cpu_id)
- );
- TRACE_EVENT(machine_suspend,
- TP_PROTO(unsigned int state),
- TP_ARGS(state),
- TP_STRUCT__entry(
- __field( u32, state )
- ),
- TP_fast_assign(
- __entry->state = state;
- ),
- TP_printk("state=%lu", (unsigned long)__entry->state)
- );
- DECLARE_EVENT_CLASS(wakeup_source,
- TP_PROTO(const char *name, unsigned int state),
- TP_ARGS(name, state),
- TP_STRUCT__entry(
- __string( name, name )
- __field( u64, state )
- ),
- TP_fast_assign(
- __assign_str(name, name);
- __entry->state = state;
- ),
- TP_printk("%s state=0x%lx", __get_str(name),
- (unsigned long)__entry->state)
- );
- DEFINE_EVENT(wakeup_source, wakeup_source_activate,
- TP_PROTO(const char *name, unsigned int state),
- TP_ARGS(name, state)
- );
- DEFINE_EVENT(wakeup_source, wakeup_source_deactivate,
- TP_PROTO(const char *name, unsigned int state),
- TP_ARGS(name, state)
- );
- #ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
- /*
- * The power events are used for cpuidle & suspend (power_start, power_end)
- * and for cpufreq (power_frequency)
- */
- DECLARE_EVENT_CLASS(power,
- TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
- TP_ARGS(type, state, cpu_id),
- TP_STRUCT__entry(
- __field( u64, type )
- __field( u64, state )
- __field( u64, cpu_id )
- ),
- TP_fast_assign(
- __entry->type = type;
- __entry->state = state;
- __entry->cpu_id = cpu_id;
- ),
- TP_printk("type=%lu state=%lu cpu_id=%lu", (unsigned long)__entry->type,
- (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
- );
- DEFINE_EVENT(power, power_start,
- TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
- TP_ARGS(type, state, cpu_id)
- );
- DEFINE_EVENT(power, power_frequency,
- TP_PROTO(unsigned int type, unsigned int state, unsigned int cpu_id),
- TP_ARGS(type, state, cpu_id)
- );
- TRACE_EVENT(power_end,
- TP_PROTO(unsigned int cpu_id),
- TP_ARGS(cpu_id),
- TP_STRUCT__entry(
- __field( u64, cpu_id )
- ),
- TP_fast_assign(
- __entry->cpu_id = cpu_id;
- ),
- TP_printk("cpu_id=%lu", (unsigned long)__entry->cpu_id)
- );
- /* Deprecated dummy functions must be protected against multi-declartion */
- #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
- #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
- enum {
- POWER_NONE = 0,
- POWER_CSTATE = 1,
- POWER_PSTATE = 2,
- };
- #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
- #else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
- #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
- #define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
- enum {
- POWER_NONE = 0,
- POWER_CSTATE = 1,
- POWER_PSTATE = 2,
- };
- /* These dummy declaration have to be ripped out when the deprecated
- events get removed */
- static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {};
- static inline void trace_power_end(u64 cpuid) {};
- static inline void trace_power_start_rcuidle(u64 type, u64 state, u64 cpuid) {};
- static inline void trace_power_end_rcuidle(u64 cpuid) {};
- static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {};
- #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
- #endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
- /*
- * The clock events are used for clock enable/disable and for
- * clock rate change
- */
- DECLARE_EVENT_CLASS(clock,
- TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
- TP_ARGS(name, state, cpu_id),
- TP_STRUCT__entry(
- __string( name, name )
- __field( u64, state )
- __field( u64, cpu_id )
- ),
- TP_fast_assign(
- __assign_str(name, name);
- __entry->state = state;
- __entry->cpu_id = cpu_id;
- ),
- TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
- (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
- );
- DEFINE_EVENT(clock, clock_enable,
- TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
- TP_ARGS(name, state, cpu_id)
- );
- DEFINE_EVENT(clock, clock_disable,
- TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
- TP_ARGS(name, state, cpu_id)
- );
- DEFINE_EVENT(clock, clock_set_rate,
- TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
- TP_ARGS(name, state, cpu_id)
- );
- TRACE_EVENT(clock_set_parent,
- TP_PROTO(const char *name, const char *parent_name),
- TP_ARGS(name, parent_name),
- TP_STRUCT__entry(
- __string( name, name )
- __string( parent_name, parent_name )
- ),
- TP_fast_assign(
- __assign_str(name, name);
- __assign_str(parent_name, parent_name);
- ),
- TP_printk("%s parent=%s", __get_str(name), __get_str(parent_name))
- );
- /*
- * The power domain events are used for power domains transitions
- */
- DECLARE_EVENT_CLASS(power_domain,
- TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
- TP_ARGS(name, state, cpu_id),
- TP_STRUCT__entry(
- __string( name, name )
- __field( u64, state )
- __field( u64, cpu_id )
- ),
- TP_fast_assign(
- __assign_str(name, name);
- __entry->state = state;
- __entry->cpu_id = cpu_id;
- ),
- TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
- (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
- );
- DEFINE_EVENT(power_domain, power_domain_target,
- TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
- TP_ARGS(name, state, cpu_id)
- );
- TRACE_EVENT(bus_update_request,
- TP_PROTO(int sec, int nsec, const char *name, unsigned int index,
- int src, int dest, unsigned long long ab, unsigned long long ib),
- TP_ARGS(sec, nsec, name, index, src, dest, ab, ib),
- TP_STRUCT__entry(
- __field(int, sec)
- __field(int, nsec)
- __string(name, name)
- __field(u32, index)
- __field(int, src)
- __field(int, dest)
- __field(u64, ab)
- __field(u64, ib)
- ),
- TP_fast_assign(
- __entry->sec = sec;
- __entry->nsec = nsec;
- __assign_str(name, name);
- __entry->index = index;
- __entry->src = src;
- __entry->dest = dest;
- __entry->ab = ab;
- __entry->ib = ib;
- ),
- TP_printk("time= %d.%d name=%s index=%u src=%d dest=%d ab=%llu ib=%llu",
- __entry->sec,
- __entry->nsec,
- __get_str(name),
- (unsigned int)__entry->index,
- __entry->src,
- __entry->dest,
- (unsigned long long)__entry->ab,
- (unsigned long long)__entry->ib)
- );
- /*
- * The pm qos events are used for pm qos update
- */
- DECLARE_EVENT_CLASS(pm_qos_request,
- TP_PROTO(int pm_qos_class, s32 value),
- TP_ARGS(pm_qos_class, value),
- TP_STRUCT__entry(
- __field( int, pm_qos_class )
- __field( s32, value )
- ),
- TP_fast_assign(
- __entry->pm_qos_class = pm_qos_class;
- __entry->value = value;
- ),
- TP_printk("pm_qos_class=%s value=%d",
- __print_symbolic(__entry->pm_qos_class,
- { PM_QOS_CPU_DMA_LATENCY, "CPU_DMA_LATENCY" },
- { PM_QOS_NETWORK_LATENCY, "NETWORK_LATENCY" },
- { PM_QOS_NETWORK_THROUGHPUT, "NETWORK_THROUGHPUT" }),
- __entry->value)
- );
- DEFINE_EVENT(pm_qos_request, pm_qos_add_request,
- TP_PROTO(int pm_qos_class, s32 value),
- TP_ARGS(pm_qos_class, value)
- );
- DEFINE_EVENT(pm_qos_request, pm_qos_update_request,
- TP_PROTO(int pm_qos_class, s32 value),
- TP_ARGS(pm_qos_class, value)
- );
- DEFINE_EVENT(pm_qos_request, pm_qos_remove_request,
- TP_PROTO(int pm_qos_class, s32 value),
- TP_ARGS(pm_qos_class, value)
- );
- TRACE_EVENT(pm_qos_update_request_timeout,
- TP_PROTO(int pm_qos_class, s32 value, unsigned long timeout_us),
- TP_ARGS(pm_qos_class, value, timeout_us),
- TP_STRUCT__entry(
- __field( int, pm_qos_class )
- __field( s32, value )
- __field( unsigned long, timeout_us )
- ),
- TP_fast_assign(
- __entry->pm_qos_class = pm_qos_class;
- __entry->value = value;
- __entry->timeout_us = timeout_us;
- ),
- TP_printk("pm_qos_class=%s value=%d, timeout_us=%ld",
- __print_symbolic(__entry->pm_qos_class,
- { PM_QOS_CPU_DMA_LATENCY, "CPU_DMA_LATENCY" },
- { PM_QOS_NETWORK_LATENCY, "NETWORK_LATENCY" },
- { PM_QOS_NETWORK_THROUGHPUT, "NETWORK_THROUGHPUT" }),
- __entry->value, __entry->timeout_us)
- );
- DECLARE_EVENT_CLASS(pm_qos_update,
- TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
- TP_ARGS(action, prev_value, curr_value),
- TP_STRUCT__entry(
- __field( enum pm_qos_req_action, action )
- __field( int, prev_value )
- __field( int, curr_value )
- ),
- TP_fast_assign(
- __entry->action = action;
- __entry->prev_value = prev_value;
- __entry->curr_value = curr_value;
- ),
- TP_printk("action=%s prev_value=%d curr_value=%d",
- __print_symbolic(__entry->action,
- { PM_QOS_ADD_REQ, "ADD_REQ" },
- { PM_QOS_UPDATE_REQ, "UPDATE_REQ" },
- { PM_QOS_REMOVE_REQ, "REMOVE_REQ" }),
- __entry->prev_value, __entry->curr_value)
- );
- DEFINE_EVENT(pm_qos_update, pm_qos_update_target,
- TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
- TP_ARGS(action, prev_value, curr_value)
- );
- DEFINE_EVENT_PRINT(pm_qos_update, pm_qos_update_flags,
- TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
- TP_ARGS(action, prev_value, curr_value),
- TP_printk("action=%s prev_value=0x%x curr_value=0x%x",
- __print_symbolic(__entry->action,
- { PM_QOS_ADD_REQ, "ADD_REQ" },
- { PM_QOS_UPDATE_REQ, "UPDATE_REQ" },
- { PM_QOS_REMOVE_REQ, "REMOVE_REQ" }),
- __entry->prev_value, __entry->curr_value)
- );
- #endif /* _TRACE_POWER_H */
- /* This part must be outside protection */
- #include <trace/define_trace.h>
|