1 /* profil.h: gprof profiling header file
3 Copyright 1998, 1999, 2000, 2001 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
11 /* profiling frequency. (No larger than 1000) */
14 /* convert an addr to an index */
15 #define PROFIDX(pc, base, scale) \
17 size_t i = (pc - base) / 2; \
18 if (sizeof (unsigned long long int) > sizeof (size_t)) \
19 i = (unsigned long long int) i * scale / 65536; \
21 i = i / 65536 * scale + i % 65536 * scale / 65536; \
25 /* convert an index into an address */
26 #define PROFADDR(idx, base, scale) \
27 ((base) + ((((unsigned long long)(idx) << 16) / (scale)) << 1))
29 /* convert a bin size into a scale */
30 #define PROFSCALE(range, bins) (((bins) << 16) / ((range) >> 1))
32 typedef void *_WINHANDLE;
35 _WINHANDLE targthr; /* thread to profile */
36 _WINHANDLE profthr; /* profiling thread */
37 u_short *counter; /* profiling counters */
38 u_long lowpc, highpc; /* range to be profiled */
39 u_int scale; /* scale value of bins */
42 int profile_ctl(struct profinfo *, char *, size_t, u_long, u_int);
43 int profil(char *, size_t, u_long, u_int);