From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752037AbcGAFOv (ORCPT ); Fri, 1 Jul 2016 01:14:51 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35233 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751193AbcGAFOd (ORCPT ); Fri, 1 Jul 2016 01:14:33 -0400 From: Chris Phlipot To: acme@kernel.org, peterz@infradead.org, mingo@redhat.com Cc: linux-kernel@vger.kernel.org, Chris Phlipot Subject: [PATCH 3/4] perf tool: Fix build when sysconf doesn't support cache line size Date: Thu, 30 Jun 2016 22:12:34 -0700 Message-Id: <1467349955-1135-4-git-send-email-cphlipot0@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467349955-1135-1-git-send-email-cphlipot0@gmail.com> References: <1467349955-1135-1-git-send-email-cphlipot0@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Enable perf to build on libc implementations where sysconf() doesn't support _SC_LEVEL1_DCACHE_LINESIZE as a parameter. For example, the Bionic implementation does not support this as a paremter. Older versions of Bionic will throw an error when this is passed in as a parameter, and more recent versions will just return 0 as the cache line size. Signed-off-by: Chris Phlipot --- tools/perf/perf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 8f21922..113ca5b 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c @@ -509,7 +509,11 @@ int main(int argc, const char **argv) /* The page_size is placed in util object. */ page_size = sysconf(_SC_PAGE_SIZE); +#ifdef _SC_LEVEL1_DCACHE_LINESIZE cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE); +#else + cacheline_size = 0; +#endif if (sysctl__read_int("kernel/perf_event_max_stack", &value) == 0) sysctl_perf_event_max_stack = value; -- 2.7.4