diff options
-rw-r--r-- | drivers/base/power/wakeup.c | 12 | ||||
-rw-r--r-- | include/trace/events/power.h | 34 |
2 files changed, 43 insertions, 3 deletions
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index 7a6eada4534d..1132799421cd 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/suspend.h> | 14 | #include <linux/suspend.h> |
15 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
16 | #include <linux/debugfs.h> | 16 | #include <linux/debugfs.h> |
17 | #include <trace/events/power.h> | ||
17 | 18 | ||
18 | #include "power.h" | 19 | #include "power.h" |
19 | 20 | ||
@@ -374,12 +375,16 @@ EXPORT_SYMBOL_GPL(device_set_wakeup_enable); | |||
374 | */ | 375 | */ |
375 | static void wakeup_source_activate(struct wakeup_source *ws) | 376 | static void wakeup_source_activate(struct wakeup_source *ws) |
376 | { | 377 | { |
378 | unsigned int cec; | ||
379 | |||
377 | ws->active = true; | 380 | ws->active = true; |
378 | ws->active_count++; | 381 | ws->active_count++; |
379 | ws->last_time = ktime_get(); | 382 | ws->last_time = ktime_get(); |
380 | 383 | ||
381 | /* Increment the counter of events in progress. */ | 384 | /* Increment the counter of events in progress. */ |
382 | atomic_inc(&combined_event_count); | 385 | cec = atomic_inc_return(&combined_event_count); |
386 | |||
387 | trace_wakeup_source_activate(ws->name, cec); | ||
383 | } | 388 | } |
384 | 389 | ||
385 | /** | 390 | /** |
@@ -454,7 +459,7 @@ EXPORT_SYMBOL_GPL(pm_stay_awake); | |||
454 | */ | 459 | */ |
455 | static void wakeup_source_deactivate(struct wakeup_source *ws) | 460 | static void wakeup_source_deactivate(struct wakeup_source *ws) |
456 | { | 461 | { |
457 | unsigned int cnt, inpr; | 462 | unsigned int cnt, inpr, cec; |
458 | ktime_t duration; | 463 | ktime_t duration; |
459 | ktime_t now; | 464 | ktime_t now; |
460 | 465 | ||
@@ -489,7 +494,8 @@ static void wakeup_source_deactivate(struct wakeup_source *ws) | |||
489 | * Increment the counter of registered wakeup events and decrement the | 494 | * Increment the counter of registered wakeup events and decrement the |
490 | * couter of wakeup events in progress simultaneously. | 495 | * couter of wakeup events in progress simultaneously. |
491 | */ | 496 | */ |
492 | atomic_add(MAX_IN_PROGRESS, &combined_event_count); | 497 | cec = atomic_add_return(MAX_IN_PROGRESS, &combined_event_count); |
498 | trace_wakeup_source_deactivate(ws->name, cec); | ||
493 | 499 | ||
494 | split_counters(&cnt, &inpr); | 500 | split_counters(&cnt, &inpr); |
495 | if (!inpr && waitqueue_active(&wakeup_count_wait_queue)) | 501 | if (!inpr && waitqueue_active(&wakeup_count_wait_queue)) |
diff --git a/include/trace/events/power.h b/include/trace/events/power.h index cae9a94f025d..0c9783841a30 100644 --- a/include/trace/events/power.h +++ b/include/trace/events/power.h | |||
@@ -65,6 +65,40 @@ TRACE_EVENT(machine_suspend, | |||
65 | TP_printk("state=%lu", (unsigned long)__entry->state) | 65 | TP_printk("state=%lu", (unsigned long)__entry->state) |
66 | ); | 66 | ); |
67 | 67 | ||
68 | DECLARE_EVENT_CLASS(wakeup_source, | ||
69 | |||
70 | TP_PROTO(const char *name, unsigned int state), | ||
71 | |||
72 | TP_ARGS(name, state), | ||
73 | |||
74 | TP_STRUCT__entry( | ||
75 | __string( name, name ) | ||
76 | __field( u64, state ) | ||
77 | ), | ||
78 | |||
79 | TP_fast_assign( | ||
80 | __assign_str(name, name); | ||
81 | __entry->state = state; | ||
82 | ), | ||
83 | |||
84 | TP_printk("%s state=0x%lx", __get_str(name), | ||
85 | (unsigned long)__entry->state) | ||
86 | ); | ||
87 | |||
88 | DEFINE_EVENT(wakeup_source, wakeup_source_activate, | ||
89 | |||
90 | TP_PROTO(const char *name, unsigned int state), | ||
91 | |||
92 | TP_ARGS(name, state) | ||
93 | ); | ||
94 | |||
95 | DEFINE_EVENT(wakeup_source, wakeup_source_deactivate, | ||
96 | |||
97 | TP_PROTO(const char *name, unsigned int state), | ||
98 | |||
99 | TP_ARGS(name, state) | ||
100 | ); | ||
101 | |||
68 | #ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED | 102 | #ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED |
69 | 103 | ||
70 | /* | 104 | /* |