Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1226015imm; Tue, 5 Jun 2018 10:59:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLoBd+4Su5szwPU2OslZ3lUC1qFN5PeM+v/YF1xdw6/Kj8wJNJ99MK2VTSg8mLF+PM3FYpA X-Received: by 2002:a17:902:b416:: with SMTP id x22-v6mr27776425plr.267.1528221598246; Tue, 05 Jun 2018 10:59:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528221598; cv=none; d=google.com; s=arc-20160816; b=RgowIjFTtQuwVdwRELYeWkEfaYsbRVIL52P1NCxXzoZjmzi2McRqMLFSacOuaxLiBO W8u13SkokTn5vxZARi2wbC/lk+Z5xkAxnYTOuY/tVRbUMOZ2XUW8tNz3AGeXL1N+GEwD CWK/KDEADdDlQgH2vlT6WSd6g1Cs5ry06mOKfjQ2tF7t6o/HjcvQmC+91b4YVebHA5hM ZQoRGguAlvI71K54mLZJz+iXCgtRnCx1t4cJeeEPdJHAikcb7xTmDVIjoQQB9z+tr4OO rJ8Wkjek55rJ9LnhJCScAZSrMSJJ8TupwAGVy8h88Sbahiqy4BQsJgRes60j2JFwXhWB WDZw== 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=6umJIIPCI4wV6zO2ZLFnHk6bc6PyLs+nY8gedXkXiK4=; b=wXpzDZydEYIj62bH4+BA92xOLlStptrCbMXT11qp0cmX/5IOmHGYaUfCrvizQ2BXAf QSN7SbgTtL8hOR3BjlvqhZ7uE1WRnq/agV3QQZ9fIrCH6ndKkbnPwqiR4aM6OBBDNApN 6u5llynAu+x+jMxQaV+MNu0C3rs9H5JrkwEYiysutuBffLJAa1Qbu4o/zci0wjHQpSYH TCxuxxtnM6zLrnvVTPp4XiTM6DC0r88jVDeEyvxBjLTVLVp0yd/LBO8d1wAO/7LsT+IR l7dGmu7XA1ujzRP5kiS+ahY/XV8aLtjU/smKOf3Xcr7K4rCcf9cBB3a1cW4UqQbfp95d H6vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PY++JJD2; 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 b59-v6si49534426plc.335.2018.06.05.10.59.44; Tue, 05 Jun 2018 10:59:58 -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=PY++JJD2; 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 S1753206AbeFER64 (ORCPT + 99 others); Tue, 5 Jun 2018 13:58:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:46406 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751988AbeFERwO (ORCPT ); Tue, 5 Jun 2018 13:52:14 -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 258772077B; Tue, 5 Jun 2018 17:52:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528221133; bh=CexoAU08/WfR0NWWemv9P/lPQ1Javy3u7NMqcGO9Jqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PY++JJD28x+gUkoUCYPpoltTJUu1EpU7LEiFSQ5Mesn8dSyon2sCMVPg+FUYvlU9M usTx81lD9wRatoc0NXwldtJNd/ZdpNVG5IB2a7GsIwPw/hVSPNbHQBUJUN/zkKcVhB cNzhlXnEoEn4H594snzHDeCx+lxYhvAfmLcZlnQU= 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 31/46] perf hists: Do not allocate space for callchains for evsels without them Date: Tue, 5 Jun 2018 14:50:15 -0300 Message-Id: <20180605175030.32549-32-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 This is another case were a big switch for callchains, symbol_conf.use_callchain, is inconvenient, as we can have both events with and without callchains, no point in checking a single switch to decide to allocate space for callchains. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: https://lkml.kernel.org/n/tip-62q64m7x7kqpb4g7boqc2nde@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/hist.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 34864c87cd3c..496913eeed75 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -461,14 +461,19 @@ 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; if (!ops) ops = template->ops = &default_ops; - - if (symbol_conf.use_callchain) + /* + * It is possible to have callchains for some evsels but not for others, + * 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)) callchain_size = sizeof(struct callchain_root); he = ops->new(callchain_size); -- 2.14.3