powerpc/perf/hv-24x7: Define update_event_count()
Move the code to update an event count into a new function, update_event_count(). Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
3ca4ea71cb
commit
529ce8c9dd
1 changed files with 9 additions and 3 deletions
|
@ -1172,14 +1172,20 @@ static u64 h_24x7_get_value(struct perf_event *event)
|
||||||
return ct;
|
return ct;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void h_24x7_event_read(struct perf_event *event)
|
static void update_event_count(struct perf_event *event, u64 now)
|
||||||
{
|
{
|
||||||
s64 prev;
|
s64 prev;
|
||||||
|
|
||||||
|
prev = local64_xchg(&event->hw.prev_count, now);
|
||||||
|
local64_add(now - prev, &event->count);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void h_24x7_event_read(struct perf_event *event)
|
||||||
|
{
|
||||||
u64 now;
|
u64 now;
|
||||||
|
|
||||||
now = h_24x7_get_value(event);
|
now = h_24x7_get_value(event);
|
||||||
prev = local64_xchg(&event->hw.prev_count, now);
|
update_event_count(event, now);
|
||||||
local64_add(now - prev, &event->count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void h_24x7_event_start(struct perf_event *event, int flags)
|
static void h_24x7_event_start(struct perf_event *event, int flags)
|
||||||
|
|
Loading…
Add table
Reference in a new issue