Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6986822rwl; Wed, 22 Mar 2023 19:53:22 -0700 (PDT) X-Google-Smtp-Source: AK7set+5ox/lcG+4428m1aqCGCU281oQA5pAiGnZrkf7U+cs3+Mm4icjQvhwJ8EIp2pKOE+92/WN X-Received: by 2002:a17:90b:4f8b:b0:23d:1f95:de1c with SMTP id qe11-20020a17090b4f8b00b0023d1f95de1cmr6204638pjb.28.1679540002288; Wed, 22 Mar 2023 19:53:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679540002; cv=none; d=google.com; s=arc-20160816; b=q/aXP62jxzaa5YgulWqWbai8xJW1hNdncT8ZpJblCrZ1yshZo5wCXRqdfxEiFJpStB lnHwri8VH5vo2BuHYH1FssyAeoQLeUoqQ4LeMnyJa/xrrSfdJJoWKHAzWMh3UI6D4kIx nyv5mUjSuXIXliTr8ZinNgVH1RyChXc9wOzA9iJU1+8tzRE1POtsN5Wvm0X8QqTAQz6W nTwUQaJiTMT7FEHEAwA6h0t79BczVt5JozeMbL5wK3zRqfA4mDWwZmUUEsfvGLqA4yfF CqkkevoGH2apF6y+5itFqCFuP6CTiJ85jufiA4X/foo8pfSAXABVLHeYFJTXDc5oTXgX vLMA== 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:sender:dkim-signature; bh=a4keVKlJNdo1j4qFYE//r1eDE0ShQaX85E5D5pockwg=; b=whFPGGQQZOnSQIIiXPJKEyPAgc5JgT2wZHUWpTKtkOfveVQ/HAYlp60Ynt/LeN54sK dmhiQgtMifOxCzndNz46f5pGpreFXMsJZDHOm1YWohhUX9f7QYuKRCSh0pjhx2uhkPuY vhBnpMJ0BVl6ProdGfoWxfiaSwmvVKrBwyClgO47HILIREAchVqjdo92vfiT/6+Uey8I Z9tywewbhsb+aDC8QM+j79N2wkMFdwAQFr8Gzn7gZOakuJCrnUuiMkFNzGkRlRQQ1mvX rzMU6EdXXSQm5l754Wilp3hLuCT3fuQLJiJxU7Y6i7j9mD5d0b3CDF+kcg1/LYa/NDzD t9hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WlxaKMdU; 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 v3-20020a17090ac90300b0023d0131c21asi584612pjt.66.2023.03.22.19.53.10; Wed, 22 Mar 2023 19:53:22 -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=@gmail.com header.s=20210112 header.b=WlxaKMdU; 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 S229666AbjCWCuK (ORCPT + 99 others); Wed, 22 Mar 2023 22:50:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229496AbjCWCuJ (ORCPT ); Wed, 22 Mar 2023 22:50:09 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DF9C1F5F7; Wed, 22 Mar 2023 19:50:08 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id lr16-20020a17090b4b9000b0023f187954acso598222pjb.2; Wed, 22 Mar 2023 19:50:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679539808; x=1682131808; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=a4keVKlJNdo1j4qFYE//r1eDE0ShQaX85E5D5pockwg=; b=WlxaKMdUWP6NF61Enqgn/cZbbwYafq7NXQi9eUxKsSptIGlgpjqSHnPEFHCeawJuk9 X5gAh/gM5rAO0kYp2M09Zezh7woZMiofK14yeFb84H1r0Xt2XmgGYhegj3yOOyh4nUFk 3AwLAdYWC70mD5rSB9KykDG9n2d/jVyW+az2+jNJCOq2PcxakBGU7ELXtFfHURtHCbP+ LFWAdIZJJjrDhXBRPmD4z4+eyb6JSGzMD2p/lp7au5mK7vpdtQxeZfVmRAQhLsMzeINe LrH9+sQvV325fqlDdaOmIs4N16W89Sp51neKpM/rAsJLGRyqWNsiCe9SesWq+CYHnaKw YoYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679539808; x=1682131808; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=a4keVKlJNdo1j4qFYE//r1eDE0ShQaX85E5D5pockwg=; b=RbEYUxx1ONA3RHHY2MD9lNQ5xW6MBN2kpXlGKX0D4kJsdfmvbm1C7ImpM1le4Og6d7 r9AwrSYtcOhqOVzkEdqzMWjFv98kFWOm1Z/01xNDkcZmqXjPV9y8e9sJSSviCmESneTe OrjSZq8wXJ4q0u7lQMQmvhSZuxDX4aXgLb3fonSIyV1TZ3mVrbKqz7zcEKbTfyit/ZXa SqBQkTdf4uWYkPv9Bbz9uM0FtjHtvu35loxbNqy5X1iRR0uLu3fLGKj6whU0NDJe4Rdt Xqxkkr/Q9M0cXb9ElkEcGckAqKV086aoUVxu2vE4v4KYkS4xFiwDT4FMF2DYJ+eDM7br 9Okg== X-Gm-Message-State: AO0yUKXPlj423v2dFS+sqMf7YIA+9X1UEsMNQz3gA7UxRDaurE8kYNuf hEX9BYRJ0w9AN4cgmG+5xsI= X-Received: by 2002:a17:902:da8b:b0:1a1:a273:1812 with SMTP id j11-20020a170902da8b00b001a1a2731812mr5420072plx.45.1679539807527; Wed, 22 Mar 2023 19:50:07 -0700 (PDT) Received: from bangji.hsd1.ca.comcast.net ([2601:647:6780:44b0:9957:6acc:41b5:fbeb]) by smtp.gmail.com with ESMTPSA id ji17-20020a170903325100b00199023c688esm11274738plb.26.2023.03.22.19.50.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 19:50:07 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ian Rogers , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org Subject: [PATCH] perf hist: Improve srcfile sort key performance (really) Date: Wed, 22 Mar 2023 19:50:05 -0700 Message-Id: <20230323025005.191239-1-namhyung@kernel.org> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no 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 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(). 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