gnats-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to gnats/libiberty/getruntime.c


From: Milan Zamazal
Subject: Changes to gnats/libiberty/getruntime.c
Date: Mon, 10 Dec 2001 18:04:21 -0500

Index: gnats/libiberty/getruntime.c
diff -c gnats/libiberty/getruntime.c:1.2 gnats/libiberty/getruntime.c:1.3
*** gnats/libiberty/getruntime.c:1.2    Tue Oct 26 03:10:16 1999
--- gnats/libiberty/getruntime.c        Mon Dec 10 18:03:26 2001
***************
*** 26,35 ****
     single way is available for all host systems, nor are there reliable
     ways to find out which way is correct for a given host. */
  
! #include <time.h>
  
  #if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
- #include <sys/time.h>
  #include <sys/resource.h>
  #endif
  
--- 26,45 ----
     single way is available for all host systems, nor are there reliable
     ways to find out which way is correct for a given host. */
  
! #ifdef TIME_WITH_SYS_TIME
! # include <sys/time.h>
! # include <time.h>
! #else
! # if HAVE_SYS_TIME_H
! #  include <sys/time.h>
! # else
! #  ifdef HAVE_TIME_H
! #   include <time.h>
! #  endif
! # endif
! #endif
  
  #if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
  #include <sys/resource.h>
  #endif
  
***************
*** 40,45 ****
--- 50,59 ----
  #include <sys/times.h>
  #endif
  
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+ 
  /* This is a fallback; if wrong, it will likely make obviously wrong
     results. */
  
***************
*** 47,54 ****
  #define CLOCKS_PER_SEC 1
  #endif
  
! #if defined (HAVE_TIMES) && ! defined (HZ)
! #define HZ CLOCKS_PER_SEC
  #endif
  
  long
--- 61,76 ----
  #define CLOCKS_PER_SEC 1
  #endif
  
! #ifdef _SC_CLK_TCK
! #define GNU_HZ  sysconf(_SC_CLK_TCK)
! #else
! #ifdef HZ
! #define GNU_HZ  HZ
! #else
! #ifdef CLOCKS_PER_SEC
! #define GNU_HZ  CLOCKS_PER_SEC
! #endif
! #endif
  #endif
  
  long
***************
*** 65,71 ****
    struct tms tms;
  
    times (&tms);
!   return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
  #else /* ! HAVE_TIMES */
    /* Fall back on clock and hope it's correctly implemented. */
    const long clocks_per_sec = CLOCKS_PER_SEC;
--- 87,93 ----
    struct tms tms;
  
    times (&tms);
!   return (tms.tms_utime + tms.tms_stime) * (1000000 / GNU_HZ);
  #else /* ! HAVE_TIMES */
    /* Fall back on clock and hope it's correctly implemented. */
    const long clocks_per_sec = CLOCKS_PER_SEC;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]