perf: update event structure

Change-Id: I5bc0fdd42db509b5d2daca7d97e29ad1f7d11f1a
This commit is contained in:
TOIDA,Suguru
2019-11-19 15:34:32 +09:00
parent 343121c3d0
commit 5719b4c64a
7 changed files with 46 additions and 3 deletions

View File

@@ -725,6 +725,7 @@ struct thread {
struct futex_q futex_q;
// for performance counter
#define PMC_ALLOC_MAP_BITS BITS_PER_LONG
unsigned long pmc_alloc_map;
unsigned long extra_reg_alloc_map;

View File

@@ -3914,7 +3914,6 @@ unsigned long perf_event_read_value(struct mc_perf_event *event)
{
unsigned long rtn_count = 0;
unsigned long pmc_count = 0;
int counter_id = event->counter_id;
struct thread *thread = cpu_local_var(current);
unsigned long cur_user_tsc, cur_system_tsc;
@@ -3954,8 +3953,7 @@ unsigned long perf_event_read_value(struct mc_perf_event *event)
}
}
else {
pmc_count = ihk_mc_perfctr_read(counter_id) +
event->attr.sample_freq;
ihk_mc_event_update(event);
}
}
@@ -4186,6 +4184,10 @@ perf_stop(struct mc_perf_event *event)
struct mc_perf_event *leader = event->group_leader, *sub;
struct thread *thread = cpu_local_var(current);
struct mc_perf_event *stop_event[PMC_ALLOC_MAP_BITS + 1];
int stop_event_idx = 0;
stop_event[0] = NULL;
counter_id = leader->counter_id;
if (ihk_mc_perf_counter_mask_check(1UL << counter_id) &&
leader->state == PERF_EVENT_STATE_ACTIVE) {
@@ -4199,6 +4201,8 @@ perf_stop(struct mc_perf_event *event)
}
else {
counter_mask |= 1UL << counter_id;
stop_event[stop_event_idx++] = leader;
stop_event[stop_event_idx] = NULL;
}
leader->state = PERF_EVENT_STATE_INACTIVE;
@@ -4220,6 +4224,8 @@ perf_stop(struct mc_perf_event *event)
}
else {
counter_mask |= 1UL << counter_id;
stop_event[stop_event_idx++] = sub;
stop_event[stop_event_idx] = NULL;
}
sub->state = PERF_EVENT_STATE_INACTIVE;
}
@@ -4227,6 +4233,10 @@ perf_stop(struct mc_perf_event *event)
if (counter_mask) {
ihk_mc_perfctr_stop(counter_mask, 0);
stop_event_idx = 0;
while (stop_event[stop_event_idx]) {
ihk_mc_event_update(stop_event[stop_event_idx++]);
}
}
cpu_local_var(current)->proc->monitoring_event = NULL;
cpu_local_var(current)->proc->perf_status = PP_NONE;