From patchwork Fri Aug 7 10:23:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 52021 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 7A17D22EAD for ; Fri, 7 Aug 2015 10:26:18 +0000 (UTC) Received: by wijp15 with SMTP id p15sf16119670wij.3 for ; Fri, 07 Aug 2015 03:26:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=CngaQpimSJLuviccxHMcHTg7ROFJ6zbOW7kzOAI3dac=; b=Ta+kx1dlvSD5x5c5t2rdKH8gwtl2z+xisrue2TfLs9gZIMZvoNscweWE4j84WbGBsW B52EXfk5k12fa23BUI2l0uqUynTTg5BCiJKpqbddINGhAA5qZ0scraZX3+C6hCIAWFJa +/dF/U2XFS2iYaMFsAOUW5WQydzQF21cm54fj42Xa0A9j51K07g2DoO7YCcAIOmfi+3n 4OR9lgY2fUHmFfnMUbK6Aa8c7rYfCuVB7QBHsec2MmNsdZWwpzIOTmXoTFYR4gI6XWsb SvTi+fHhsWPSsXFz8kPBenSeYwqrTA4yxR+RSUEfIS2YyM42Oe6yapfuaMnTOYiUSOZx TxpQ== X-Gm-Message-State: ALoCoQnfX0gk/gxw72Rayr8Ljneo/rp+gDdz43ttVTitpvDf8yzU9PqhfHYv3fm8OZCY65bCQG3T X-Received: by 10.152.25.233 with SMTP id f9mr1906237lag.5.1438943177770; Fri, 07 Aug 2015 03:26:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.200 with SMTP id u8ls428357lau.55.gmail; Fri, 07 Aug 2015 03:26:17 -0700 (PDT) X-Received: by 10.152.23.38 with SMTP id j6mr6628108laf.47.1438943177610; Fri, 07 Aug 2015 03:26:17 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id lh6si7155405lbc.49.2015.08.07.03.26.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Aug 2015 03:26:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by labjt7 with SMTP id jt7so47450193lab.0 for ; Fri, 07 Aug 2015 03:26:17 -0700 (PDT) X-Received: by 10.152.26.163 with SMTP id m3mr6777466lag.86.1438943177461; Fri, 07 Aug 2015 03:26:17 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp272158lba; Fri, 7 Aug 2015 03:26:16 -0700 (PDT) X-Received: by 10.107.128.147 with SMTP id k19mr7683029ioi.133.1438943175393; Fri, 07 Aug 2015 03:26:15 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j66si7833950ioi.48.2015.08.07.03.26.14; Fri, 07 Aug 2015 03:26:15 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 2CF41621CB; Fri, 7 Aug 2015 10:26:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id D63BC61F70; Fri, 7 Aug 2015 10:26:07 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 6814E62110; Fri, 7 Aug 2015 10:26:05 +0000 (UTC) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by lists.linaro.org (Postfix) with ESMTPS id 2003D61E1D for ; Fri, 7 Aug 2015 10:26:04 +0000 (UTC) Received: by labkb6 with SMTP id kb6so43290076lab.2 for ; Fri, 07 Aug 2015 03:26:02 -0700 (PDT) X-Received: by 10.152.23.4 with SMTP id i4mr6770110laf.51.1438943162667; Fri, 07 Aug 2015 03:26:02 -0700 (PDT) Received: from localhost (c-b03670d5.07-21-73746f28.cust.bredbandsbolaget.se. [213.112.54.176]) by smtp.gmail.com with ESMTPSA id qs1sm2062175lbb.35.2015.08.07.03.26.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Aug 2015 03:26:01 -0700 (PDT) From: Anders Roxell To: lng-odp@lists.linaro.org Date: Fri, 7 Aug 2015 12:23:44 +0200 Message-Id: <1438943024-26909-1-git-send-email-anders.roxell@linaro.org> X-Mailer: git-send-email 2.1.4 X-Topics: patch Subject: [lng-odp] [PATCHv2] linux-generic: Makefile.am: fix basename conflicts X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: anders.roxell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Building generated this warning message: "copying selected object files to avoid basename conflicts..." Reported-by: Mile Holmes Signed-off-by: Anders Roxell --- So resending this patch with minor changes. * reduce the long filename with 6 chars (we like short names) =) * Had to fix another random bug [1] before this patch could be applied. Note: this patch will not apply without [1] applied first. Cheers, Anders [1] https://lists.linaro.org/pipermail/lng-odp/2015-August/014015.html Cheers, Anders platform/linux-generic/Makefile.am | 8 ++--- platform/linux-generic/arch/linux/odp_time.c | 38 ---------------------- .../linux-generic/arch/linux/odp_time_cycles.c | 38 ++++++++++++++++++++++ platform/linux-generic/arch/mips64/odp_time.c | 21 ------------ .../linux-generic/arch/mips64/odp_time_cycles.c | 21 ++++++++++++ platform/linux-generic/arch/x86/odp_time.c | 23 ------------- platform/linux-generic/arch/x86/odp_time_cycles.c | 23 +++++++++++++ 7 files changed, 86 insertions(+), 86 deletions(-) delete mode 100644 platform/linux-generic/arch/linux/odp_time.c create mode 100644 platform/linux-generic/arch/linux/odp_time_cycles.c delete mode 100644 platform/linux-generic/arch/mips64/odp_time.c create mode 100644 platform/linux-generic/arch/mips64/odp_time_cycles.c delete mode 100644 platform/linux-generic/arch/x86/odp_time.c create mode 100644 platform/linux-generic/arch/x86/odp_time_cycles.c diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index c0f7220..ed4add5 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -160,9 +160,9 @@ __LIB__libodp_la_SOURCES = \ odp_timer.c \ odp_version.c \ odp_weak.c \ - arch/@ARCH@/odp_time.c + arch/@ARCH@/odp_time_cycles.c EXTRA_DIST = \ - arch/linux/odp_time.c \ - arch/mips64/odp_time.c \ - arch/x86/odp_time.c + arch/linux/odp_time_cycles.c \ + arch/mips64/odp_time_cycles.c \ + arch/x86/odp_time_cycles.c diff --git a/platform/linux-generic/arch/linux/odp_time.c b/platform/linux-generic/arch/linux/odp_time.c deleted file mode 100644 index 4dc0764..0000000 --- a/platform/linux-generic/arch/linux/odp_time.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#define _POSIX_C_SOURCE 199309L - -#include -#include - -#include -#include -#include -#include - -#define GIGA 1000000000 - -uint64_t odp_time_cycles(void) -{ - struct timespec time; - uint64_t sec, ns, hz, cycles; - int ret; - - ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time); - - if (ret != 0) - ODP_ABORT("clock_gettime failed\n"); - - hz = odp_sys_cpu_hz(); - sec = (uint64_t) time.tv_sec; - ns = (uint64_t) time.tv_nsec; - - cycles = sec * hz; - cycles += (ns * hz) / GIGA; - - return cycles; -} diff --git a/platform/linux-generic/arch/linux/odp_time_cycles.c b/platform/linux-generic/arch/linux/odp_time_cycles.c new file mode 100644 index 0000000..4dc0764 --- /dev/null +++ b/platform/linux-generic/arch/linux/odp_time_cycles.c @@ -0,0 +1,38 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#define _POSIX_C_SOURCE 199309L + +#include +#include + +#include +#include +#include +#include + +#define GIGA 1000000000 + +uint64_t odp_time_cycles(void) +{ + struct timespec time; + uint64_t sec, ns, hz, cycles; + int ret; + + ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time); + + if (ret != 0) + ODP_ABORT("clock_gettime failed\n"); + + hz = odp_sys_cpu_hz(); + sec = (uint64_t) time.tv_sec; + ns = (uint64_t) time.tv_nsec; + + cycles = sec * hz; + cycles += (ns * hz) / GIGA; + + return cycles; +} diff --git a/platform/linux-generic/arch/mips64/odp_time.c b/platform/linux-generic/arch/mips64/odp_time.c deleted file mode 100644 index 4fb790b..0000000 --- a/platform/linux-generic/arch/mips64/odp_time.c +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#include -#include - -uint64_t odp_time_cycles(void) -{ - #define CVMX_TMP_STR(x) CVMX_TMP_STR2(x) - #define CVMX_TMP_STR2(x) #x - uint64_t cycle; - - __asm__ __volatile__ ("rdhwr %[rt],$" CVMX_TMP_STR(31) : - [rt] "=d" (cycle) : : "memory"); - - return cycle; -} diff --git a/platform/linux-generic/arch/mips64/odp_time_cycles.c b/platform/linux-generic/arch/mips64/odp_time_cycles.c new file mode 100644 index 0000000..4fb790b --- /dev/null +++ b/platform/linux-generic/arch/mips64/odp_time_cycles.c @@ -0,0 +1,21 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include + +uint64_t odp_time_cycles(void) +{ + #define CVMX_TMP_STR(x) CVMX_TMP_STR2(x) + #define CVMX_TMP_STR2(x) #x + uint64_t cycle; + + __asm__ __volatile__ ("rdhwr %[rt],$" CVMX_TMP_STR(31) : + [rt] "=d" (cycle) : : "memory"); + + return cycle; +} diff --git a/platform/linux-generic/arch/x86/odp_time.c b/platform/linux-generic/arch/x86/odp_time.c deleted file mode 100644 index a111561..0000000 --- a/platform/linux-generic/arch/x86/odp_time.c +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ -#include - -uint64_t odp_time_cycles(void) -{ - union { - uint64_t tsc_64; - struct { - uint32_t lo_32; - uint32_t hi_32; - }; - } tsc; - - __asm__ __volatile__ ("rdtsc" : - "=a" (tsc.lo_32), - "=d" (tsc.hi_32) : : "memory"); - - return tsc.tsc_64; -} diff --git a/platform/linux-generic/arch/x86/odp_time_cycles.c b/platform/linux-generic/arch/x86/odp_time_cycles.c new file mode 100644 index 0000000..a111561 --- /dev/null +++ b/platform/linux-generic/arch/x86/odp_time_cycles.c @@ -0,0 +1,23 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ +#include + +uint64_t odp_time_cycles(void) +{ + union { + uint64_t tsc_64; + struct { + uint32_t lo_32; + uint32_t hi_32; + }; + } tsc; + + __asm__ __volatile__ ("rdtsc" : + "=a" (tsc.lo_32), + "=d" (tsc.hi_32) : : "memory"); + + return tsc.tsc_64; +}