Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257061
b: refs/heads/master
c: c479429
h: refs/heads/master
i:
  257059: 08d841c
v: v3
  • Loading branch information
Eric B Munson authored and Ingo Molnar committed Jul 1, 2011
1 parent d68e3e4 commit c8f78f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 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: b7526f0ca6dc68f57ca467ce503151b1d476a3e4
refs/heads/master: c4794295917ebeda8013b6cb9c8d71ab4f74a1fa
22 changes: 15 additions & 7 deletions trunk/kernel/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3351,6 +3351,18 @@ static int perf_event_index(struct perf_event *event)
return event->hw.idx + 1 - PERF_EVENT_INDEX_OFFSET;
}

static void calc_timer_values(struct perf_event *event,
u64 *running,
u64 *enabled)
{
u64 now, ctx_time;

now = perf_clock();
ctx_time = event->shadow_ctx_time + now;
*enabled = ctx_time - event->tstamp_enabled;
*running = ctx_time - event->tstamp_running;
}

/*
* Callers need to ensure there can be no nesting of this function, otherwise
* the seqlock logic goes bad. We can not serialize this because the arch
Expand Down Expand Up @@ -3816,7 +3828,7 @@ static void perf_output_read_group(struct perf_output_handle *handle,
static void perf_output_read(struct perf_output_handle *handle,
struct perf_event *event)
{
u64 enabled = 0, running = 0, now, ctx_time;
u64 enabled = 0, running = 0;
u64 read_format = event->attr.read_format;

/*
Expand All @@ -3828,12 +3840,8 @@ static void perf_output_read(struct perf_output_handle *handle,
* because of locking issue as we are called in
* NMI context
*/
if (read_format & PERF_FORMAT_TOTAL_TIMES) {
now = perf_clock();
ctx_time = event->shadow_ctx_time + now;
enabled = ctx_time - event->tstamp_enabled;
running = ctx_time - event->tstamp_running;
}
if (read_format & PERF_FORMAT_TOTAL_TIMES)
calc_timer_values(event, &enabled, &running);

if (event->attr.read_format & PERF_FORMAT_GROUP)
perf_output_read_group(handle, event, enabled, running);
Expand Down

0 comments on commit c8f78f2

Please sign in to comment.