From patchwork Thu Apr 14 12:32:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 65814 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp569814qge; Thu, 14 Apr 2016 05:32:47 -0700 (PDT) X-Received: by 10.66.65.201 with SMTP id z9mr20798897pas.143.1460637166779; Thu, 14 Apr 2016 05:32:46 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q76si9233149pfa.60.2016.04.14.05.32.46; Thu, 14 Apr 2016 05:32:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932142AbcDNMcn (ORCPT + 29 others); Thu, 14 Apr 2016 08:32:43 -0400 Received: from casper.infradead.org ([85.118.1.10]:42833 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755174AbcDNMcj (ORCPT ); Thu, 14 Apr 2016 08:32:39 -0400 Received: from [179.235.167.147] (helo=jouet.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.85_2 #1 (Red Hat Linux)) id 1aqgRn-0005Df-NZ; Thu, 14 Apr 2016 12:32:35 +0000 Received: by jouet.infradead.org (Postfix, from userid 1000) id 7D60214363A; Thu, 14 Apr 2016 09:32:29 -0300 (BRT) From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Wang Nan , Jiri Olsa , Masami Hiramatsu , Namhyung Kim , Zefan Li , pi3orama@163.com, He Kuang , Arnaldo Carvalho de Melo Subject: [PATCH 06/11] perf session: Make ordered_events reusable Date: Thu, 14 Apr 2016 09:32:22 -0300 Message-Id: <1460637147-10555-7-git-send-email-acme@kernel.org> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1460637147-10555-1-git-send-email-acme@kernel.org> References: <1460637147-10555-1-git-send-email-acme@kernel.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wang Nan 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 Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1460535673-159866-2-git-send-email-wangnan0@huawei.com Signed-off-by: He Kuang [ Split from larger patch ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/session.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.5.5 diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 91d4528d71fa..ca1827c4af4a 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;