Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2955360pxk; Sun, 6 Sep 2020 21:18:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhyFOnqrKvdOCzsapOe+p2s3WxKNsF6dvCFIY0rByKx+t/OHamxGJ1fhVYO+BqAMyEnXlU X-Received: by 2002:a17:906:1c5b:: with SMTP id l27mr20067416ejg.283.1599452293904; Sun, 06 Sep 2020 21:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599452293; cv=none; d=google.com; s=arc-20160816; b=j7UWgU5L0cK+ByYlfhNQ0NcxTtAX2moQiNf7dS5dIh5G7dYp4Ewld1xYtb86XoSIaC Ko3U+EEC7GJLDFKkVfmbRfB4GDPyLz1+Vp7Rk8iAbI1KHuTR1HFt32ZFCUkFEx+vcLX3 bECYodrAQ4fzqkJ+AIoLhFw9YWGcz5Twfv1yCOzCIqdJUTf0bTfNvDToZlBbAlT70cym vSRmac2qiCm9/6zb1w3bfbijTq8WQ2Ju01MRRS0XUdk22SfrnLFH9qMevy/IoJujnQvd p9yFIW/hoY8KzKX0T8wHEaBJ7URlyAK9GYC0Mg/G2ZmM4C9MncqLXXpdei0hoKSWIrau HDzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=yC6btWviqW5S42YXK09xlloCBDHYrCNqxHMKfiGux5M=; b=fepjTv1obX0hwR6gzS/cuAx/ameT1ba23wGt5yyKAKKp/l7g+gyeZHYj0F8PZF3vIJ h3PWzcakTLNPv9gbozjV3xchS2mISfHfqfC7lnWiG9K9tiqbfMcZNegPZfArOj9YNIAx QROFA1LnvRKKGfqSC68jSYNiJfX9DCq8ZB57m6tyuINEReuR3pygObm6AYjF5rVYKpuK fOe0WCwj8lETYRiFJRDsdda7ZVsP3w5ZvuYuVzsBVW8VDrcERaUuos3KqTX9YBzXFNcV ytQaGrmEO9Kz0Bj+iqrqy2IJfOd4IBzsOxZTJ95w6nHlgpTC8GcimV0nUkl00EEuHviv 9Sjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c8si8720865ejx.605.2020.09.06.21.17.35; Sun, 06 Sep 2020 21:18:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726352AbgIGEQt (ORCPT + 99 others); Mon, 7 Sep 2020 00:16:49 -0400 Received: from mga14.intel.com ([192.55.52.115]:58716 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726259AbgIGEQs (ORCPT ); Mon, 7 Sep 2020 00:16:48 -0400 IronPort-SDR: RTk6AYm8P8ncqRnDqXPLShHa1EplN7taWCaOPMz+ln7Cln6aEZ9VU1fBip2vuRlYEjMVblbb+I lpgLnra+85Ag== X-IronPort-AV: E=McAfee;i="6000,8403,9736"; a="157215550" X-IronPort-AV: E=Sophos;i="5.76,400,1592895600"; d="scan'208";a="157215550" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2020 21:16:48 -0700 IronPort-SDR: Qcq4kksz5s7aVAj8VjOAc7gjv8FR0hTulaQKx/9Wu7xTsv2ZA7q9Z6BzNNdmaYlUvsXVL2+fgf eg3JatYWm3iQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,400,1592895600"; d="scan'208";a="406709923" Received: from kbl-ppc.sh.intel.com ([10.239.159.55]) by fmsmga001.fm.intel.com with ESMTP; 06 Sep 2020 21:16:45 -0700 From: Jin Yao To: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com Cc: Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com, Jin Yao Subject: [PATCH v5 2/7] perf util: Get the evsel_streams by evsel_idx Date: Mon, 7 Sep 2020 12:16:01 +0800 Message-Id: <20200907041606.14500-3-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200907041606.14500-1-yao.jin@linux.intel.com> References: <20200907041606.14500-1-yao.jin@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In previous patch, we have created evsel_streams array This patch returns the specified evsel_streams according to the evsel_idx. Signed-off-by: Jin Yao --- v5: - Rebase to perf/core v4: - Rename the patch from 'perf util: Return per-event callchain streams' to 'perf util: Get the evsel_streams by evsel_idx' tools/perf/util/stream.c | 11 +++++++++++ tools/perf/util/stream.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/tools/perf/util/stream.c b/tools/perf/util/stream.c index 015c1d07ce3a..7882a7f05d97 100644 --- a/tools/perf/util/stream.c +++ b/tools/perf/util/stream.c @@ -146,3 +146,14 @@ struct evsel_streams *perf_evlist__create_streams(struct evlist *evlist, return es; } + +struct evsel_streams *evsel_streams_get(struct evsel_streams *es, + int nr_evsel, int evsel_idx) +{ + for (int i = 0; i < nr_evsel; i++) { + if (es[i].evsel_idx == evsel_idx) + return &es[i]; + } + + return NULL; +} diff --git a/tools/perf/util/stream.h b/tools/perf/util/stream.h index c6844c5787cb..66f61d954eef 100644 --- a/tools/perf/util/stream.h +++ b/tools/perf/util/stream.h @@ -20,4 +20,7 @@ struct evlist; struct evsel_streams *perf_evlist__create_streams(struct evlist *evlist, int nr_streams_max); +struct evsel_streams *evsel_streams_get(struct evsel_streams *es, + int nr_evsel, int evsel_idx); + #endif /* __PERF_STREAM_H */ -- 2.17.1