2000-02-17 20:38:33 +01:00
|
|
|
/* profil.h: gprof profiling header file
|
|
|
|
|
|
|
|
This file is part of Cygwin.
|
|
|
|
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
2013-06-18 11:45:37 +02:00
|
|
|
/*
|
|
|
|
* This file is taken from Cygwin distribution. Please keep it in sync.
|
|
|
|
* The differences should be within __MINGW32__ guard.
|
|
|
|
*/
|
2013-04-23 11:44:36 +02:00
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
/* profiling frequency. (No larger than 1000) */
|
|
|
|
#define PROF_HZ 100
|
|
|
|
|
|
|
|
/* convert an addr to an index */
|
|
|
|
#define PROFIDX(pc, base, scale) \
|
|
|
|
({ \
|
|
|
|
size_t i = (pc - base) / 2; \
|
|
|
|
if (sizeof (unsigned long long int) > sizeof (size_t)) \
|
|
|
|
i = (unsigned long long int) i * scale / 65536; \
|
|
|
|
else \
|
|
|
|
i = i / 65536 * scale + i % 65536 * scale / 65536; \
|
|
|
|
i; \
|
|
|
|
})
|
|
|
|
|
|
|
|
/* convert an index into an address */
|
2013-06-18 11:45:37 +02:00
|
|
|
#define PROFADDR(idx, base, scale) \
|
|
|
|
((base) \
|
|
|
|
+ ((((unsigned long long)(idx) << 16) \
|
|
|
|
/ (unsigned long long)(scale)) << 1))
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
/* convert a bin size into a scale */
|
|
|
|
#define PROFSCALE(range, bins) (((bins) << 16) / ((range) >> 1))
|
|
|
|
|
|
|
|
typedef void *_WINHANDLE;
|
2013-06-18 11:45:37 +02:00
|
|
|
#ifdef __MINGW32__
|
|
|
|
#include <_bsd_types.h>
|
|
|
|
#endif /* __MINGW32__*/
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
struct profinfo {
|
|
|
|
_WINHANDLE targthr; /* thread to profile */
|
|
|
|
_WINHANDLE profthr; /* profiling thread */
|
2013-06-18 11:45:37 +02:00
|
|
|
_WINHANDLE quitevt; /* quit event */
|
2016-03-24 16:39:15 +01:00
|
|
|
uint16_t *counter; /* profiling counters */
|
2013-06-18 11:45:37 +02:00
|
|
|
size_t lowpc, highpc; /* range to be profiled */
|
2016-03-24 16:39:15 +01:00
|
|
|
uint32_t scale; /* scale value of bins */
|
2000-02-17 20:38:33 +01:00
|
|
|
};
|
|
|
|
|
2016-03-24 16:39:15 +01:00
|
|
|
int profile_ctl(struct profinfo *, char *, size_t, size_t, uint32_t);
|
|
|
|
int profil(char *, size_t, size_t, uint32_t);
|
2000-02-17 20:38:33 +01:00
|
|
|
|