aboutsummaryrefslogtreecommitdiff
path: root/gprof/hertz.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-06-27 15:37:48 +0000
committerIan Lance Taylor <ian@airs.com>1996-06-27 15:37:48 +0000
commite3c0e00bb155377b845c4b1470eba36a206fe908 (patch)
treee9cca164c0e263fc62eb9dcc9b56aaf647fc7f3c /gprof/hertz.c
parent5304aea938084c9c4296b612257d3b8490857f7f (diff)
downloadgdb-e3c0e00bb155377b845c4b1470eba36a206fe908.zip
gdb-e3c0e00bb155377b845c4b1470eba36a206fe908.tar.gz
gdb-e3c0e00bb155377b845c4b1470eba36a206fe908.tar.bz2
* configure.in: Call AC_ISC_POSIX.
* configure: Rebuild. * Makefile.in (gprof): Pass $(CFLAGS) during link. * hertz.c: Don't include <sys/time.h>; let sysdep.h handle that. If HAVE_SETITIMER is not defined, try using sysconf.
Diffstat (limited to 'gprof/hertz.c')
-rw-r--r--gprof/hertz.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gprof/hertz.c b/gprof/hertz.c
index 9dbc89f..75314ac 100644
--- a/gprof/hertz.c
+++ b/gprof/hertz.c
@@ -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;
@@ -43,5 +43,12 @@ hertz ()
return HZ_WRONG;
}
return 1000000 / tim.it_interval.tv_usec;
-#endif
+#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) */
}