From patchwork Fri Jun 24 11:22:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 70820 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp895548qgy; Fri, 24 Jun 2016 04:23:57 -0700 (PDT) X-Received: by 10.98.155.29 with SMTP id r29mr6334440pfd.11.1466767430730; Fri, 24 Jun 2016 04:23:50 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r27si6356713pfi.170.2016.06.24.04.23.50; Fri, 24 Jun 2016 04:23:50 -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 S1751546AbcFXLX1 (ORCPT + 30 others); Fri, 24 Jun 2016 07:23:27 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:51300 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751481AbcFXLXZ (ORCPT ); Fri, 24 Jun 2016 07:23:25 -0400 Received: from 172.24.1.137 (EHLO szxeml422-hub.china.huawei.com) ([172.24.1.137]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id CDU87258; Fri, 24 Jun 2016 19:23:08 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by szxeml422-hub.china.huawei.com (10.82.67.152) with Microsoft SMTP Server id 14.3.235.1; Fri, 24 Jun 2016 19:22:58 +0800 From: Wang Nan To: , CC: , , , Wang Nan , Arnaldo Carvalho de Melo Subject: [PATCH v2 7/7] perf ctf: Generate fork and exit events to CTF output Date: Fri, 24 Jun 2016 11:22:12 +0000 Message-ID: <1466767332-114472-8-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1466767332-114472-1-git-send-email-wangnan0@huawei.com> References: <1466767332-114472-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090205.576D181C.008C, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: f04131c7fb38fcdb393ac680165c133a Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If 'all' is selected, convert fork and exit events to output CTF stream. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa --- tools/perf/util/data-convert-bt.c | 44 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) -- 1.8.3.4 diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c index 31bc81a..acd11d4 100644 --- a/tools/perf/util/data-convert-bt.c +++ b/tools/perf/util/data-convert-bt.c @@ -69,6 +69,8 @@ struct ctf_writer { struct bt_ctf_field_type *array[6]; } data; struct bt_ctf_event_class *comm_class; + struct bt_ctf_event_class *exit_class; + struct bt_ctf_event_class *fork_class; }; struct convert { @@ -811,6 +813,21 @@ __FUNC_PROCESS_NON_SAMPLE(comm, __NON_SAMPLE_SET_FIELD(comm, u32, tid); __NON_SAMPLE_SET_FIELD(comm, string, comm); ) +__FUNC_PROCESS_NON_SAMPLE(fork, + __NON_SAMPLE_SET_FIELD(fork, u32, pid); + __NON_SAMPLE_SET_FIELD(fork, u32, ppid); + __NON_SAMPLE_SET_FIELD(fork, u32, tid); + __NON_SAMPLE_SET_FIELD(fork, u32, ptid); + __NON_SAMPLE_SET_FIELD(fork, u64, time); +) + +__FUNC_PROCESS_NON_SAMPLE(exit, + __NON_SAMPLE_SET_FIELD(fork, u32, pid); + __NON_SAMPLE_SET_FIELD(fork, u32, ppid); + __NON_SAMPLE_SET_FIELD(fork, u32, tid); + __NON_SAMPLE_SET_FIELD(fork, u32, ptid); + __NON_SAMPLE_SET_FIELD(fork, u64, time); +) #undef __NON_SAMPLE_SET_FIELD #undef __FUNC_PROCESS_NON_SAMPLE @@ -1126,6 +1143,22 @@ __FUNC_ADD_NON_SAMPLE_EVENT_CLASS(comm, __NON_SAMPLE_ADD_FIELD(string, comm); ) +__FUNC_ADD_NON_SAMPLE_EVENT_CLASS(fork, + __NON_SAMPLE_ADD_FIELD(u32, pid); + __NON_SAMPLE_ADD_FIELD(u32, ppid); + __NON_SAMPLE_ADD_FIELD(u32, tid); + __NON_SAMPLE_ADD_FIELD(u32, ptid); + __NON_SAMPLE_ADD_FIELD(u64, time); +) + +__FUNC_ADD_NON_SAMPLE_EVENT_CLASS(exit, + __NON_SAMPLE_ADD_FIELD(u32, pid); + __NON_SAMPLE_ADD_FIELD(u32, ppid); + __NON_SAMPLE_ADD_FIELD(u32, tid); + __NON_SAMPLE_ADD_FIELD(u32, ptid); + __NON_SAMPLE_ADD_FIELD(u64, time); +) + #undef __NON_SAMPLE_ADD_FIELD #undef __FUNC_ADD_NON_SAMPLE_EVENT_CLASS @@ -1137,6 +1170,12 @@ static int setup_non_sample_events(struct ctf_writer *cw, ret = add_comm_event(cw); if (ret) return ret; + ret = add_exit_event(cw); + if (ret) + return ret; + ret = add_fork_event(cw); + if (ret) + return ret; return 0; } @@ -1435,8 +1474,11 @@ int bt_convert__perf2ctf(const char *input, const char *path, struct ctf_writer *cw = &c.writer; int err = -1; - if (opts->all) + if (opts->all) { c.tool.comm = process_comm_event; + c.tool.exit = process_exit_event; + c.tool.fork = process_fork_event; + } perf_config(convert__config, &c);