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 A3946C433F5 for ; Sat, 22 Jan 2022 04:58:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232939AbiAVE6Y (ORCPT ); Fri, 21 Jan 2022 23:58:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232946AbiAVE6V (ORCPT ); Fri, 21 Jan 2022 23:58:21 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 050BEC06173B for ; Fri, 21 Jan 2022 20:58:21 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id 4-20020a250304000000b006137f4a9920so22617359ybd.6 for ; Fri, 21 Jan 2022 20:58:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=aNuBZ0ZpaoD1AkR8uBb0XNwqugpn9QfU7CzwmAlFWuQ=; b=mPEzAeW9MHKoUIiyXGvyAwu+QOQwXqXUloUWAzzKa2I/Tk/zDk6UtdakN5ozYpJNO8 4Orfoc8RkiJjMfB/tiwxo2UV6heXCmAHQIpK+23ucKA+0XmAiV3Mv0Oh8etQyfBfOBBW vzRO1roT/tY2uFITgmZbmNMJFUVLqNtVPfgb9BCo3YnBYXfAt9mvKbrHknZwklmu5E7K qN1EpvfvxIymXukW4t+XVg+k4tk1JijGohqcZsidP1J8TS+X/nhvsQDm69Gi9oN87gYT hBM7+531+CmosJxG7mWrQPRVqfxGfZpP7DEgfpIyNbV8h7kig4SUdZdRhMWMxQGgGvAp WQBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=aNuBZ0ZpaoD1AkR8uBb0XNwqugpn9QfU7CzwmAlFWuQ=; b=sA7y4EQqoIQ7F56IuSP2fKnwAz53pSNEfUr/JccMmej7r6I9J9azlNkVx14Ysn0cnE G1LZ/XNmlU8vvR2o6R0s0zqyxptNdtxSOHWRhk1o6V/p2RFEaCxu/MwD0sE4VsYrxLbA P49AKQmAifl6xmg+LUFTknY9YPTKzlOsYsSAIne+6oxlOydpIWRS1TcUXYlrCpIn3rrH k4UCXinBx1tBgYvXs8jYshnRbfv4m7teAupF0NqG5Ol70KmGtXTHxp9MhiFnx832pzyl e+KMqV847XFlwTMCLNotPad7M5ooc0jeFSJsLblliRuJmwWAlVM8GVkhF0U5/5MNf7D6 G3Fg== X-Gm-Message-State: AOAM5339m0cmKfvHeVEoKBwG7GRPoiRBfhlcPt7oVFUfXpmrvOozRP+g gXQdHdTbQ7m0vno7SbrNSms4OFucd9l4 X-Google-Smtp-Source: ABdhPJw1NzzeJ/QJ8gyxsnNeWJvtCDed/vCdUahcTcTwM0lyHcDWrTca5XzdzlaqbcpcK1zMRjP2VEPJH1Ty X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:6125:f911:aa9a:59ee]) (user=irogers job=sendgmr) by 2002:a25:9c45:: with SMTP id x5mr10714898ybo.91.1642827500208; Fri, 21 Jan 2022 20:58:20 -0800 (PST) Date: Fri, 21 Jan 2022 20:58:09 -0800 In-Reply-To: <20220122045811.3402706-1-irogers@google.com> Message-Id: <20220122045811.3402706-2-irogers@google.com> Mime-Version: 1.0 References: <20220122045811.3402706-1-irogers@google.com> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog Subject: [PATCH 1/3] perf python: Fix cpu_map__item building From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Darren Hart , Davidlohr Bueso , "=?UTF-8?q?Andr=C3=A9=20Almeida?=" , James Clark , John Garry , Riccardo Mancini , Yury Norov , Andy Shevchenko , Andrew Morton , Jin Yao , Adrian Hunter , Leo Yan , Andi Kleen , Thomas Richter , Kan Liang , Madhavan Srinivasan , Shunsuke Nakamura , Song Liu , Masami Hiramatsu , Steven Rostedt , Miaoqian Lin , Stephen Brennan , Kajol Jain , Alexey Bayduraev , German Gomez , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Dumazet , Dmitry Vyukov Cc: eranian@google.com, Ian Rogers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org Value should be built as an integer. Switch some uses of perf_cpu_map to use the library API. Fixes: 6d18804b963b ("perf cpumap: Give CPUs their own type") Signed-off-by: Ian Rogers --- tools/perf/util/python.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index f3e5131f183c..52d8995cfd73 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -638,17 +638,17 @@ static Py_ssize_t pyrf_cpu_map__length(PyObject *obj) { struct pyrf_cpu_map *pcpus = (void *)obj; - return pcpus->cpus->nr; + return perf_cpu_map__nr(pcpus->cpus); } static PyObject *pyrf_cpu_map__item(PyObject *obj, Py_ssize_t i) { struct pyrf_cpu_map *pcpus = (void *)obj; - if (i >= pcpus->cpus->nr) + if (i >= perf_cpu_map__nr(pcpus->cpus)) return NULL; - return Py_BuildValue("i", pcpus->cpus->map[i]); + return Py_BuildValue("i", perf_cpu_map__cpu(pcpus->cpus, i).cpu); } static PySequenceMethods pyrf_cpu_map__sequence_methods = { -- 2.35.0.rc0.227.g00780c9af4-goog