Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2220277rdh; Tue, 26 Sep 2023 17:06:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHZSaO/Mg9L50vCSkFHqmIhoIpTSV2ez85fBjCH8J4VQlYrb0K/4NQqir3hMyu4v7BEYpM8 X-Received: by 2002:a17:903:120e:b0:1c0:d17a:bfe9 with SMTP id l14-20020a170903120e00b001c0d17abfe9mr295970plh.46.1695773175673; Tue, 26 Sep 2023 17:06:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695773175; cv=none; d=google.com; s=arc-20160816; b=TxPb/uZCfM9CDeTwyCEx9jdBlvp07KeqsFrApt30EiPoP9s1FQ8+okwpM5NrgDj30e QRGBI+M4uWcG2QqbVkAOFqo96qisYXiLDdiSTqqgf/1TSoBtsMSxFL1EyNWkhk2sUhYz 3I0yWKAzV4tUcjGf8dTfpIF+ZSFEWYDxiv0Uq5ZvTYzw/qFnUmJPPfjwQE5nP9gtP00M SUp792TyDf0Ta1y4gn1seCKAZcs8iljZjKnahaZScAhwrECrNlaDbRakYWcHv+ynf9SU yos+zhGGa6x5CqbUARy517LLsN3cbnYhS96RODZ+Nf9r/WtV8twSm0gkl3PpQFZCceIe fiEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=MjPsww5k71D2mpp0NqmuybIP5hqjhcOJnNkOz90NobQ=; fh=R1OkhriIwip1F03SPBPuQjbmUJVFiHc78tVoBI9xOtw=; b=ouSyx5scOflfPxX6kxu5F9pXFTIk64QnZFYaKelf6AVYeR8ayFm4FJjHpVHgSHDoVi l2yXrOeahsrBA2Z667aNonDqm9xpxvlXHL2hj9VL6y7Qk1I0uSnREgpqF/xnFa0XjbbF RywLEbomhEruJfyahhxBwHAZSXI3ZNQUz3kk1qb6iWBWhiXU/b0/kVomzs6CgF8z0Ih1 wh0PsP2otDCANTCede/Oh6yy57ZXsS6C7InqeS/38WgnSuZ9y+bHwzmzZYzoI4tlg7cu V+FxCr7B5H6zKCJJwAiNxgD5d6fcCHTXsjTbHb+XOnY+2JGd5R9zAjKWxRF3BUs7WYOm OAbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HeuiRZmt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id d18-20020a170902ced200b001b8a3a8d707si15397061plg.573.2023.09.26.17.06.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 17:06:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HeuiRZmt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 4067180FCE6D; Tue, 26 Sep 2023 09:35:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235197AbjIZQfV (ORCPT + 99 others); Tue, 26 Sep 2023 12:35:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbjIZQfU (ORCPT ); Tue, 26 Sep 2023 12:35:20 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C636FB3; Tue, 26 Sep 2023 09:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695746113; x=1727282113; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=n2EDZfzwz5FaS81/kpTL4P4/rziwTRRBI8J4VETShc8=; b=HeuiRZmtP9Odx1owNO89hqh4hcyHenDYSm8w988Ue4sR7/vSdFf+zhtG GvqcPP/4e2nbH+0mHyGm8IVLewmsbvcc90/mEpeuZFzU4FRPQUkGmZxld M8KASBqVqkb5Qos88UDA4WCFxIPG5cPjAVHImssNk7FNhdyHGbmvE6bdD fV5496D0iZMNUqn1J0KOpncGE3jAtP/xDN3FAoDUYGiz8IJNGyX2k7tqW XMJdJ4PAk2l2/fL/5tpXNBfoi07wFo4L220jLEldONeYnRSPQr5mMTKGt 9Xa/cblGBmztD3aBI5wKjFYV7N5v1+9S+EMkRbv/WQctHDiVvRw6I+A4J A==; X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="448103760" X-IronPort-AV: E=Sophos;i="6.03,178,1694761200"; d="scan'208";a="448103760" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2023 09:35:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="922486940" X-IronPort-AV: E=Sophos;i="6.03,178,1694761200"; d="scan'208";a="922486940" Received: from linux.intel.com ([10.54.29.200]) by orsmga005.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2023 09:35:12 -0700 Received: from [10.209.130.196] (kliang2-mobl1.ccr.corp.intel.com [10.209.130.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id EDA40580BBE; Tue, 26 Sep 2023 09:35:10 -0700 (PDT) Message-ID: Date: Tue, 26 Sep 2023 12:35:09 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [RFC PATCH 22/25] perf stat: Add TSC support in hardware-grouping Content-Language: en-US To: weilin.wang@intel.com, Ian Rogers , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Perry Taylor , Samantha Alt , Caleb Biggers , Mark Rutland References: <20230925061824.3818631-1-weilin.wang@intel.com> <20230925061824.3818631-23-weilin.wang@intel.com> From: "Liang, Kan" In-Reply-To: <20230925061824.3818631-23-weilin.wang@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 26 Sep 2023 09:35:23 -0700 (PDT) On 2023-09-25 2:18 a.m., weilin.wang@intel.com wrote: > From: Weilin Wang > > Add TSC check and create new event for it the same way as how we handle > topdown-* for now since it is not listed in an event json file either. Need > TSC to support TopdownL4-L5. > > Signed-off-by: Weilin Wang > --- > tools/perf/util/metricgroup.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c > index d10f6afb0..07a82fa21 100644 > --- a/tools/perf/util/metricgroup.c > +++ b/tools/perf/util/metricgroup.c > @@ -321,6 +321,14 @@ static int setup_metric_events(const char *pmu, struct hashmap *ids, > } > } > if (matched_events < ids_size) { > + struct hashmap_entry *cur; > + size_t bkt; > + > + hashmap__for_each_entry(ids, cur, bkt) { > + const char *id = cur->pkey; > + > + pr_debug("Need event %s\n", id); > + } Is it just for the debug purpose? If so, please only traverse the hashmap in debug. > free(metric_events); > return -EINVAL; > } > @@ -2106,11 +2114,16 @@ static int hw_aware_build_grouping(struct expr_parse_ctx *ctx, > #define RETURN_IF_NON_ZERO(x) do { if (x) return x; } while (0) > hashmap__for_each_entry(ctx->ids, cur, bkt) { > const char *id = cur->pkey; > - const char *special_pattern = "topdown-"; > + const char *pattern1 = "topdown-"; > + const char *pattern2 = "TSC"; > > pr_debug("found event %s\n", id); > - if (!strncmp(id, special_pattern, strlen(special_pattern))) { > + if (!strncmp(id, pattern1, strlen(pattern1)) || > + !strncmp(id, pattern2, strlen(pattern2))) { I guess there may be more patterns later. It's better to add a dedicated function to the check. Thanks, Kan > struct metricgroup__event_info *event; > + /* topdown-* and TSC use dedicated registers, set as free > + * counter here for grouping > + */ > event = event_info__new(id, "default_core", "0", false, > /*free_counter=*/true); > if (!event) { > @@ -2602,8 +2615,10 @@ int metricgroup__parse_groups(struct evlist *perf_evlist, > ret = hw_aware_parse_groups(perf_evlist, pmu, str, > metric_no_threshold, user_requested_cpu_list, system_wide, > /*fake_pmu=*/NULL, metric_events, table); > - if (!ret) > + if (!ret) { > + pr_info("Hardware aware grouping completed\n"); > return 0; > + } > } > > return parse_groups(perf_evlist, pmu, str, metric_no_group, metric_no_merge,