[tip:perf/core] perf session: Make ordered_events reusable
From: tip-bot for Wang Nan
Date: Thu Apr 14 2016 - 09:36:06 EST
Commit-ID: b26dc73018d2e3a68cad0cf0bad902a8637f9bdf
Gitweb: http://git.kernel.org/tip/b26dc73018d2e3a68cad0cf0bad902a8637f9bdf
Author: Wang Nan <wangnan0@xxxxxxxxxx>
AuthorDate: Wed, 13 Apr 2016 08:21:04 +0000
Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
CommitDate: Thu, 14 Apr 2016 08:57:54 -0300
perf session: Make ordered_events reusable
ordered_events__free() leaves linked lists and timestamps not cleared,
so unable to be reused after ordered_events__free(). Which is inconvenient
after 'perf record' supports generating multiple perf.data output and
process build-ids for each of them.
Use ordered_events__reinit() for this.
Signed-off-by: Wang Nan <wangnan0@xxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Zefan Li <lizefan@xxxxxxxxxx>
Cc: pi3orama@xxxxxxx
Link: http://lkml.kernel.org/r/1460535673-159866-2-git-send-email-wangnan0@xxxxxxxxxx
Signed-off-by: He Kuang <hekuang@xxxxxxxxxx>
[ Split from larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/session.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 91d4528..ca1827c 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1836,7 +1836,11 @@ out:
out_err:
ui_progress__finish();
perf_session__warn_about_errors(session);
- ordered_events__free(&session->ordered_events);
+ /*
+ * We may switching perf.data output, make ordered_events
+ * reusable.
+ */
+ ordered_events__reinit(&session->ordered_events);
auxtrace__free_events(session);
session->one_mmap = false;
return err;