[PATCH 12/17] perf tools: Add ordered_events_queue_free function

From: Jiri Olsa
Date: Thu Jun 12 2014 - 18:09:48 EST


Adding ordered_events_queue_free function to release all
the struct ordered_events_queue data. It's replacement
for former perf_session_free_sample_buffers function.

Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Corey Ashford <cjashfor@xxxxxxxxxxxxxxxxxx>
Cc: David Ahern <dsahern@xxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Jean Pihet <jean.pihet@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
tools/perf/util/ordered-events.c | 11 +++++++++++
tools/perf/util/ordered-events.h | 1 +
tools/perf/util/session.c | 17 ++---------------
3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/tools/perf/util/ordered-events.c b/tools/perf/util/ordered-events.c
index 0ca34ee..eaf2c47 100644
--- a/tools/perf/util/ordered-events.c
+++ b/tools/perf/util/ordered-events.c
@@ -200,3 +200,14 @@ void ordered_events_queue_init(struct ordered_events_queue *q)
q->max_alloc_size = (u64) -1;
q->cur_alloc_size = 0;
}
+
+void ordered_events_queue_free(struct ordered_events_queue *q)
+{
+ while (!list_empty(&q->to_free)) {
+ struct ordered_event *event;
+
+ event = list_entry(q->to_free.next, struct ordered_event, list);
+ list_del(&event->list);
+ free(event);
+ }
+}
diff --git a/tools/perf/util/ordered-events.h b/tools/perf/util/ordered-events.h
index 0633b09..25ec273 100644
--- a/tools/perf/util/ordered-events.h
+++ b/tools/perf/util/ordered-events.h
@@ -41,4 +41,5 @@ void ordered_event_put(struct ordered_events_queue *q,
int ordered_events_flush(struct perf_session *s, struct perf_tool *tool,
enum oeq_flush how);
void ordered_events_queue_init(struct ordered_events_queue *q);
+void ordered_events_queue_free(struct ordered_events_queue *q);
#endif /* __ORDERED_EVENTS_H */
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 09d1052..26bedac 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -444,19 +444,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_queue *q = &session->ordered_events;
-
- while (!list_empty(&q->to_free)) {
- struct ordered_event *sq;
-
- sq = list_entry(q->to_free.next, struct ordered_event, list);
- list_del(&sq->list);
- free(sq);
- }
-}
-
/*
* When perf record finishes a pass on every buffers, it records this pseudo
* event.
@@ -1092,7 +1079,7 @@ done:
out_err:
free(buf);
perf_session__warn_about_errors(session, tool);
- perf_session_free_sample_buffers(session);
+ ordered_events_queue_free(&session->ordered_events);
return err;
}

@@ -1227,7 +1214,7 @@ out:
out_err:
ui_progress__finish();
perf_session__warn_about_errors(session, tool);
- perf_session_free_sample_buffers(session);
+ ordered_events_queue_free(&session->ordered_events);
return err;
}

--
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/