Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 262752
b: refs/heads/master
c: 4c09baf
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed Aug 9, 2011
1 parent 6ad14e6 commit 20737f7
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: 069e3725dd9be3b759a98e8c80ac5fc38b392b23
refs/heads/master: 4c09bafae37d870ab8efc50faeeb4855cb55b5b7
22 changes: 15 additions & 7 deletions trunk/tools/perf/builtin-sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1637,23 +1637,29 @@ static struct perf_event_ops event_ops = {
.ordered_samples = true,
};

static int read_events(void)
static void read_events(bool destroy, struct perf_session **psession)
{
int err = -EINVAL;
struct perf_session *session = perf_session__new(input_name, O_RDONLY,
0, false, &event_ops);
if (session == NULL)
return -ENOMEM;
die("No Memory");

if (perf_session__has_traces(session, "record -R")) {
err = perf_session__process_events(session, &event_ops);
if (err)
die("Failed to process events, error %d", err);

nr_events = session->hists.stats.nr_events[0];
nr_lost_events = session->hists.stats.total_lost;
nr_lost_chunks = session->hists.stats.nr_events[PERF_RECORD_LOST];
}

perf_session__delete(session);
return err;
if (destroy)
perf_session__delete(session);

if (psession)
*psession = session;
}

static void print_bad_events(void)
Expand Down Expand Up @@ -1689,9 +1695,10 @@ static void print_bad_events(void)
static void __cmd_lat(void)
{
struct rb_node *next;
struct perf_session *session;

setup_pager();
read_events();
read_events(false, &session);
sort_lat();

printf("\n ---------------------------------------------------------------------------------------------------------------\n");
Expand All @@ -1717,6 +1724,7 @@ static void __cmd_lat(void)
print_bad_events();
printf("\n");

perf_session__delete(session);
}

static struct trace_sched_handler map_ops = {
Expand All @@ -1731,7 +1739,7 @@ static void __cmd_map(void)
max_cpu = sysconf(_SC_NPROCESSORS_CONF);

setup_pager();
read_events();
read_events(true, NULL);
print_bad_events();
}

Expand All @@ -1744,7 +1752,7 @@ static void __cmd_replay(void)

test_calibrations();

read_events();
read_events(true, NULL);

printf("nr_run_events: %ld\n", nr_run_events);
printf("nr_sleep_events: %ld\n", nr_sleep_events);
Expand Down

0 comments on commit 20737f7

Please sign in to comment.