aboutsummaryrefslogtreecommitdiff
path: root/gprof/hertz.c
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@cygnus>1995-02-07 22:34:18 +0000
committerKen Raeburn <raeburn@cygnus>1995-02-07 22:34:18 +0000
commit5489fcc3d9dbb1f529dddb19b615e23d8ed59dc7 (patch)
tree1a79cfffd92f2afb67780dd7372c1759c49791aa /gprof/hertz.c
parent2559e01429d193b7957c106a6a8b0598476f9845 (diff)
downloadgdb-5489fcc3d9dbb1f529dddb19b615e23d8ed59dc7.zip
gdb-5489fcc3d9dbb1f529dddb19b615e23d8ed59dc7.tar.gz
gdb-5489fcc3d9dbb1f529dddb19b615e23d8ed59dc7.tar.bz2
Lots of changes from David Mosberger-Tang; see ChangeLog and NOTES for details:
Alpha support. Long options. New file format to support more information; backwards compatibility. Line-level profiling, on systems where bfd_find_nearest_line works. Selective display of data.
Diffstat (limited to 'gprof/hertz.c')
-rw-r--r--gprof/hertz.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/gprof/hertz.c b/gprof/hertz.c
index 0d8d9d3..979ad37 100644
--- a/gprof/hertz.c
+++ b/gprof/hertz.c
@@ -16,38 +16,31 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-
-#ifndef lint
-static char sccsid[] = "@(#)hertz.c 5.4 (Berkeley) 6/1/90";
-#endif /* not lint */
-
#include <sys/time.h>
+#include "hertz.h"
- /*
- * discover the tick frequency of the machine
- * if something goes wrong, we return 0, an impossible hertz.
- */
-#define HZ_WRONG 0
#ifdef __MSDOS__
-#define HERTZ 18
+# define HERTZ 18
#endif
+int
hertz()
{
#ifdef HERTZ
- return HERTZ;
+ return HERTZ;
#else
- struct itimerval tim;
+ 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;
+ } /* if */
+ return 1000000 / tim.it_interval.tv_usec;
#endif
-}
+} /* hertz */