Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1399362ybh; Fri, 13 Mar 2020 00:12:34 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvwJJUPVJk59fQQaAd1i7rFud+VEC5eXJvXe4pRAhLJ+7+tKdipUUYKo7x+k15JFcF/MdDS X-Received: by 2002:aca:be09:: with SMTP id o9mr5917455oif.177.1584083554476; Fri, 13 Mar 2020 00:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584083554; cv=none; d=google.com; s=arc-20160816; b=CH6eYFKnzsZcO4IyQN+jmeD8euW1SdSB9eM9CLQeDUO2DLgun5foAjCZybkrevWKkH tMS8zm2/u7S90f1mlP4OO5zZVoANyNOU7Kzzs5fZukZFeT63sM1OawB7Ge95moFzOALv Wo7Hmcj/aJZzdOZrvyrShdK/8LAFKr3mHGI1pAKLK+o4qSHcjqv53N1lZq5AxIwNQ67t t4bVo/dVJF91mx8/zGhYk9G/lBpKT2du9Y98ZNoVN7Qiikq9s0TZZoQfR6dLGS4wHDLj fUWPtv0h7XQZ76w9ebIeS8opsWhsH5zUGUEysljGafWrSejdDwLZalwUoDn4vTjog0m5 +qZQ== 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; bh=Dnj/bbhqBbFV1hqejYfeT6vJkWRbrZZkXsvi0m5+xvM=; b=WEHETJG8kc3MsT3UK9az2dtd90kHlT7qVAzgi4V5YJ1PEZMBK90PEoASo4zFK+US9i ZRHrINWwOe7OLBbsOgbYgKEP9kEW52vtPsEQT3TfiwFJoynMMyfsJWmFfnw8JEdI4Sgy aotDOVu+PSDjZdMs1z9MARjhtGvkV6lM+r/OwzF1XUsINj7jkloZaV2f5ZhryBmw4vqg B3u+VhqISMNY4kYKcsjRl+8gZts1fZpdSLp1aNgsN5Ae3EM/Wp6q24t4XwYffUvW+Hf4 YX6WkX2gdqqmln0mfjbnYd3dYCPly0YfeLSPFhnxj5pKD+BhqzqTVf+TkK0i5xtN4T+A WUUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id d125si3589575oia.86.2020.03.13.00.12.21; Fri, 13 Mar 2020 00:12:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726593AbgCMHMB (ORCPT + 99 others); Fri, 13 Mar 2020 03:12:01 -0400 Received: from mga02.intel.com ([134.134.136.20]:7782 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726535AbgCMHL6 (ORCPT ); Fri, 13 Mar 2020 03:11:58 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2020 00:11:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,547,1574150400"; d="scan'208";a="266642225" Received: from kbl.sh.intel.com ([10.239.159.24]) by fmsmga004.fm.intel.com with ESMTP; 13 Mar 2020 00:11:56 -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 v2 03/14] perf util: Return per-event callchain streams Date: Fri, 13 Mar 2020 15:11:07 +0800 Message-Id: <20200313071118.11983-4-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200313071118.11983-1-yao.jin@linux.intel.com> References: <20200313071118.11983-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 a 'struct callchain_streams' array and each array entry contains per-event callchain streams. This patch returns the pointer of per-event callchain streams according to the evsel_idx. Signed-off-by: Jin Yao --- tools/perf/util/callchain.c | 12 ++++++++++++ tools/perf/util/callchain.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index 0c028caaeb19..bf66f33debd4 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c @@ -1721,3 +1721,15 @@ struct callchain_streams *callchain_evsel_streams_create(struct evlist *evlist, *nr_evsel_streams = nr_evsel; return callchain_streams; } + +struct callchain_streams *callchain_evsel_streams_get(struct callchain_streams *cs, + int nr_streams_max, + int evsel_idx) +{ + for (int i = 0; i < nr_streams_max; i++) { + if (cs[i].evsel_idx == evsel_idx) + return &cs[i]; + } + + return NULL; +} diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h index 5852990cdf60..4e881361e154 100644 --- a/tools/perf/util/callchain.h +++ b/tools/perf/util/callchain.h @@ -305,4 +305,8 @@ struct callchain_streams *callchain_evsel_streams_create(struct evlist *evlist, int nr_streams_max, int *nr_evsel_streams); +struct callchain_streams *callchain_evsel_streams_get(struct callchain_streams *cs, + int nr_streams_max, + int evsel_idx); + #endif /* __PERF_CALLCHAIN_H */ -- 2.17.1