Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1225431imm; Tue, 5 Jun 2018 10:59:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIMdp99OcnIVup4J7b+klLTP0PI7/shmhLr+3PCk7cM/HWkTcbHMHZiieHuxmIjHtqejpCJ X-Received: by 2002:a63:744c:: with SMTP id e12-v6mr21874495pgn.4.1528221559873; Tue, 05 Jun 2018 10:59:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528221559; cv=none; d=google.com; s=arc-20160816; b=1G92sUeLoaUdazuzdS8ajj6MCsLCMyTpAKtlyw0pXsvScDsagLX2/6VED2ljvwr+vF jtiXhfansDRXsLRAy6AhC6NfYu2xwrDUjgc67XlC9j5EnS48yez966NOZfZz5bJWlbJs VYpMtPZn+7im605GPGH7XBiWLvhaHxFf9MwNNjW/g8K5idf8DVu1/0/BhuyE0Q2zgxLD lN9glR9TIecTPgdFm3Bim4Ixzp8A4FwcuAs5RFszGC+AUUh+plSNtOmcGIZ2d6zZVQJh 0BIenfqNM98wRktcAUZQ/epL/+E1aOzKez6d0WYEyLreHf/mzsTiBzqzQ1tVm+ZVau7x XhKA== 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:dkim-signature:arc-authentication-results; bh=ZUAjZ9yb8gWc1VUnwc6rnDXH8Qw6RmDd4O3IyxOCX6c=; b=tZXlISNIyatkdL4z2OiRBoTxJMGp5jZSXMWMkiuwASf8JVdDm53eWLzjd7zNhyB6u3 I/zG2LZNPrKLH9tykaDIsQvJ9Tz4G4h8MqxLeh6mKLbygLh+uaMxRdQD0bl7Mxna2wEV dtPIUbN9eeP9W/AW9mWRgQlS0FfujqS3isBKP9/PNGIDT5kJ1kFjg+hOYAJMojNo3YgH wM6sgmQz5tvZmi9YDh5AL+I6Ha1pBWFTD8qat89zOpGyXzwsIu8kTLnQolSCRzYgAMCe TJltkhsafEaZo2cqeX+FDTrdqUzmKgcUGO6/dr+9Us173EQYRqIth1QlpgjLvpf6PFOA au0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f/8prlZ5; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m15-v6si39180775pgu.352.2018.06.05.10.59.05; Tue, 05 Jun 2018 10:59:19 -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; dkim=pass header.i=@kernel.org header.s=default header.b=f/8prlZ5; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752888AbeFERwY (ORCPT + 99 others); Tue, 5 Jun 2018 13:52:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:46422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752769AbeFERwQ (ORCPT ); Tue, 5 Jun 2018 13:52:16 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 12E592075B; Tue, 5 Jun 2018 17:52:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528221136; bh=n7W9mjOEUsnY4udhvBf5faEhb3HNdSwTAmCgef8eL6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f/8prlZ5yS8fCCOACWJwsYvc4sAdD91ahRGCzy8gphwrUdV8sjk8wP8/969LyMhjf dlV+vflGExw0FRHozUxQze3UByMNh1E8ZZ46tTigH2FiiWsw9avSour3i3xf/A63Kk C2TpZxgShf3fqBMNyQFbRI6k/6KeaWpeDNJ/A0b0= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , Adrian Hunter , David Ahern , Jiri Olsa , Namhyung Kim , Wang Nan Subject: [PATCH 32/46] perf hists: Introduce hist_entry__has_callchain() method Date: Tue, 5 Jun 2018 14:50:16 -0300 Message-Id: <20180605175030.32549-33-acme@kernel.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180605175030.32549-1-acme@kernel.org> References: <20180605175030.32549-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo We'll use this helper more frequently when reworking symbol_conf.use_callchain logic, where knowing if a hist_entry has callchains is the important bit, so make going from hist_entry to hists to evsel easier, compact. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: https://lkml.kernel.org/n/tip-qg8nadz3p7fuufzjx1z2orf0@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/hist.c | 3 +-- tools/perf/util/sort.h | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 496913eeed75..6173dd489f39 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -461,7 +461,6 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template, bool sample_self) { struct hist_entry_ops *ops = template->ops; - struct perf_evsel *evsel = hists_to_evsel(template->hists); size_t callchain_size = 0; struct hist_entry *he; int err = 0; @@ -473,7 +472,7 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template, * e.g.: 'perf record -e cycles,cache-misses/max-stack=10/', so lets * not waste space for that. */ - if (symbol_conf.use_callchain && evsel__has_callchain(evsel)) + if (hist_entry__has_callchains(template) && symbol_conf.use_callchain) callchain_size = sizeof(struct callchain_root); he = ops->new(callchain_size); diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h index f007a26d6f6d..1a046157bfef 100644 --- a/tools/perf/util/sort.h +++ b/tools/perf/util/sort.h @@ -151,6 +151,12 @@ struct hist_entry { struct callchain_root callchain[0]; /* must be last member */ }; +static __pure inline bool hist_entry__has_callchains(struct hist_entry *he) +{ + const struct perf_evsel *evsel = hists_to_evsel(he->hists); + return evsel__has_callchain(evsel); +} + static inline bool hist_entry__has_pairs(struct hist_entry *he) { return !list_empty(&he->pairs.node); -- 2.14.3