提交 adc56ed1 编写于 作者: J Jiri Olsa 提交者: Arnaldo Carvalho de Melo

perf tools: Add ordered_events__free function

Adding ordered_events__free function to release all the struct
ordered_events data. It's replacement for former
perf_session_free_sample_buffers function.
Signed-off-by: NJiri Olsa <jolsa@kernel.org>
Acked-by: NDavid Ahern <dsahern@gmail.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-urraa8ccay4o14wambjraws7@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 36522f5c
......@@ -202,3 +202,14 @@ void ordered_events__init(struct ordered_events *oe)
oe->max_alloc_size = (u64) -1;
oe->cur_alloc_size = 0;
}
void ordered_events__free(struct ordered_events *oe)
{
while (!list_empty(&oe->to_free)) {
struct ordered_event *event;
event = list_entry(oe->to_free.next, struct ordered_event, list);
list_del(&event->list);
free(event);
}
}
......@@ -39,4 +39,5 @@ void ordered_events__delete(struct ordered_events *oe, struct ordered_event *eve
int ordered_events__flush(struct perf_session *s, struct perf_tool *tool,
enum oe_flush how);
void ordered_events__init(struct ordered_events *oe);
void ordered_events__free(struct ordered_events *oe);
#endif /* __ORDERED_EVENTS_H */
......@@ -442,19 +442,6 @@ static perf_event__swap_op perf_event__swap_ops[] = {
[PERF_RECORD_HEADER_MAX] = NULL,
};
static void perf_session_free_sample_buffers(struct perf_session *session)
{
struct ordered_events *oe = &session->ordered_events;
while (!list_empty(&oe->to_free)) {
struct ordered_event *event;
event = list_entry(oe->to_free.next, struct ordered_event, list);
list_del(&event->list);
free(event);
}
}
/*
* When perf record finishes a pass on every buffers, it records this pseudo
* event.
......@@ -1092,7 +1079,7 @@ static int __perf_session__process_pipe_events(struct perf_session *session,
out_err:
free(buf);
perf_session__warn_about_errors(session, tool);
perf_session_free_sample_buffers(session);
ordered_events__free(&session->ordered_events);
return err;
}
......@@ -1237,7 +1224,7 @@ int __perf_session__process_events(struct perf_session *session,
out_err:
ui_progress__finish();
perf_session__warn_about_errors(session, tool);
perf_session_free_sample_buffers(session);
ordered_events__free(&session->ordered_events);
session->one_mmap = false;
return err;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册