Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4515586ioo; Tue, 31 May 2022 06:14:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPk01UTvMsBdHL8dXE4aoNBHGm86CJZwfCHwF2qSh7/FlnWBk00V7NJHZPVJv6xRM5qWjm X-Received: by 2002:a50:d7c6:0:b0:42d:5065:568d with SMTP id m6-20020a50d7c6000000b0042d5065568dmr21147350edj.116.1654002890101; Tue, 31 May 2022 06:14:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654002890; cv=none; d=google.com; s=arc-20160816; b=gGiuXK8sCzEkvJtOYgWhm4TieWksZJfkKnh8R9LG72ZktWPNEsyPLg7vmbP/UAYHFO r//ni+oCepMPTBTgG97XxJgdoulaIWsS3xhr74AsqpsPiFQZaHUQKq6OD2Ddp8Iw+GM0 S+V+gsTNtEyprg8fzZ4aheeLbXG7Fs1ynnoNju0JqvvnXtol1ZiHdmqoLsdH3upAZryJ ThNGGUE/1hkhQ+ltDKV69q0nryW1ccoBe/ILdONeZF9PBBf+bZnoME7ccqHDRHJlcH0G Ud76H+CFUb5PJ+UXvliqzB741Mz4OifB6f1a3Sax6mUOj/cGICbF7Mh11i18inLwJ/w4 iORA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lAvFNka/m3Pr7HXS/bNaYQopT2wZ3BtRM1nGnYwWgUI=; b=DvvJSHda9UDA7twFS3qjyl81ZP9AW/swMUsXNVAlOHLKmxiH6nbY70xN14VyPgiAY0 2HprB+8NJJUN1XfZAISh47qTvKXP2LUYRN9LAEqgrVAIhupnKfoYTMOTNPgZ1kPkNB42 EZv3KP5i91TzrB8tedGthTIU3TDOHVjvxLh238kVhxmA80xi/httjAfj9xZLQJYrswWk QFv47v2cWD7Lq5sgJ3/ONLCrGY1DA54ZtITY8dQ3DXtVpylDoLUJWcXZ73EpPB0oq7Pp 09yIyGN+5C4dT8ACH2AZPosofvecIeyDwUZFUGK1Y4c7G5cn+0gcWl2JkhA+eT4ZN3KA M2Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J35JDHdY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h12-20020a1709066d8c00b006efb71530d8si12743791ejt.859.2022.05.31.06.14.19; Tue, 31 May 2022 06:14:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J35JDHdY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235925AbiE3LmQ (ORCPT + 99 others); Mon, 30 May 2022 07:42:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236030AbiE3LmA (ORCPT ); Mon, 30 May 2022 07:42:00 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64BD86341 for ; Mon, 30 May 2022 04:41:53 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id 129so5655751pgc.2 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=F/GR6PwjmT6eUaKsb0JTDUiG87wQniyBpVm+mD8gG4saA1GpWURY+581n9GvqJN9mQ bceEJ1+jC4ytwzxhHD+hCrpSZUBVcOWfGbffsTFVlBPOBXoSIjDXl68AiH6RDSDArSvP i0U4v6rOqYHhXm2iCYGKZWRwGYvuu3M4iRQREbR/OqKyi0wRwL9flH3q66ueiFVNDKjM AgupjWEylTDW/FgrRVkWCnqv/YhSKDIEqiMXw6kd/H6CywqiFRZuCnxK+1Xha7NrNFBQ +2lAHXCu9jrpa3SLFN4vLbDVwGUOJsgRCudWa85MOKAwx3CudGtf5l0J4oN6DPhDBOZ7 LvqQ== X-Gm-Message-State: AOAM533xJ5hFjN35x8/r17iq+2l8jSLesEXeSKvFxjlWRddjk0KH3G4E rkFiEFx8qSNuXvCSVLTgSKdxXNT9G7lTNpFxrFU= 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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