1 /* profil.h: gprof profiling header file
3 Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
5 This file is part of Cygwin.
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
12 * This file is taken from Cygwin distribution. Please keep it in sync.
13 * The differences should be within __MINGW32__ guard.
16 /* profiling frequency. (No larger than 1000) */
19 /* convert an addr to an index */
20 #define PROFIDX(pc, base, scale) \
22 size_t i = (pc - base) / 2; \
23 if (sizeof (unsigned long long int) > sizeof (size_t)) \
24 i = (unsigned long long int) i * scale / 65536; \
26 i = i / 65536 * scale + i % 65536 * scale / 65536; \
30 /* convert an index into an address */
31 #define PROFADDR(idx, base, scale) \
33 + ((((unsigned long long)(idx) << 16) \
34 / (unsigned long long)(scale)) << 1))
36 /* convert a bin size into a scale */
37 #define PROFSCALE(range, bins) (((bins) << 16) / ((range) >> 1))
39 typedef void *_WINHANDLE
;
42 _WINHANDLE targthr
; /* thread to profile */
43 _WINHANDLE profthr
; /* profiling thread */
44 u_short
*counter
; /* profiling counters */
45 u_long lowpc
, highpc
; /* range to be profiled */
46 u_int scale
; /* scale value of bins */
49 int profile_ctl(struct profinfo
*, char *, size_t, u_long
, u_int
);
50 int profil(char *, size_t, u_long
, u_int
);