Blame gprof/gmon.h

Packit Service 72eb06
/*
Packit Service 72eb06
 * Copyright (c) 1983, 1991, 1993, 2001
Packit Service 72eb06
 *      The Regents of the University of California.  All rights reserved.
Packit Service 72eb06
 *
Packit Service 72eb06
 * Redistribution and use in source and binary forms, with or without
Packit Service 72eb06
 * modification, are permitted provided that the following conditions
Packit Service 72eb06
 * are met:
Packit Service 72eb06
 * 1. Redistributions of source code must retain the above copyright
Packit Service 72eb06
 *    notice, this list of conditions and the following disclaimer.
Packit Service 72eb06
 * 2. Redistributions in binary form must reproduce the above copyright
Packit Service 72eb06
 *    notice, this list of conditions and the following disclaimer in the
Packit Service 72eb06
 *    documentation and/or other materials provided with the distribution.
Packit Service 72eb06
 * 3. Neither the name of the University nor the names of its contributors
Packit Service 72eb06
 *    may be used to endorse or promote products derived from this software
Packit Service 72eb06
 *    without specific prior written permission.
Packit Service 72eb06
 *
Packit Service 72eb06
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
Packit Service 72eb06
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit Service 72eb06
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit Service 72eb06
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
Packit Service 72eb06
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit Service 72eb06
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
Packit Service 72eb06
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
Packit Service 72eb06
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
Packit Service 72eb06
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
Packit Service 72eb06
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Packit Service 72eb06
 * SUCH DAMAGE.
Packit Service 72eb06
 */
Packit Service 72eb06
#ifndef gmon_h
Packit Service 72eb06
#define gmon_h
Packit Service 72eb06
Packit Service 72eb06
/* Size of the 4.4BSD gmon header */
Packit Service 72eb06
#define GMON_HDRSIZE_BSD44_32 (4 + 4 + 4 + 4 + 4 + (3 * 4))
Packit Service 72eb06
#define GMON_HDRSIZE_BSD44_64 (8 + 8 + 4 + 4 + 4 + (3 * 4))
Packit Service 72eb06
Packit Service 72eb06
/* *INDENT-OFF* */
Packit Service 72eb06
/* For documentation purposes only.
Packit Service 72eb06
Packit Service 72eb06
   struct raw_phdr
Packit Service 72eb06
    {
Packit Service 72eb06
      char low_pc[sizeof(void *)];   -- base pc address of sample buffer
Packit Service 72eb06
      char high_pc[sizeof(void *)];  -- max pc address of sampled buffer
Packit Service 72eb06
      char ncnt[4];		     -- size of sample buffer (plus this
Packit Service 72eb06
				        header)
Packit Service 72eb06
Packit Service 72eb06
      char version[4];		     -- version number
Packit Service 72eb06
      char profrate[4];		     -- profiling clock rate
Packit Service 72eb06
      char spare[3*4];		     -- reserved
Packit Service 72eb06
    };
Packit Service 72eb06
*/
Packit Service 72eb06
/* *INDENT-ON* */
Packit Service 72eb06
Packit Service 72eb06
#define GMONVERSION     0x00051879
Packit Service 72eb06
Packit Service 72eb06
/* Size of the old BSD gmon header */
Packit Service 72eb06
#define GMON_HDRSIZE_OLDBSD_32 (4 + 4 + 4)
Packit Service 72eb06
Packit Service 72eb06
/* FIXME: Checking host compiler defines here means that we can't
Packit Service 72eb06
   use a cross gprof alpha OSF.  */
Packit Service 72eb06
#if defined(__alpha__) && defined (__osf__)
Packit Service 72eb06
#define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4 + 4)
Packit Service 72eb06
#else
Packit Service 72eb06
#define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4)
Packit Service 72eb06
#endif
Packit Service 72eb06
Packit Service 72eb06
/* *INDENT-OFF* */
Packit Service 72eb06
/* For documentation purposes only.
Packit Service 72eb06
Packit Service 72eb06
  struct old_raw_phdr
Packit Service 72eb06
    {
Packit Service 72eb06
      char low_pc[sizeof(void *)];  -- base pc address of sample buffer
Packit Service 72eb06
      char high_pc[sizeof(void *)]  -- max pc address of sampled buffer
Packit Service 72eb06
      char ncnt[4];		    -- size of sample buffer (plus this
Packit Service 72eb06
				       header)
Packit Service 72eb06
Packit Service 72eb06
      if defined (__alpha__) && defined (__osf__)
Packit Service 72eb06
      char pad[4];		    -- DEC's OSF v3.0 uses 4 bytes of padding
Packit Service 72eb06
				    -- to bring the header to a size that is a
Packit Service 72eb06
				    -- multiple of 8.
Packit Service 72eb06
      endif
Packit Service 72eb06
    };
Packit Service 72eb06
*/
Packit Service 72eb06
/* *INDENT-ON* */
Packit Service 72eb06
Packit Service 72eb06
/*
Packit Service 72eb06
 * Histogram counters are unsigned shorts:
Packit Service 72eb06
 */
