Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp94681pxk; Fri, 11 Sep 2020 01:05:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXhENveeCJyN0QodPZSMAAjkhiA/ChtowdRWhmB1bAQimQm8FjkhjSHHnzTFkubWXR+xki X-Received: by 2002:aa7:d558:: with SMTP id u24mr782447edr.336.1599811538391; Fri, 11 Sep 2020 01:05:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599811538; cv=none; d=google.com; s=arc-20160816; b=usvbbFTkYIqR6giEcGckSbZo+xTh3+PSmCEs5JWYHh6fAaULl3kAEfF0HH1eQGQqaS s5ni1cmbSq8H6V5Zl2ut5ZEmlx8jh/S4zu/ysfdErnzQMgG7i2Ydw/TYrS54xLFVU1lJ sHXGW2p+HtXaLoIfXjZZRq8/gptNfDL0fJd5RYvQSks56q1VfhHZO/bkECQhhnODlxen bs6MSd9YDBSMFDMXvg5fwf8Ca8ANaae7BMSI6IIQ0czuxaWGijEDQNIls7jnk0NB3qJ/ gMrIcMYLcGgD6OK/T10z/CjDjuVbiN+q3fptZqMze5OgJFm2f1GK0spHbAN6i1vA+Ebi nUzQ== 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=CCeCPQSSm1SVzlDYZnf2RWiibzgtCIVzKW3HiJ6KyII=; b=oUB1uMlBIzLK77yMLz086okOLeI+ralMkwdmlcvTbA/Z+BtGumBA5a0gAAN7BZyFaI fCZ+HDupzkF49pAwyUVoVAHQmUBZry+kF5Ic//XqpX+a5i2053medRwG190+5j8AqzZ6 U8KIosLKTtY+3CMjvqw07Dfx+/pN1qec+tQyKno+jTIIapUyJl2WMTIdNc+4gGjchLw+ 5TcessW0xVDgmNgt05qrEIxmBcw+cYD8wXtESFH2kcnt/HZLPYRN1BgVeZky9ay52A30 wAYyYiX1MXxvKi7Wufnxcvvop8RNnVf9tpNMpaDeIebmWm8jZKzg6DNJAQoAzR4Hosir j3bA== 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 s18si799543eji.593.2020.09.11.01.05.15; Fri, 11 Sep 2020 01:05:38 -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 S1725814AbgIKIEh (ORCPT + 99 others); Fri, 11 Sep 2020 04:04:37 -0400 Received: from mga06.intel.com ([134.134.136.31]:7265 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725468AbgIKIEa (ORCPT ); Fri, 11 Sep 2020 04:04:30 -0400 IronPort-SDR: rKInKPeulxDphW+mS3X1pybJ3Um6UqMRpuBtXHPtFShD2F6CO+2V/5rihZ01u7jEzoboNtPOR8 qNSidFA7q00w== X-IronPort-AV: E=McAfee;i="6000,8403,9740"; a="220268197" X-IronPort-AV: E=Sophos;i="5.76,414,1592895600"; d="scan'208";a="220268197" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2020 01:04:29 -0700 IronPort-SDR: 2BUfJJamDDk0+68Z2ElGS2Jd+Sd3l/wY+eCFKxl8XzJeBye0EFiNpFInWbH6NiXzTsBvQ/Ufox 0FuqoNkZtNfQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,414,1592895600"; d="scan'208";a="342224817" Received: from kbl-ppc.sh.intel.com ([10.239.159.55]) by FMSMGA003.fm.intel.com with ESMTP; 11 Sep 2020 01:04:27 -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 v6 2/7] perf util: Get the evsel_streams by evsel_idx Date: Fri, 11 Sep 2020 16:03:48 +0800 Message-Id: <20200911080353.13359-3-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200911080353.13359-1-yao.jin@linux.intel.com> References: <20200911080353.13359-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 --- v6: - Rebase to perf/core 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