X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gprof%2Fhertz.c;h=7e16511c26abcd882b4bd70ef0b8a25b1d3c0bbe;hb=de4112fa387b662c7c7a1dd3e334a1274ca54d28;hp=75314acc0c3c0d76c70a21118f743ad74adc411b;hpb=dc9e099fc0eced486ae2b49455c9da113c11f4ff;p=deliverable%2Fbinutils-gdb.git diff --git a/gprof/hertz.c b/gprof/hertz.c index 75314acc0c..7e16511c26 100644 --- a/gprof/hertz.c +++ b/gprof/hertz.c @@ -16,13 +16,10 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +#include "gprof.h" #include "hertz.h" -#ifdef __MSDOS__ -#define HERTZ 18 -#endif - int hertz () { @@ -38,17 +35,19 @@ hertz () tim.it_value.tv_usec = 0; setitimer (ITIMER_REAL, &tim, 0); setitimer (ITIMER_REAL, 0, &tim); - if (tim.it_interval.tv_usec < 2) + if (tim.it_interval.tv_usec >= 2) { - return HZ_WRONG; + return 1000000 / tim.it_interval.tv_usec; } - return 1000000 / tim.it_interval.tv_usec; -#else /* ! defined (HAVE_SETITIMER) */ +#endif /* ! defined (HAVE_SETITIMER) */ #if defined (HAVE_SYSCONF) && defined (_SC_CLK_TCK) return sysconf (_SC_CLK_TCK); #else /* ! defined (HAVE_SYSCONF) || ! defined (_SC_CLK_TCK) */ +#ifdef __MSDOS__ + return 18; +#else /* ! defined (__MSDOS__) */ return HZ_WRONG; +#endif /* ! defined (__MSDOS__) */ #endif /* ! defined (HAVE_SYSCONF) || ! defined (_SC_CLK_TCK) */ -#endif /* ! defined (HAVE_SETITIMER) */ #endif /* ! defined (HERTZ) */ }