|
1 /* profil.h: gprof profiling header file |
|
2 |
|
3 Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
|
4 |
|
5 This file is part of Cygwin. |
|
6 |
|
7 This software is a copyrighted work licensed under the terms of the |
|
8 Cygwin license. Please consult the file "CYGWIN_LICENSE" for |
|
9 details. */ |
|
10 |
|
11 /* |
|
12 * This file is taken from Cygwin distribution. Please keep it in sync. |
|
13 * The differences should be within __MINGW32__ guard. |
|
14 */ |
|
15 |
|
16 /* profiling frequency. (No larger than 1000) */ |
|
17 #define PROF_HZ 100 |
|
18 |
|
19 /* convert an addr to an index */ |
|
20 #define PROFIDX(pc, base, scale) \ |
|
21 ({ \ |
|
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; \ |
|
25 else \ |
|
26 i = i / 65536 * scale + i % 65536 * scale / 65536; \ |
|
27 i; \ |
|
28 }) |
|
29 |
|
30 /* convert an index into an address */ |
|
31 #define PROFADDR(idx, base, scale) \ |
|
32 ((base) \ |
|
33 + ((((unsigned long long)(idx) << 16) \ |
|
34 / (unsigned long long)(scale)) << 1)) |
|
35 |
|
36 /* convert a bin size into a scale */ |
|
37 #define PROFSCALE(range, bins) (((bins) << 16) / ((range) >> 1)) |
|
38 |
|
39 typedef void *_WINHANDLE; |
|
40 |
|
41 struct profinfo { |
|
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 */ |
|
47 }; |
|
48 |
|
49 int profile_ctl(struct profinfo *, char *, size_t, u_long, u_int); |
|
50 int profil(char *, size_t, u_long, u_int); |
|
51 |