binutils-gdb/gprof/hertz.c

64 lines
2.4 KiB
C
Raw Normal View History

1999-05-03 09:29:11 +02:00
/*
2002-07-30 11:07:00 +02:00
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
1999-05-03 09:29:11 +02:00
*
2002-07-30 11:07:00 +02:00
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
1999-05-03 09:29:11 +02:00
*/
* alpha.c (alpha_Instruction): Don't use. (alpha_find_call): Avoid use of bitfields and casts between pointers and integers of different sizes. Avoid endian problems when cross-compiling. * vax.c (vax_find_call): Likewise. (struct modebyte): Don't use. (vax_operandmode): Pass in an unsigned char *. (vax_operandlength): Likewise. (vax_reladdr): Rename to vax_offset and return relative offset rather than address. * i386.c (i386_find_call): Avoid casts between pointers and integers of different sizes. * sparc.c (sparc_find_call): Likewise. Avoid endian problems. * tahoe.c (tahoe_find_call): Likewise. (tahoe_reladdr): Rename to tahoe_offset and return relative offset rather than address. * basic_blocks.h: Don't include headers here. * call_graph.h: Likewise. * cg_arcs.h: Likewise. * cg_print.h: Likewise. * corefile.h: Likewise. * gmon_io.h: Likewise. * gmon_out.h: Likewise. * hertz.h: Likewise. * hist.h: Likewise. * source.h: Likewise. * sym_ids.h: Likewise. * symtab.h: Likewise. * gprof.h: Don't include ansidecl.h, do include bfd.h. (bool): Don't typedef. * alpha.c: Adjust #include's for above header changes. * basic_blocks.c: Likewise. * call_graph.c: Likewise. * cg_arcs.c: Likewise. * cg_dfn.c: Likewise. * cg_print.c: Likewise. * corefile.c: Likewise. * gmon_io.c: Likewise. * gprof.c: Likewise. * hertz.c: Likewise. * hist.c: Likewise. * i386.c: Likewise. * mips.c: Likewise. * sparc.c: Likewise. * sym_ids.c: Likewise. * symtab.c: Likewise. * tahoe.c: Likewise. * utils.c: Likewise. * vax.c: Likewise. * po/POTFILES.in: Regenerate.
2002-01-31 13:56:08 +01:00
#include "gprof.h"
1999-05-03 09:29:11 +02:00
#include "hertz.h"
int
update many old style function definitions This includes regenerating a bunch of files in opcodes/ with trunk cgen. gprof/ChangeLog: 2016-04-20 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * basic_blocks.c: Update old style function definitions. * cg_arcs.c: Likewise. * cg_print.c: Likewise. * gen-c-prog.awk: Likewise. * gmon_io.c: Likewise. * hertz.c: Likewise. * hist.c: Likewise. * sym_ids.c: Likewise. bfd/ChangeLog: 2016-04-20 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * cache.c: Update old style function definitions. * elf32-m68k.c: Likewise. * elf64-mmix.c: Likewise. * stab-syms.c: Likewise. opcodes/ChangeLog: 2016-04-20 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * alpha-dis.c: Regenerate. * crx-dis.c: Likewise. * disassemble.c: Likewise. * epiphany-opc.c: Likewise. * fr30-opc.c: Likewise. * frv-opc.c: Likewise. * ip2k-opc.c: Likewise. * iq2000-opc.c: Likewise. * lm32-opc.c: Likewise. * lm32-opinst.c: Likewise. * m32c-opc.c: Likewise. * m32r-opc.c: Likewise. * m32r-opinst.c: Likewise. * mep-opc.c: Likewise. * mt-opc.c: Likewise. * or1k-opc.c: Likewise. * or1k-opinst.c: Likewise. * tic80-opc.c: Likewise. * xc16x-opc.c: Likewise. * xstormy16-opc.c: Likewise. ld/ChangeLog: 2016-04-20 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * emultempl/scoreelf.em: Likewise. binutils/ChangeLog: 2016-04-20 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * resres.c: Likewise. gas/ChangeLog: 2016-04-20 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * cgen.c: Likewise. * config/tc-bfin.c: Likewise. * config/tc-ia64.c: Likewise. * config/tc-mep.c: Likewise. * config/tc-metag.c: Likewise. * config/tc-nios2.c: Likewise. * config/tc-rl78.c: Likewise.
2016-04-14 00:30:46 +02:00
hertz (void)
1999-05-03 09:29:11 +02:00
{
#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)
1999-05-03 09:29:11 +02:00
{
return 1000000 / tim.it_interval.tv_usec;
1999-05-03 09:29:11 +02:00
}
#endif /* ! defined (HAVE_SETITIMER) */
1999-05-03 09:29:11 +02:00
#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__) */
1999-05-03 09:29:11 +02:00
return HZ_WRONG;
#endif /* ! defined (__MSDOS__) */
1999-05-03 09:29:11 +02:00
#endif /* ! defined (HAVE_SYSCONF) || ! defined (_SC_CLK_TCK) */
#endif /* ! defined (HERTZ) */
}