Cygwin: (mostly) drop NT4 and Samba < 3.0 support
[newlib-cygwin.git] / winsup / cygwin / local_includes / profil.h
blobcb1a092dae4353195ec834761b54bb21e13049af
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
7 details. */
9 /*
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) */
15 #define PROF_HZ 100
17 /* convert an addr to an index */
18 #define PROFIDX(pc, base, scale) \
19 ({ \
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; \
23 else \
24 i = i / 65536 * scale + i % 65536 * scale / 65536; \
25 i; \
28 /* convert an index into an address */
29 #define PROFADDR(idx, base, scale) \
30 ((base) \
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;
38 #ifdef __MINGW32__
39 #include <_bsd_types.h>
40 #endif /* __MINGW32__*/
42 struct profinfo {
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);