diff options
author | David Ahern <dsahern@gmail.com> | 2013-08-07 22:50:44 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-08-12 09:31:05 -0400 |
commit | ad9def7ca020ef5b54968c89194f52d18ef1ef49 (patch) | |
tree | 03ce89cdca2e7017a857a66353c23b71fdea678c /tools/perf/builtin-sched.c | |
parent | 9a6d316692d59c4400a66b01db675abac432b4b2 (diff) |
perf sched: Simplify arguments to read_events
Destroy argument is not necessary. If session is not returned to caller,
then clean it up.
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1375930261-77273-3-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-sched.c')
-rw-r--r-- | tools/perf/builtin-sched.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 948183adb6e5..34ce57d24721 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -1445,7 +1445,7 @@ static int perf_sched__process_tracepoint_sample(struct perf_tool *tool __maybe_ | |||
1445 | return err; | 1445 | return err; |
1446 | } | 1446 | } |
1447 | 1447 | ||
1448 | static int perf_sched__read_events(struct perf_sched *sched, bool destroy, | 1448 | static int perf_sched__read_events(struct perf_sched *sched, |
1449 | struct perf_session **psession) | 1449 | struct perf_session **psession) |
1450 | { | 1450 | { |
1451 | const struct perf_evsel_str_handler handlers[] = { | 1451 | const struct perf_evsel_str_handler handlers[] = { |
@@ -1480,11 +1480,10 @@ static int perf_sched__read_events(struct perf_sched *sched, bool destroy, | |||
1480 | sched->nr_lost_chunks = session->stats.nr_events[PERF_RECORD_LOST]; | 1480 | sched->nr_lost_chunks = session->stats.nr_events[PERF_RECORD_LOST]; |
1481 | } | 1481 | } |
1482 | 1482 | ||
1483 | if (destroy) | ||
1484 | perf_session__delete(session); | ||
1485 | |||
1486 | if (psession) | 1483 | if (psession) |
1487 | *psession = session; | 1484 | *psession = session; |
1485 | else | ||
1486 | perf_session__delete(session); | ||
1488 | 1487 | ||
1489 | return 0; | 1488 | return 0; |
1490 | 1489 | ||
@@ -1529,8 +1528,11 @@ static int perf_sched__lat(struct perf_sched *sched) | |||
1529 | struct perf_session *session; | 1528 | struct perf_session *session; |
1530 | 1529 | ||
1531 | setup_pager(); | 1530 | setup_pager(); |
1532 | if (perf_sched__read_events(sched, false, &session)) | 1531 | |
1532 | /* save session -- references to threads are held in work_list */ | ||
1533 | if (perf_sched__read_events(sched, &session)) | ||
1533 | return -1; | 1534 | return -1; |
1535 | |||
1534 | perf_sched__sort_lat(sched); | 1536 | perf_sched__sort_lat(sched); |
1535 | 1537 | ||
1536 | printf("\n ---------------------------------------------------------------------------------------------------------------\n"); | 1538 | printf("\n ---------------------------------------------------------------------------------------------------------------\n"); |
@@ -1565,7 +1567,7 @@ static int perf_sched__map(struct perf_sched *sched) | |||
1565 | sched->max_cpu = sysconf(_SC_NPROCESSORS_CONF); | 1567 | sched->max_cpu = sysconf(_SC_NPROCESSORS_CONF); |
1566 | 1568 | ||
1567 | setup_pager(); | 1569 | setup_pager(); |
1568 | if (perf_sched__read_events(sched, true, NULL)) | 1570 | if (perf_sched__read_events(sched, NULL)) |
1569 | return -1; | 1571 | return -1; |
1570 | print_bad_events(sched); | 1572 | print_bad_events(sched); |
1571 | return 0; | 1573 | return 0; |
@@ -1580,7 +1582,7 @@ static int perf_sched__replay(struct perf_sched *sched) | |||
1580 | 1582 | ||
1581 | test_calibrations(sched); | 1583 | test_calibrations(sched); |
1582 | 1584 | ||
1583 | if (perf_sched__read_events(sched, true, NULL)) | 1585 | if (perf_sched__read_events(sched, NULL)) |
1584 | return -1; | 1586 | return -1; |
1585 | 1587 | ||
1586 | printf("nr_run_events: %ld\n", sched->nr_run_events); | 1588 | printf("nr_run_events: %ld\n", sched->nr_run_events); |