Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2933953pxj; Sun, 6 Jun 2021 20:03:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIsm7WwccqRXl1bYeUgpQTOpa3qy9FJMYjeOeCgYvvaIz61WVqDdVYeW3KPxAj0LDjzbLS X-Received: by 2002:a17:906:919:: with SMTP id i25mr15293387ejd.171.1623035022348; Sun, 06 Jun 2021 20:03:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623035022; cv=none; d=google.com; s=arc-20160816; b=rAuIcCJYGGz9fXsJmWfKuOKx7ZtdAPmI0O7MenVQZ4Bh95OC31BlF0XyIM/3Ez95d5 PPGxL/dOhjIaOA7KFcN3PYvTKsxmtuD3JgZpsGqOr0o6kXJZf+r6BOBpk1O50QOok+1E Ua70FXfdLV0zXGM+N+PVHSkSn58V4VgqyMBft9MMSxhCAWPy7+icie1gvAVSfC2rKL0n +J85sMigOrJkz8VAKI3UVypF6G94qn+2zYqWC4fuhHIIq0P5rt5GUni4hCrQBMc2sPAW OUIk9HOZSbVB+eOzbmT/SqWcIMIX/qmKI2Jq8xsFgfPF+BAOOnvHAk7NK575EOF+gLqf GY6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=h/0SEv6bq2Y+fsYU2KcigVd0YV9PR20eqAL2bchz79o=; b=HYBO7ds2c5fyXsVHY3Vq20NjncEt7Y6c4q4S1CPnSX8WfL6jCLT7UkFzoiqY2AZsxu nLGDiQVIMSwzoRGO4lvgyGFtNOll7ULc7CP2/r3y8Ym06XOFKcsgtEhxeFGdSgFao4jj t6FzDLbjk+IHFrxkNS6sY722zZHFAC72cpEn9xM09szthu+RXyQt+9k92MyZTK4k+7As qCx8z8rWy6BO4SwYDHTyMJUZS9uGEHV6YXYedqTVcKWRrbv2pY3g/N9m2BrImnrnCmbS mYMrlJD2d3M71Gqv/ZV1BmqitkFGjhdm4ZY/UeywkUO54o124mLaIx3waTyVsrYtNCi2 Qn7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j3si11005350ejv.180.2021.06.06.20.03.19; Sun, 06 Jun 2021 20:03:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230222AbhFGDAa (ORCPT + 99 others); Sun, 6 Jun 2021 23:00:30 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:4327 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230147AbhFGDAa (ORCPT ); Sun, 6 Jun 2021 23:00:30 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4FyycT5zh8z1BJhT; Mon, 7 Jun 2021 10:53:45 +0800 (CST) Received: from dggpemm000003.china.huawei.com (7.185.36.128) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 7 Jun 2021 10:58:34 +0800 Received: from ubuntu1804.huawei.com (10.67.174.61) by dggpemm000003.china.huawei.com (7.185.36.128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 7 Jun 2021 10:58:34 +0800 From: Yang Jihong To: , , , , , , , , CC: Subject: [PATCH v2] perf annotate: Add itrace options support Date: Mon, 7 Jun 2021 10:59:18 +0800 Message-ID: <20210607025918.118603-1-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.61] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm000003.china.huawei.com (7.185.36.128) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The "auxtrace_info" and "auxtrace" functions are not set in "tool" member of "annotate". As a result, perf annotate does not support parsing itrace data. A simple example is as follows: # perf record -e arm_spe_0/branch_filter=1/ -a sleep 1 [ perf record: Woken up 9 times to write data ] [ perf record: Captured and wrote 20.874 MB perf.data ] # perf annotate --stdio Error: The perf.data data has no samples! Solution: 1.Add itrace options in help, 2.Set hook functions of "auxtrace_info" and "auxtrace" in perf_tool. Signed-off-by: Yang Jihong --- Changes since v1: - Adjust spaces to maintain alignment in "tool". tools/perf/builtin-annotate.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 49627a7bed7c..8f87658eff31 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -474,6 +474,8 @@ int cmd_annotate(int argc, const char **argv) .attr = perf_event__process_attr, .build_id = perf_event__process_build_id, .tracing_data = perf_event__process_tracing_data, + .auxtrace_info = perf_event__process_auxtrace_info, + .auxtrace = perf_event__process_auxtrace, .feature = process_feature_event, .ordered_events = true, .ordering_requires_timestamps = true, @@ -483,6 +485,9 @@ int cmd_annotate(int argc, const char **argv) struct perf_data data = { .mode = PERF_DATA_MODE_READ, }; + struct itrace_synth_opts itrace_synth_opts = { + .set = 0, + }; struct option options[] = { OPT_STRING('i', "input", &input_name, "file", "input file name"), @@ -547,6 +552,9 @@ int cmd_annotate(int argc, const char **argv) OPT_CALLBACK(0, "percent-type", &annotate.opts, "local-period", "Set percent type local/global-period/hits", annotate_parse_percent_type), + OPT_CALLBACK_OPTARG(0, "itrace", &itrace_synth_opts, NULL, "opts", + "Instruction Tracing options\n" ITRACE_HELP, + itrace_parse_synth_opts), OPT_END() }; @@ -591,6 +599,8 @@ int cmd_annotate(int argc, const char **argv) if (IS_ERR(annotate.session)) return PTR_ERR(annotate.session); + annotate.session->itrace_synth_opts = &itrace_synth_opts; + annotate.has_br_stack = perf_header__has_feat(&annotate.session->header, HEADER_BRANCH_STACK); -- 2.30.GIT