1 /* profil.h: gprof profiling header file
3 This file is part of Cygwin.
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
10 * This file is taken from Cygwin distribution. Please keep it in sync.
11 * The differences should be within __MINGW32__ guard.
14 /* profiling frequency. (No larger than 1000) */
17 /* convert an addr to an index */
18 #define PROFIDX(pc, base, scale) \
20 size_t i = (pc - base) / 2; \
21 if (sizeof (unsigned long long int) > sizeof (size_t)) \
22 i = (unsigned long long int) i * scale / 65536; \
24 i = i / 65536 * scale + i % 65536 * scale / 65536; \
28 /* convert an index into an address */
29 #define PROFADDR(idx, base, scale) \
31 + ((((unsigned long long)(idx) << 16) \
32 / (unsigned long long)(scale)) << 1))
34 /* convert a bin size into a scale */
35 #define PROFSCALE(range, bins) (((bins) << 16) / ((range) >> 1))
37 typedef void *_WINHANDLE
;
39 #include <_bsd_types.h>
40 #endif /* __MINGW32__*/
43 _WINHANDLE targthr
; /* thread to profile */
44 _WINHANDLE profthr
; /* profiling thread */
45 _WINHANDLE quitevt
; /* quit event */
46 uint16_t *counter
; /* profiling counters */
47 size_t lowpc
, highpc
; /* range to be profiled */
48 uint32_t scale
; /* scale value of bins */
51 int profile_ctl(struct profinfo
*, char *, size_t, size_t, uint32_t);
52 int profil(char *, size_t, size_t, uint32_t);