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 D5529C25B07 for ; Wed, 10 Aug 2022 15:56:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231858AbiHJP4R (ORCPT ); Wed, 10 Aug 2022 11:56:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233052AbiHJPz4 (ORCPT ); Wed, 10 Aug 2022 11:55:56 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFD408FD5E; Wed, 10 Aug 2022 08:54:03 -0700 (PDT) Received: from fraeml708-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4M2vYK0Cj6z67bMc; Wed, 10 Aug 2022 23:51:01 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml708-chm.china.huawei.com (10.206.15.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 10 Aug 2022 17:53:46 +0200 Received: from [10.48.150.13] (10.48.150.13) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 10 Aug 2022 16:53:43 +0100 Message-ID: <3f0579b3-2d58-c8c6-3e3f-ff966ad09bad@huawei.com> Date: Wed, 10 Aug 2022 16:53:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v4 07/17] perf jevents: Sort json files entries To: Ian Rogers CC: Will Deacon , James Clark , "Mike Leach" , Leo Yan , Peter Zijlstra , Ingo Molnar , "Arnaldo Carvalho de Melo" , Mark Rutland , "Alexander Shishkin" , Jiri Olsa , Namhyung Kim , Andi Kleen , "Zhengjun Xing" , Ravi Bangoria , Kan Liang , Adrian Hunter , , , , Stephane Eranian References: <20220804221816.1802790-1-irogers@google.com> <20220804221816.1802790-8-irogers@google.com> From: John Garry In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.48.150.13] X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/08/2022 15:23, Ian Rogers wrote: >> We sort the attributes of the events alphabetically by attribute name, >> right? Is there any advantage in this? Do we need it for later? > > The sort order is given by the tuple: > (not j.desc is None, fix_none(j.topic), fix_none(j.name), > fix_none(j.pmu), fix_none(j.metric_name)) > which is putting events with descriptions and topics before those > without, then sorting by name, then pmu and finally metric_name. The > advantage is that when we qsort alias events: > https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/util/pmu.c?h=perf/core#n1759 > the events are already in the sorted format, which should make the > code faster - ok, so can you mention that in the commit message? Just writing that you want to replicate cmp_sevent from pmu.c does not tell us this clearly. > it still has to qsort the sysfs events. thanks, John