acadia-newlib/winsup/cygwin/include/sys
Mark Geisert 5807ba83e4 Support profiling of multi-threaded apps.
This patch set modifies Cygwin's profiling support to sample PC values
of all an app's threads, not just the main thread. There is no change
to how profiling is requested: just compile and link the app with "-pg"
as usual. The profiling info is dumped into file gmon.out as always.

A new facility enabled via the environment variable GMON_OUT_PREFIX.
This facility is intended to match an undocumented Linux glibc feature.
Exporting the variable with a non-empty value such as "foo" causes the
profiling info to go to a file named foo.$pid instead of the default.
With that, both resulting processes of a fork() can have their profiling
data captured in separate files. gprof already knows how to accumulate
data from multiple files if they all pertain to the same app.

There is no change to the normal Cygwin execution paths if profiling is
not enabled. And when it is enabled, only the one profiling thread per
profiled app is doing more work than it used to.

	* include/sys/cygwin.h: Add CW_CYGHEAP_PROFTHR_ALL.
	* cygheap.cc (cygheap_profthr_all): New C-callable function that
	runs cygheap's threadlist handing each pthread's thread handle in
	turn to profthr_byhandle().
	* external.cc (cygwin_internal): Add case CW_CYGHEAP_PROFTHR_ALL.
	* gmon.c (_mcleanup): Add support for multiple simultaneous
	gmon.out* files named via environment variable GMON_OUT_PREFIX.
	* gmon.h (struct gmonparam): Make state decl volatile.
	* mcount.c (_MCOUNT_DECL): Change stores into gmonparam.state to use
	Interlocked operations. Add #include "winsup.h", update commentary.
	* profil.c (profthr_byhandle): New function abstracting out the
	updating of profile counters based on a thread handle.
	(profthr_func): Update to call profthr_byhandle() to sample the main
	thread then call cygheap_profthr_all() indirectly through
	cygwin_internal(CW_CYGHEAP_PROFTHR_ALL) to sample all other threads.
	(profile_off): Zero targthr to indicate profiling was turned off.
	(profile_on): Fix handle leak on failure path.
	(profile_child): New callback func to restart profiling in child
	process after a fork if the parent was being profiled.
	(profile_ctl): Call pthread_atfork() to set profile_child callback.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-10 20:39:46 +01:00
..
acl.h Implement POSIX.1e ACL functions 2016-03-08 13:56:40 +01:00
copying.dj
cygwin.h Support profiling of multi-threaded apps. 2016-03-10 20:39:46 +01:00
dirent.h Throughout, keep function definitions and declarations in sync with 2013-11-25 11:38:08 +00:00
elf.h
elf32.h
elf64.h
elf_common.h * include/sys/elf_common.h (R_386_16): Define. 2012-06-10 18:28:16 +00:00
elf_generic.h
file.h * include/sys/file.h: Add extern "C". 2014-08-06 08:46:12 +00:00
ioctl.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
ipc.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
kd.h
lock.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
mman.h
mount.h Introduce the 'usertemp' filesystem type 2015-12-07 17:37:44 +01:00
msg.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
mtio.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
param.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
poll.h
procfs.h
quota.h * Makefile.in (DLL_OFILES): Add quotactl.o. 2014-10-17 08:19:27 +00:00
resource.h * Merge in cygwin-64bit-branch. 2013-04-23 09:44:36 +00:00
sem.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
shm.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
smallprint.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
socket.h * include/sys/socket.h (sockatmark): Add prototype. 2015-02-24 09:00:37 +00:00
soundcard.h
statfs.h
statvfs.h
stdio.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
strace.h headers: properly decorate attributes 2014-08-01 15:48:37 +00:00
sysinfo.h Adapt to changes in newlib's sys/cdefs.h: 2013-04-22 10:33:09 +00:00
syslimits.h
syslog.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
sysmacros.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
sysproto.h
termio.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
termios.h Add CMIN and CTIME definitions 2015-04-23 21:57:07 +02:00
ttychars.h
ucontext.h Try to make sure struct _mcontext is 16-byte aligned 2015-04-23 21:57:11 +02:00
uio.h
un.h * include/sys/un.h (UNIX_PATH_MAX): Rename from UNIX_PATH_LEN to 2013-03-07 15:39:35 +00:00
utime.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
utmp.h Convert utmp{x}name to int, return useful value. Define _PATH_UTMPX 2016-01-07 15:40:40 +01:00
utsname.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
vfs.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
wait.h Throughout, update copyrights to reflect dates which correspond to main-branch 2013-01-21 04:38:31 +00:00
xattr.h