mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-17 17:53:56 +08:00
perf sched: No need to keep the session around
We were keeping the session around just because we kept pointers to struct thread instances, but now we reference count them, so no need for deferring the perf_session__delete call to after we traverse the work_list entries. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-9agtck6jdr3rebdp39z1lo0e@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
f3b623b849
commit
ae536acfac
@ -1439,8 +1439,7 @@ static int perf_sched__process_tracepoint_sample(struct perf_tool *tool __maybe_
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int perf_sched__read_events(struct perf_sched *sched,
|
static int perf_sched__read_events(struct perf_sched *sched)
|
||||||
struct perf_session **psession)
|
|
||||||
{
|
{
|
||||||
const struct perf_evsel_str_handler handlers[] = {
|
const struct perf_evsel_str_handler handlers[] = {
|
||||||
{ "sched:sched_switch", process_sched_switch_event, },
|
{ "sched:sched_switch", process_sched_switch_event, },
|
||||||
@ -1454,6 +1453,7 @@ static int perf_sched__read_events(struct perf_sched *sched,
|
|||||||
.path = input_name,
|
.path = input_name,
|
||||||
.mode = PERF_DATA_MODE_READ,
|
.mode = PERF_DATA_MODE_READ,
|
||||||
};
|
};
|
||||||
|
int rc = -1;
|
||||||
|
|
||||||
session = perf_session__new(&file, false, &sched->tool);
|
session = perf_session__new(&file, false, &sched->tool);
|
||||||
if (session == NULL) {
|
if (session == NULL) {
|
||||||
@ -1478,16 +1478,10 @@ static int perf_sched__read_events(struct perf_sched *sched,
|
|||||||
sched->nr_lost_chunks = session->evlist->stats.nr_events[PERF_RECORD_LOST];
|
sched->nr_lost_chunks = session->evlist->stats.nr_events[PERF_RECORD_LOST];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (psession)
|
rc = 0;
|
||||||
*psession = session;
|
|
||||||
else
|
|
||||||
perf_session__delete(session);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
out_delete:
|
out_delete:
|
||||||
perf_session__delete(session);
|
perf_session__delete(session);
|
||||||
return -1;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_bad_events(struct perf_sched *sched)
|
static void print_bad_events(struct perf_sched *sched)
|
||||||
@ -1515,12 +1509,10 @@ static void print_bad_events(struct perf_sched *sched)
|
|||||||
static int perf_sched__lat(struct perf_sched *sched)
|
static int perf_sched__lat(struct perf_sched *sched)
|
||||||
{
|
{
|
||||||
struct rb_node *next;
|
struct rb_node *next;
|
||||||
struct perf_session *session;
|
|
||||||
|
|
||||||
setup_pager();
|
setup_pager();
|
||||||
|
|
||||||
/* save session -- references to threads are held in work_list */
|
if (perf_sched__read_events(sched))
|
||||||
if (perf_sched__read_events(sched, &session))
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
perf_sched__sort_lat(sched);
|
perf_sched__sort_lat(sched);
|
||||||
@ -1537,6 +1529,7 @@ static int perf_sched__lat(struct perf_sched *sched)
|
|||||||
work_list = rb_entry(next, struct work_atoms, node);
|
work_list = rb_entry(next, struct work_atoms, node);
|
||||||
output_lat_thread(sched, work_list);
|
output_lat_thread(sched, work_list);
|
||||||
next = rb_next(next);
|
next = rb_next(next);
|
||||||
|
thread__zput(work_list->thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(" -----------------------------------------------------------------------------------------------------------------\n");
|
printf(" -----------------------------------------------------------------------------------------------------------------\n");
|
||||||
@ -1548,7 +1541,6 @@ static int perf_sched__lat(struct perf_sched *sched)
|
|||||||
print_bad_events(sched);
|
print_bad_events(sched);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
perf_session__delete(session);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1557,7 +1549,7 @@ static int perf_sched__map(struct perf_sched *sched)
|
|||||||
sched->max_cpu = sysconf(_SC_NPROCESSORS_CONF);
|
sched->max_cpu = sysconf(_SC_NPROCESSORS_CONF);
|
||||||
|
|
||||||
setup_pager();
|
setup_pager();
|
||||||
if (perf_sched__read_events(sched, NULL))
|
if (perf_sched__read_events(sched))
|
||||||
return -1;
|
return -1;
|
||||||
print_bad_events(sched);
|
print_bad_events(sched);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1572,7 +1564,7 @@ static int perf_sched__replay(struct perf_sched *sched)
|
|||||||
|
|
||||||
test_calibrations(sched);
|
test_calibrations(sched);
|
||||||
|
|
||||||
if (perf_sched__read_events(sched, NULL))
|
if (perf_sched__read_events(sched))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
printf("nr_run_events: %ld\n", sched->nr_run_events);
|
printf("nr_run_events: %ld\n", sched->nr_run_events);
|
||||||
|
Loading…
Reference in New Issue
Block a user