Packit Service 72eb06
#define	HISTCOUNTER unsigned short
Packit Service 72eb06
Packit Service 72eb06
/*
Packit Service 72eb06
 * Fraction of text space to allocate for histogram counters here, 1/2:
Packit Service 72eb06
 */
Packit Service 72eb06
#define	HISTFRACTION	2
Packit Service 72eb06
Packit Service 72eb06
/*
Packit Service 72eb06
 * Fraction of text space to allocate for from hash buckets.  The
Packit Service 72eb06
 * value of HASHFRACTION is based on the minimum number of bytes of
Packit Service 72eb06
 * separation between two subroutine call points in the object code.
Packit Service 72eb06
 * Given MIN_SUBR_SEPARATION bytes of separation the value of
Packit Service 72eb06
 * HASHFRACTION is calculated as:
Packit Service 72eb06
 *
Packit Service 72eb06
 *      HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1);
Packit Service 72eb06
 *
Packit Service 72eb06
 * For the VAX, the shortest two call sequence is:
Packit Service 72eb06
 *
Packit Service 72eb06
 *      calls   $0,(r0)
Packit Service 72eb06
 *      calls   $0,(r0)
Packit Service 72eb06
 *
Packit Service 72eb06
 * which is separated by only three bytes, thus HASHFRACTION is
Packit Service 72eb06
 * calculated as:
Packit Service 72eb06
 *
Packit Service 72eb06
 *      HASHFRACTION = 3 / (2 * 2 - 1) = 1
Packit Service 72eb06
 *
Packit Service 72eb06
 * Note that the division above rounds down, thus if MIN_SUBR_FRACTION
Packit Service 72eb06
 * is less than three, this algorithm will not work!
Packit Service 72eb06
 */
Packit Service 72eb06
#define	HASHFRACTION 1
Packit Service 72eb06
Packit Service 72eb06
/*
Packit Service 72eb06
 * Percent of text space to allocate for tostructs with a minimum:
Packit Service 72eb06
 */
Packit Service 72eb06
#define ARCDENSITY	2
Packit Service 72eb06
#define MINARCS		50
Packit Service 72eb06
Packit Service 72eb06
struct tostruct
Packit Service 72eb06
  {
Packit Service 72eb06
    char *selfpc;
Packit Service 72eb06
    int count;
Packit Service 72eb06
    unsigned short link;
Packit Service 72eb06
  };
Packit Service 72eb06
Packit Service 72eb06
/*
Packit Service 72eb06
 * A raw arc, with pointers to the calling site and the called site
Packit Service 72eb06
 * and a count.  Everything is defined in terms of characters so
Packit Service 72eb06
 * as to get a packed representation (otherwise, different compilers
Packit Service 72eb06
 * might introduce different padding):
Packit Service 72eb06
 */
Packit Service 72eb06
Packit Service 72eb06
/* *INDENT-OFF* */
Packit Service 72eb06
/* For documentation purposes only.
Packit Service 72eb06
Packit Service 72eb06
  struct raw_arc
Packit Service 72eb06
    {
Packit Service 72eb06
      char from_pc[sizeof(void *)];
Packit Service 72eb06
      char self_pc[sizeof(void *)];
Packit Service 72eb06
      char count[sizeof(long)];
Packit Service 72eb06
    };
Packit Service 72eb06
*/
Packit Service 72eb06
/* *INDENT-ON* */
Packit Service 72eb06
Packit Service 72eb06
/*
Packit Service 72eb06
 * General rounding functions:
Packit Service 72eb06
 */
Packit Service 72eb06
#define ROUNDDOWN(x,y)	(((x)/(y))*(y))
Packit Service 72eb06
#define ROUNDUP(x,y)	((((x)+(y)-1)/(y))*(y))
Packit Service 72eb06
Packit Service 72eb06
#endif /* gmon_h */