Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp1639358ybs; Mon, 25 May 2020 23:13:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1/U/32nDI05+0Q4+P19RNZ6B8bt++E01ggGWX7B/DOWIodpx63TOB2RW0fPYQJzPVStUu X-Received: by 2002:a50:baa3:: with SMTP id x32mr17770506ede.251.1590473619714; Mon, 25 May 2020 23:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590473619; cv=none; d=google.com; s=arc-20160816; b=x59zKMfSwtCxOmfgrW5Zhzas4DmwARgRQRkYqp8V5fwEiyLr1TZIWDl+zlBURsG+jk 5YRyxXjZoey3uOOXvU2D/qEkR1Jc/4hETJKFd1yBxI9tICK+knX0dztGVwYkCJEAqAUI vnKI6AGzv478LLuNmEZCNjeC2joWIBLFZKTYJSX8EXqDYkmkiuLl0Qzy2qCS+vjIdDNR L/GaZYMg1TD0zixEoW4gJvZVUyJZYup4cYsLZDqRoJ/zmLHHVfMD8MTceV/apx36uXkR PrOLnNheTcuU9dKp1Oz1+2OX+cQ5zWM1IWkZOx9G90V3Errx/EhbAzaDshl5Pw1iASez SFhg== 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=emrI/3DtQ9YztVCMwl3jjgJHikdTLUokZptCAfR4vVg=; b=MsJpkL+74JjbHbpbiodHakula9K5TkZi8KCqYbuUYnuJwa4b4kQphW2e1qrlCNZfsP KFGV2KJiYlKNiTqQsE273YHusM2i/YgGwUNxOPY+R2hCgzPhQ2J2l2ynGBSdxezyXlUE O1DdAXZrMEGkEMIYfKvIqRytszcb9Vqqti3zLl6LpLpbCEpcPlOcIJnzKn5xWvRUiy1Y gILrmH6ahf0ANlaB1EKZJ/EIG57i83I20ydNp0sGacTEu/FaHCKxXoVkYHWWOAVu7NsD SeUc4M208ywA7ajN8eCmGLAgDBBXNu9bE/hGrN4oUhvM/gVhXbWBlHeEp+4TBUuPn5V/ akxA== 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 v28si209437edd.233.2020.05.25.23.13.17; Mon, 25 May 2020 23:13:39 -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 S1726746AbgEZGLc (ORCPT + 99 others); Tue, 26 May 2020 02:11:32 -0400 Received: from mga06.intel.com ([134.134.136.31]:16985 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726207AbgEZGLa (ORCPT ); Tue, 26 May 2020 02:11:30 -0400 IronPort-SDR: bLpxva0z5o6wGxfvo0f7MTeVaAb53dd+/o8nTxL7MJhD0U6IWA3ymXX9w4qbKPD9buBz1qNnCh LRNGFdvWw3wA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2020 23:11:30 -0700 IronPort-SDR: ggPVnra1YiL9FcDj7MM/MZcBJEkLBE22FRtnfbV3asmP6twvWgzyi5LePll5j87WnnifYy9L+M 5jJtE3ClCWOw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,436,1583222400"; d="scan'208";a="291068663" Received: from kbl-ppc.sh.intel.com ([10.239.159.118]) by fmsmga004.fm.intel.com with ESMTP; 25 May 2020 23:11:28 -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, 26 May 2020 14:09:15 +0800 Message-Id: <20200526060920.26490-3-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200526060920.26490-1-yao.jin@linux.intel.com> References: <20200526060920.26490-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 --- 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