From patchwork Sun May 27 07:10:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Blomqvist X-Patchwork-Id: 161540 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 6C701B6F9F for ; Sun, 27 May 2012 17:10:50 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1338707451; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:Date:Message-ID:Subject:From:To: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=hTJB0x5 DxVlYMYc0yirIrIPWI5A=; b=JxvKSx68zrFklhMs4jFQ2+BTYNgVyHMsR6RtENo VsCvr1BbXHG/rDpn8z21sc2ObPNIhsS4mo3eRtBkyk4qeTRQHlm7B7EmNvK54EEF ApYcGrnrYGAAUksWOyiXZfQHh6Ki1D+6mnNNoEC+KbNksPSPRZmO66HbWFEVLHRR mN0k= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:Date:Message-ID:Subject:From:To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=obFnkoArgFEIc8BSb2y+XVD7hgtBoeYH4St0B9YPQX9Ymc/VHJYqkZLL8sUjdC RGY/Le2vaggsBRb9aZ3OfhgQx3lFNYHQ00EU+k0Aiw1Ykj1O6ewIn3+WYUIha5wT Zgr+r/2Q5lbII+0DGQoJXFbS5pFbRbyltWLWc1jm2Kq3g=; Received: (qmail 7767 invoked by alias); 27 May 2012 07:10:40 -0000 Received: (qmail 7749 invoked by uid 22791); 27 May 2012 07:10:39 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-lpp01m010-f47.google.com (HELO mail-lpp01m010-f47.google.com) (209.85.215.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 27 May 2012 07:10:26 +0000 Received: by lags15 with SMTP id s15so1513154lag.20 for ; Sun, 27 May 2012 00:10:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.152.104.77 with SMTP id gc13mr4255547lab.31.1338102624477; Sun, 27 May 2012 00:10:24 -0700 (PDT) Received: by 10.152.128.3 with HTTP; Sun, 27 May 2012 00:10:24 -0700 (PDT) Date: Sun, 27 May 2012 10:10:24 +0300 Message-ID: Subject: [Patch, libfortran] Minor timing cleanups From: Janne Blomqvist To: Fortran List , GCC Patches Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, I committed the patch below as obvious. Index: intrinsics/time_1.h =================================================================== --- intrinsics/time_1.h (revision 187921) +++ intrinsics/time_1.h (working copy) @@ -158,10 +158,11 @@ gf_cputime (long *user_sec, long *user_u struct tms buf; clock_t err; err = times (&buf); - *user_sec = buf.tms_utime / HZ; - *user_usec = buf.tms_utime % HZ * (1000000. / HZ); - *system_sec = buf.tms_stime / HZ; - *system_usec = buf.tms_stime % HZ * (1000000. / HZ); + long hz = HZ; + *user_sec = buf.tms_utime / hz; + *user_usec = (buf.tms_utime % hz) * (1000000. / hz); + *system_sec = buf.tms_stime / hz; + *system_usec = (buf.tms_stime % hz) * (1000000. / hz); if ((err == (clock_t) -1) && errno != 0) return -1; return 0; @@ -184,7 +185,7 @@ gf_cputime (long *user_sec, long *user_u #else clock_t c = clock (); *user_sec = c / CLOCKS_PER_SEC; - *user_usec = c % CLOCKS_PER_SEC * (1000000. / CLOCKS_PER_SEC); + *user_usec = (c % CLOCKS_PER_SEC) * (1000000. / CLOCKS_PER_SEC); *system_sec = *system_usec = 0; if (c == (clock_t) -1) return -1; @@ -204,7 +205,7 @@ gf_cputime (long *user_sec, long *user_u usecs - OUTPUT, microseconds The OUTPUT arguments shall represent the number of seconds and - nanoseconds since the Epoch. + microseconds since the Epoch. Return value: 0 for success, -1 for error. In case of error, errno is set. Index: ChangeLog =================================================================== --- ChangeLog (revision 187921) +++ ChangeLog (working copy) @@ -1,3 +1,10 @@ +2012-05-27 Janne Blomqvist + + * intrinsics/time_1.h (gf_cputime): Don't reevaluate HZ expression + for times fallback, clarify operation ordering for times and clock + fallbacks. + (gf_gettime): Fix comment typo. + 2012-05-24 Janne Blomqvist PR fortran/53456