* m10300-opc.c (asr, lsr, asl): Fix am33 single bit shift opcode.
[deliverable/binutils-gdb.git] / gprof / hertz.c
index 1c2927f673ef2dfa9b2ebb3c9c892f4ac350d78e..75314acc0c3c0d76c70a21118f743ad74adc411b 100644 (file)
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
+#include "hertz.h"
 
-#ifndef lint
-static char sccsid[] = "@(#)hertz.c    5.4 (Berkeley) 6/1/90";
-#endif /* not lint */
 
-#include <sys/time.h>
+#ifdef __MSDOS__
+#define HERTZ 18
+#endif
 
-    /*
-     * discover the tick frequency of the machine
-     * if something goes wrong, we return 0, an impossible hertz.
-     */
-#define        HZ_WRONG        0
-
-hertz()
+int
+hertz ()
 {
-       struct itimerval tim;
+#ifdef HERTZ
+  return HERTZ;
+#else /* ! defined (HERTZ) */
+#ifdef HAVE_SETITIMER
+  struct itimerval tim;
 
-       tim.it_interval.tv_sec = 0;
-       tim.it_interval.tv_usec = 1;
-       tim.it_value.tv_sec = 0;
-       tim.it_value.tv_usec = 0;
-       setitimer(ITIMER_REAL, &tim, 0);
-       setitimer(ITIMER_REAL, 0, &tim);
-       if (tim.it_interval.tv_usec < 2)
-               return(HZ_WRONG);
-       return (1000000 / tim.it_interval.tv_usec);
+  tim.it_interval.tv_sec = 0;
+  tim.it_interval.tv_usec = 1;
+  tim.it_value.tv_sec = 0;
+  tim.it_value.tv_usec = 0;
+  setitimer (ITIMER_REAL, &tim, 0);
+  setitimer (ITIMER_REAL, 0, &tim);
+  if (tim.it_interval.tv_usec < 2)
+    {
+      return HZ_WRONG;
+    }
+  return 1000000 / tim.it_interval.tv_usec;
+#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.02344 seconds and 4 git commands to generate.