From patchwork Fri Oct 25 12:08:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 35302 Received: (qmail 77663 invoked by alias); 25 Oct 2019 12:08:56 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 77553 invoked by uid 89); 25 Oct 2019 12:08:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-qk1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jPPhegz/ZbxNQvefzP77OPmwFiVKWjkgPWTWs/wtmB4=; b=djC/tlQ1wnEBdTbVp8Lwy5/kmqRobx52aVcD88HE9q+eiWxQ9s3xTOtcgUWbDurcOg 7DvdjaAEuY3krx4rKcRMsm1AE+K8Wz6RPIOSo92Wd80W6PG6svTllNzzGQ8BG6/dG8Lb 8Pk/3+YhWPXzEf55ojLDetCRenb1GvgUEBNq9iqwF/qh+j5owYDT5QYmMlBBPtJymK+N 5rF59h37rCSIQnAZWc4bbiQd8+e/SkG6+tJ4VZ5M37t4VC1avN8aypYjThVC4iGQ+SH3 /NJm9l57B5APDCuv2V3C+3o8R/td6fe4GGgxOtVgIChG3siStUV+2RfJjn03+H5WbxsU i8wA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Lukasz Majewski Subject: [PATCH v2 05/11] Use clock_gettime to implement time. Date: Fri, 25 Oct 2019 09:08:26 -0300 Message-Id: <20191025120832.27667-6-adhemerval.zanella@linaro.org> In-Reply-To: <20191025120832.27667-1-adhemerval.zanella@linaro.org> References: <20191025120832.27667-1-adhemerval.zanella@linaro.org> Use clock_gettime to implement time. Changes from previous version: - Do not remove Linux arch-specific implementations. - Use CLOCK_REALTIME_COARSE for Linux. Reviewed-by: Lukasz Majewski --- Change the default implementation of time to call clock_gettime, to align with new Linux ports that are expected to only implement __NR_clock_gettime. Arch-specific implementation that either call the time vDSO or route to gettimeofday vDSO are not removed. Also for Linux, CLOCK_REALTIME_COARSE is used instead of generic CLOCK_REALTIME clockid. This takes less CPU time and its behavior better matches what the current glibc does. Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, powerpc64-linux-gnu, powerpc-linux-gnu, and aarch64-linux-gnu. Co-authored-by: Zack Weinberg --- sysdeps/unix/sysv/linux/powerpc/time.c | 2 +- .../sysv/linux/{time.c => time-internal.h} | 31 ++++--------------- sysdeps/posix/time.c => time/time-internal.h | 28 +++-------------- time/time.c | 13 ++++---- 4 files changed, 17 insertions(+), 57 deletions(-) rename sysdeps/unix/sysv/linux/{time.c => time-internal.h} (64%) rename sysdeps/posix/time.c => time/time-internal.h (57%) diff --git a/sysdeps/unix/sysv/linux/powerpc/time.c b/sysdeps/unix/sysv/linux/powerpc/time.c index c35b80fad1..e957b81751 100644 --- a/sysdeps/unix/sysv/linux/powerpc/time.c +++ b/sysdeps/unix/sysv/linux/powerpc/time.c @@ -78,6 +78,6 @@ libc_hidden_def (time) #else -#include +#include