Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2697558pxa; Tue, 25 Aug 2020 00:08:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJBatYaS/SbHISa3MI3bx7tm7hOCMu4KXoVs0H9atCXLOp++4cVG6J9tK4i/mbg/miucy1 X-Received: by 2002:aa7:d6d6:: with SMTP id x22mr9281628edr.282.1598339281307; Tue, 25 Aug 2020 00:08:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598339281; cv=none; d=google.com; s=arc-20160816; b=yRFzYK0fNkSIRrzw2h5/Pg75hP/iiaXJsOSR9/mbNdgDg1Ruy4dVfIL4Cis9sH4qfT 8NCv+OKv6vrNmO3GVFatd7ZwSW+JZ2o0vwHCY7o9QBu/0Y73B6vRBJwp/bM9oMzrhcbj fI+BtWlP30vdza4WcaxiDAcgkOUlXWwrZFxK+hXwbpzCo2RzsxeVwqviRY4vXVvL6uVq E9gq+FJ12QgqSbp8PO2vfK7EEpno4Ekoi02Q6zfnDrMqPJUEaasBMbztzzTzXjyz/xnE JVe01tog0ikboWBwc8OqDmdWuBak0ZZK0fM7NkuUjNwsnPVenBMyqxmpHOhesU4ALNLg X+RQ== 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=6TRLIebX667cF4GZHsZ2w4hqcdDadsuSI1DvjwdWJZI=; b=BO2BqQc5SCS3HxFue+OvkZdGjCSkNr+/Qsp2xBm1Ay3DJT4nX8ep0WuP4HsiPdJuqd 3cFoEvBl8yHAa3RDQ96DE1szpsvZNIro+P2qKJugUUov46U8xbJOi+JqD0YvAAtsOUni nsi0uV3g2vcHQmJL1EpjIMtzTiNOBuyb/41vuYL8khotDj9qc4NynDo6S2UVSF1SsfwU zJPfFUne1pmgjoZ00/pyD3L4z2CKN49F6hzhbBQ9tP0KmyXUR5TP3RLoxSrFj3vyL0Yy HNO5cUVLCaDfT64xXByVC6Lfa+X1IEKkILYrjNwjh87YVPZJbLxHanCt0tVmFLRdIYZz 3ovQ== 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 q14si8153905edw.527.2020.08.25.00.07.38; Tue, 25 Aug 2020 00:08:01 -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 S1729306AbgHYHGv (ORCPT + 99 others); Tue, 25 Aug 2020 03:06:51 -0400 Received: from mga03.intel.com ([134.134.136.65]:4094 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729283AbgHYHGp (ORCPT ); Tue, 25 Aug 2020 03:06:45 -0400 IronPort-SDR: U+wygdyjwA3W9VvbkGWr7Tv9w8MhSyDchQsMhfnacVTiAB2bPgTAnjfn+RPPK7w+X3QOIKU5OJ 8vy3pu2gYDgA== X-IronPort-AV: E=McAfee;i="6000,8403,9723"; a="156050059" X-IronPort-AV: E=Sophos;i="5.76,351,1592895600"; d="scan'208";a="156050059" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2020 00:06:44 -0700 IronPort-SDR: RBrB9AVilkTmbZCFTa+/JpiKC4cm9x6Fg/pN88NmQiNti/uwI0jUH1bqUAd4l2qJYybfghjDZL PHaayIZqeAAA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,351,1592895600"; d="scan'208";a="322655044" Received: from kbl-ppc.sh.intel.com ([10.239.159.55]) by fmsmga004.fm.intel.com with ESMTP; 25 Aug 2020 00:06:40 -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 v4 2/7] perf util: Get the evsel_streams by evsel_idx Date: Tue, 25 Aug 2020 07:35:08 +0800 Message-Id: <20200824233513.16930-3-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200824233513.16930-1-yao.jin@linux.intel.com> References: <20200824233513.16930-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 --- 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 327a00c27ae2..7f538d1085ef 100644 --- a/tools/perf/util/stream.c +++ b/tools/perf/util/stream.c @@ -150,3 +150,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 a8a0172b4d13..705aa7cde3de 100644 --- a/tools/perf/util/stream.h +++ b/tools/perf/util/stream.h @@ -27,4 +27,7 @@ struct evsel_streams *perf_evlist__create_streams(struct evlist *evlist, int nr_streams_max, enum stream_type type); +struct evsel_streams *evsel_streams_get(struct evsel_streams *es, + int nr_evsel, int evsel_idx); + #endif /* __PERF_STREAM_H */ -- 2.17.1