* config/tc-i386.c (tc_i386_fix_adjustable): Change ifndef
[deliverable/binutils-gdb.git] / gprof / hertz.c
index 53910411888328ec0b8f12c523795fcb45a157e5..75314acc0c3c0d76c70a21118f743ad74adc411b 100644 (file)
@@ -16,7 +16,6 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
-#include <sys/time.h>
 #include "hertz.h"
 
 
@@ -29,7 +28,8 @@ hertz ()
 {
 #ifdef HERTZ
   return HERTZ;
-#else
+#else /* ! defined (HERTZ) */
+#ifdef HAVE_SETITIMER
   struct itimerval tim;
 
   tim.it_interval.tv_sec = 0;
@@ -41,7 +41,14 @@ hertz ()
   if (tim.it_interval.tv_usec < 2)
     {
       return HZ_WRONG;
-    }                          /* if */
+    }
   return 1000000 / tim.it_interval.tv_usec;
-#endif
-}                              /* hertz */
+#else /* ! defined (HAVE_SETITIMER) */
+#if defined (HAVE_SYSCONF) && defined (_SC_CLK_TCK)
+  return sysconf (_SC_CLK_TCK);
+#else /* ! defined (HAVE_SYSCONF) || ! defined (_SC_CLK_TCK) */
+  return HZ_WRONG;
+#endif /* ! defined (HAVE_SYSCONF) || ! defined (_SC_CLK_TCK) */
+#endif /* ! defined (HAVE_SETITIMER) */
+#endif /* ! defined (HERTZ) */
+}
This page took 0.023012 seconds and 4 git commands to generate.