Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 305834
b: refs/heads/master
c: 6791e36
h: refs/heads/master
v: v3
  • Loading branch information
Arve Hjønnevåg authored and Rafael J. Wysocki committed May 1, 2012
1 parent 7013b63 commit f24c4be
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 30e3ce6dcbe3fc29c343b17e768b07d4a795de21
refs/heads/master: 6791e36c4a40e8930e08669e60077eea6770c429
12 changes: 9 additions & 3 deletions trunk/drivers/base/power/wakeup.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/suspend.h>
#include <linux/seq_file.h>
#include <linux/debugfs.h>
#include <trace/events/power.h>

#include "power.h"

Expand Down Expand Up @@ -374,12 +375,16 @@ EXPORT_SYMBOL_GPL(device_set_wakeup_enable);
*/
static void wakeup_source_activate(struct wakeup_source *ws)
{
unsigned int cec;

ws->active = true;
ws->active_count++;
ws->last_time = ktime_get();

/* Increment the counter of events in progress. */
atomic_inc(&combined_event_count);
cec = atomic_inc_return(&combined_event_count);

trace_wakeup_source_activate(ws->name, cec);
}

/**
Expand Down Expand Up @@ -454,7 +459,7 @@ EXPORT_SYMBOL_GPL(pm_stay_awake);
*/
static void wakeup_source_deactivate(struct wakeup_source *ws)
{
unsigned int cnt, inpr;
unsigned int cnt, inpr, cec;
ktime_t duration;
ktime_t now;

Expand Down Expand Up @@ -489,7 +494,8 @@ static void wakeup_source_deactivate(struct wakeup_source *ws)
* Increment the counter of registered wakeup events and decrement the
* couter of wakeup events in progress simultaneously.
*/
atomic_add(MAX_IN_PROGRESS, &combined_event_count);
cec = atomic_add_return(MAX_IN_PROGRESS, &combined_event_count);
trace_wakeup_source_deactivate(ws->name, cec);

split_counters(&cnt, &inpr);
if (!inpr && waitqueue_active(&wakeup_count_wait_queue))
Expand Down
34 changes: 34 additions & 0 deletions trunk/include/trace/events/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,40 @@ TRACE_EVENT(machine_suspend,
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

/*
Expand Down

0 comments on commit f24c4be

Please sign in to comment.