Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7583747rwl; Thu, 23 Mar 2023 06:21:27 -0700 (PDT) X-Google-Smtp-Source: AK7set8te//NgqAqqrVHf4KrUsQ2LrH4TUNYh2ENTznhWuaLqFQ+nE0cUDuzer2fDjadJ3Yl2aSi X-Received: by 2002:a17:906:229a:b0:932:9d28:9668 with SMTP id p26-20020a170906229a00b009329d289668mr10661181eja.6.1679577687602; Thu, 23 Mar 2023 06:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679577687; cv=none; d=google.com; s=arc-20160816; b=kLLtqA/6L0tfNnKS2NfPnVBm+Z3ZkFPxOM/A2xbpWMexGVI5HYCefv9fPgd6ggf5LK t4PHVImobfE1lhQJEwKV1yi6DVQgN1MbTMTYO1h3DmZ9W5mp/jcwzcKeoYxaQ3Y0jaIp 8VY1WJq3BqM8F27fcyZw8huJzeRs23FFsV9RjzdLJFpw251r2piMyzzpwddzw0FHJ3FI KWAtIgfqYWNqZy5jPgvbAARIB6d2Y1LluIfMg80fOQpWKE9ngbCDYpvNP1wnLt80dPVA iD/xDjR8nYUpwhM5jXlvnbtNmS/Lt9PLJUznDwnEUVEgzRzNCwN4z7+bvncC66wdTXXv M1UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Jw1VC9j1akYGE8SL+7CAC0vnd0mZw685d0SVR5QISqc=; b=vEd1YBLJAXCrZQCNy/1aweqyqc55j2zeHAmcL3JwpZ8aYFevtHwlweuX6abRL2BcrZ gLYGDC+zTb8KRakf/En5cZBWFp9moRedGBZc95P7VB0YmtZnAB9VztZBlkdXJVRFn2Cz q7bG8drXojv4BqoHaWniAifGQGkDMuOQ7MSfKdfU4wndpJ9tDgdt7vAEE3jD8y0+1DDz EMOuzUj+0vHX7Pm4Sup7LNRu8GjmBgXytHpNeeTjxuobauR2vY+WpKIreOJDxWCjUFlM cEf+8J/037ptbwHOJdV+ELWIQfOpjCMHAS7bXJODrsvDQlFVb+uE6Q1nMqLn6jzZ1rfY vd7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pvlOJwd1; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b9-20020a1709063f8900b009300aeecec0si16903052ejj.723.2023.03.23.06.21.03; Thu, 23 Mar 2023 06:21:27 -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=@kernel.org header.s=k20201202 header.b=pvlOJwd1; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231961AbjCWMyK (ORCPT + 99 others); Thu, 23 Mar 2023 08:54:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231960AbjCWMyJ (ORCPT ); Thu, 23 Mar 2023 08:54:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C84853C13; Thu, 23 Mar 2023 05:54:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 75B75B820F7; Thu, 23 Mar 2023 12:54:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF456C433D2; Thu, 23 Mar 2023 12:54:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679576045; bh=74vUZPMQHOoEjR07bQmZxQ/fDJUK+fLucEjzk1+Z3zM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pvlOJwd1TMVHQC66g2ssOpeFbVXYCWhaVrsxtN7G8VlPcyhi91bPCQ7oiml8xpZoN 2QNaRENWK7lVVa3zeuAhCJHlMVEvnsoQyDaDTDk8wtMTdYmDJxr7Tki363Fx3P/cDd EBNSOSKKQFTH8fFaBKtEkFwQCf4pkTQR0hL2jwfakZ6LURqn+Mupv3DS08eas4/x9E JkfCbXxqTElxB9jKSnnXdACGyEHbOQsBmaH2pBy3yPcI7K0LutGNUGFZh9OKr95Idd VP4Rt5xheGoORkuAq41AFqTKXSKjX2QhLDvSIQ+5iEItxLcZ176WMJfkeEGLwdk6OG IbxRZ4VRc/GEg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 30EB34052D; Thu, 23 Mar 2023 09:54:02 -0300 (-03) Date: Thu, 23 Mar 2023 09:54:02 -0300 From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Jiri Olsa , Ian Rogers , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org Subject: Re: [PATCH] perf hist: Improve srcfile sort key performance (really) Message-ID: References: <20230323025005.191239-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230323025005.191239-1-namhyung@kernel.org> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Mar 22, 2023 at 07:50:05PM -0700, Namhyung Kim escreveu: > The earlier commit f0cdde28fecc ("perf hist: Improve srcfile sort key > performance") updated the srcfile logic but missed to change the ->cmp() > callback which is called for every sample. It should use the same logic > like in the srcline to speed up the processing because it'd return the > same information repeatedly for the same address. The real processing > will be done in sort__srcfile_collapse(). Thanks, applied. - Arnaldo > Fixes: pf0cdde28fecc ("perf hist: Improve srcfile sort key performance") > Signed-off-by: Namhyung Kim > --- > tools/perf/util/sort.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c > index e11e68ecf0a2..2b5cc8e4aa6e 100644 > --- a/tools/perf/util/sort.c > +++ b/tools/perf/util/sort.c > @@ -657,12 +657,7 @@ static char *hist_entry__get_srcfile(struct hist_entry *e) > static int64_t > sort__srcfile_cmp(struct hist_entry *left, struct hist_entry *right) > { > - if (!left->srcfile) > - left->srcfile = hist_entry__get_srcfile(left); > - if (!right->srcfile) > - right->srcfile = hist_entry__get_srcfile(right); > - > - return strcmp(right->srcfile, left->srcfile); > + return sort__srcline_cmp(left, right); > } > > static int64_t > -- > 2.40.0.rc1.284.g88254d51c5-goog > -- - Arnaldo