summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/gmon.c
Commit message (Collapse)AuthorAgeFilesLines
* Throughout Cygwin, use u_intN_t or uintN_tCorinna Vinschen2016-03-241-2/+2
| | | | | | | | | | Don't use u_char, u_short, u_int or u_long in Cygwin, unless it refers to the Winsock types. Use u_intN_t in BSD-based sources, unsigned char where strings are concerned, uintN_t otherwise. Also: * net.cc: Fix comment, we're not using u_long anymore. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Support profiling of multi-threaded apps.Mark Geisert2016-03-101-48/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* * gmon.c: Drop gratuitous inclusion of strings.h. Remove __MINGW32__Corinna Vinschen2013-06-181-3/+0
| | | | around definition of bzero.
* * Makefile.in (VPATH): Drop CONFIG_DIR.Corinna Vinschen2013-06-181-27/+42
| | | | | | | | | | | | | | | | | | (EXTRA_DLL_OFILES): Remove. (DLL_OFILES): Remove EXTRA_DLL_OFILES. (ASFLAGS): Define as -D_WIN64 on x86_64. (GMON_OFILES): Add mcountFunc.o. ($(srcdir)/$(TLSOFFSETS_H)): Use target_cpu rather than CONFIG_DIR. * configure.ac (CONFIG_DIR): Remove definition. * configure: Regenerate. * gcrt0.c: Use latest version from Mingw-w64 project. * gmon.c: Ditto. * gmon.h: Ditto. * mcount.c: Ditto. * mcountFunc.S: Ditto, new file. * profil.c: Ditto. * profil.h: Ditto. * config: Remove entire directory.
* * gmon.c (_mcleanup): Fix scope bug when using gmon_out array.Corinna Vinschen2012-08-141-4/+4
|
* * winlean.h: New file.Christopher Faylor2010-08-301-1/+2
| | | | | | | | | | | | | | | | * automode.c: Use "winlean.h". * binmode.c: Ditto. * gmon.c: Ditto. * textmode.c: Ditto. * textreadmode.c: Ditto. * winsup.h: Ditto. * lib/cygwin_attach_dll.c: Ditto. * lib/dll_main.cc: Ditto. * profile.c: Ditto. * crt0.c: Ditto. Cleanup ancient cruft. Add dummy calls to cygwin_premain*. * include/sys/cygwin.h: Remove old stuff. Move premain declarations nearer to other cygwin-specific function declarations. * globals.cc: Add comment.
* Remove unneeded header files from source files throughout. Update copyrightsChristopher Faylor2009-01-031-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | where appropriate. * globals.cc: New file for generic global variables. * mkglobals_h: New file to generate globals.h. * mkstatic: New Script used to build a (currently non-working) static libcygwin_s.a. * Makefile.in: Add unused rule to build a non-working libcygwin_s.a. (DLL_OFILES): Add globals.o. Make all objects rely on globals.h. (globals.h): New target. Generate globals.h. * cygtls.h: Honor new CYGTLS_HANDLE define to control when the HANDLE operator is allowed in _cygtls. * dcrt0.cc: Move most globals to globals.cc. * init.cc: Ditto. * environ.cc (strip_title_path): Remove now-unneeded extern. * fhandler_serial.cc (fhandler_serial::open): Ditto. * pinfo.cc: Ditto. (commune_process): Ditto. * shared.cc: Ditto. * glob.cc: Ditto. * strace.cc: Ditto. * exceptions.cc: Define CYGTLS_HANDLE before including winsup.h. * path.cc (stat_suffixes): Move here. * security.h: Add forward class path_conv declaration. * smallprint.cc (__small_vsprintf): Make a true c++ function. (__small_sprintf): Ditto. (small_printf): Ditto. (console_printf): Ditto. (__small_vswprintf): Ditto. (__small_swprintf): Ditto. * spawn.cc (spawn_guts): Remove _stdcall decoration in favor of regparm. (hExeced): Move to globals.cc * strfuncs.cc (current_codepage): Ditto. (active_codepage): Ditto. * sync.cc (lock_process::locker): Move here from dcrt0.cc. * syscalls.cc (stat_suffixes): Move to path.cc. * tty.cc (tty::create_master): Uncapitalize fatal warning for consistency. * winsup.h: Include globals.h to declare most of the grab bag list of globals which were previously defined here. * mount.h: Move USER_* defines back to shared_info.h. * speclib: Force temporary directory cleanup.
* 2002-05-25 Robert Collins <rbtcollins@hotmail.com>Robert Collins2002-05-241-1/+6
| | | | * gmon.c (fake_sbrk): Correctly return -1 on failed malloc's.
* * cygheap.h (init_cygheap): Move heap pointers here.Christopher Faylor2001-09-071-2/+2
| | | | | | | | | | | | | | | | | | | * include/sys/cygwin.h (perprocess): Remove heap pointers. * dcrt0.cc (__cygwin_user_data): Reflect obsolete perprocess stuff. (_dll_crt0): Don't initialize heap pointers. (cygwin_dll_init): Ditto. (release_upto): Use heap pointers from cygheap. * heap.h: Ditto. * fork.cc (fork_parent): Ditto. Don't set heap pointers in ch. (fork_child): Remove obsolete sigproc_fixup_after_fork. * shared.cc (memory_init): Reorganize so that cygheap initialization is called prior to regular heap since regular heap uses cygheap now. * sigproc.cc (proc_subproc): Eliminate zombies allocation. (sigproc_init): Move zombies alloation here. Don't free up array on fork, just reuse it. (sigproc_fixup_after_fork): Eliminate. * sigproc.h: Ditto. * include/cygwin/version.h: Reflect change to perprocess structure.
* * cygrun.c (main): Fix compiler warning.Christopher Faylor2001-04-031-1/+4
| | | | | | | | | | | * gmon.c (_mcleanup): Ditto. * profil.c (profile_off): Ditto. * net.cc (find_winsock_errno): New function. (__set_winsock_errno): Use find_winsock_errno. (cygwin_setsockopt): Detect SO_ERROR for debugging. (cygwin_getsockopt): Ditto. Translate error when getsockopt returns SO_ERROR. * winsup.h: regparmize __set_winsock_errno. * include/sys/strace.h: Document that strace functions can't use regparm.
* import winsup-2000-02-17 snapshotChristopher Faylor2000-02-171-0/+277