source: Daodan/MinGW/include/profil.h@ 1066

Last change on this file since 1066 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 1.5 KB
RevLine 
[1046]1/* profil.h: gprof profiling header file
2
3 Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
4
5This file is part of Cygwin.
6
7This software is a copyrighted work licensed under the terms of the
8Cygwin license. Please consult the file "CYGWIN_LICENSE" for
9details. */
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
39typedef void *_WINHANDLE;
40
41struct 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
49int profile_ctl(struct profinfo *, char *, size_t, u_long, u_int);
50int profil(char *, size_t, u_long, u_int);
51
Note: See TracBrowser for help on using the repository browser.