From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8792C433F5 for ; Mon, 30 May 2022 11:42:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235987AbiE3LmP (ORCPT ); Mon, 30 May 2022 07:42:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236008AbiE3LmA (ORCPT ); Mon, 30 May 2022 07:42:00 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 644CB62D7 for ; Mon, 30 May 2022 04:41:53 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id y199so10352358pfb.9 for ; Mon, 30 May 2022 04:41:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lAvFNka/m3Pr7HXS/bNaYQopT2wZ3BtRM1nGnYwWgUI=; b=J35JDHdYfL3z47b3U5zMVTOC/j930PY8ubRHzosSBNYhYnetLWQGy+FrMMc42JfKQu xsVGdUt8Kmdi6+FM8KoCUxbaC2nTtU5nKNr5hl6ERK3/PFFj/BM3E5bJBpnamfodL+jW K84Q0wZrkxDo4iZUlFVBBUu5KQMkw1c0q4TyeQEvVABgb7gk/X/zELEzfKPTUzBnK4ai eV7fFCFQhvZd5qAmQti5dQm5vgrGqLzp3bei6g29pRH+dKF7WN316A9bczx4YLvWmFnq ro5syfmQVPx43kcYs4HWr2fP+duGwu71YV0wrFhSBe4Hagtz/bY3p+5tGxfWHXvWvkYg oy0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lAvFNka/m3Pr7HXS/bNaYQopT2wZ3BtRM1nGnYwWgUI=; b=yk4QR3hpNiyW87dCdUV4/6fF6G8TVfM4Jf7UISgixquCyuZN/bj6e2O6fPslEfu+hj Maeh57lGWX2AKx5Yly1nS4vWhPesNX60hZPHDSPUBPQmYzGUvZYXd7ZavrQ6OrlE7lZD IINxiy4b1FsJmKSPAAncAAzbdgDiATrjBX6INJjTxkjmvyjfVXya6JAqyz7Y26E311zv /1Zlmz+3M0o/EcYaTbya+s40nroGlL1ogfqD7ABW4Wb7jhz/rFO6aWxeEB8snEV96ESO /OVkBILzkAasGp+upnn7BceDg/hcFucX/moL6hX5rsDqMKhGepXPm1Vr3qjsUWIIrzOG q57Q== X-Gm-Message-State: AOAM533YnfOC1fzB6TKIilkZYvIiRzVgoF9rdEqdFPpMKPDXJXJmWIyB dilSrY9Cs011HNhtFbTvQhGgyQ== X-Google-Smtp-Source: ABdhPJyICzqM2HpkXHFV0U936Hh64o0w7SC8tQexIpAlh7exp3xGA3kC8nJtJBTHfClC7Y/SrryZkA== X-Received: by 2002:a63:85c3:0:b0:3f9:dd67:8ddd with SMTP id u186-20020a6385c3000000b003f9dd678dddmr39306452pgd.258.1653910912632; Mon, 30 May 2022 04:41:52 -0700 (PDT) Received: from leo-build-box.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id c7-20020a170902724700b00161a9df4de8sm8846194pll.145.2022.05.30.04.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 May 2022 04:41:52 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Alyssa Ross , Ian Rogers , Like Xu , Kajol Jain , Li Huafei , Joe Mario , Adam Li , German Gomez , James Clark , Ali Saidi , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Leo Yan Subject: [PATCH v4 11/12] perf c2c: Use 'peer' as default display for Arm64 Date: Mon, 30 May 2022 19:40:35 +0800 Message-Id: <20220530114036.3225544-12-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220530114036.3225544-1-leo.yan@linaro.org> References: <20220530114036.3225544-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org Since Arm64 arch doesn't support HITMs flags, this patch changes to use 'peer' as default display if user doesn't specify any type; for other arches, it still uses 'tot' as default display type if user doesn't specify it. This patch changes to call perf_session__new() in an earlier place, so session environment can be initialized ahead and arch info can be used for setting display type. Suggested-by: Ali Saidi Signed-off-by: Leo Yan --- tools/perf/builtin-c2c.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 1076bf8684d3..ccfd23103b96 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -2878,7 +2878,7 @@ static int setup_callchain(struct evlist *evlist) static int setup_display(const char *str) { - const char *display = str ?: "tot"; + const char *display = str; if (!strcmp(display, "tot")) c2c.display = DISPLAY_TOT_HITM; @@ -3066,27 +3066,39 @@ static int perf_c2c__report(int argc, const char **argv) data.path = input_name; data.force = symbol_conf.force; + session = perf_session__new(&data, &c2c.tool); + if (IS_ERR(session)) { + err = PTR_ERR(session); + pr_debug("Error creating perf session\n"); + goto out; + } + + /* + * Use the 'tot' as default display type if user doesn't specify it; + * since Arm64 platform doesn't support HITMs flag, use 'peer' as the + * default display type. + */ + if (!display) { + if (!strcmp(perf_env__arch(&session->header.env), "arm64")) + display = "peer"; + else + display = "tot"; + } + err = setup_display(display); if (err) - goto out; + goto out_session; err = setup_coalesce(coalesce, no_source); if (err) { pr_debug("Failed to initialize hists\n"); - goto out; + goto out_session; } err = c2c_hists__init(&c2c.hists, "dcacheline", 2); if (err) { pr_debug("Failed to initialize hists\n"); - goto out; - } - - session = perf_session__new(&data, &c2c.tool); - if (IS_ERR(session)) { - err = PTR_ERR(session); - pr_debug("Error creating perf session\n"); - goto out; + goto out_session; } session->itrace_synth_opts = &itrace_synth_opts; @@ -3094,7 +3106,7 @@ static int perf_c2c__report(int argc, const char **argv) err = setup_nodes(session); if (err) { pr_err("Failed setup nodes\n"); - goto out; + goto out_session; } err = mem2node__init(&c2c.mem2node, &session->header.env); -- 2.25.1