[PATCH] profile support

jojelino jojelino@gmail.com
Mon Aug 29 20:07:00 GMT 2011


On 2011-08-23 PM 2:40, Christopher Faylor wrote:
> On Tue, Aug 23, 2011 at 02:05:06PM +0900, jojelino wrote:
>> Index: winsup/cygwin/Makefile.in
>> ===================================================================
>> RCS file: /cvs/src/src/winsup/cygwin/Makefile.in,v
>> retrieving revision 1.248
>> diff -u -p -r1.248 Makefile.in
>> --- winsup/cygwin/Makefile.in	2 May 2011 19:14:39 -0000	1.248
>> +++ winsup/cygwin/Makefile.in	22 Aug 2011 20:27:57 -0000
>> @@ -233,7 +233,7 @@ EXTRALIBS:=libautomode.a libbinmode.a li
>> INSTOBJS:=automode.o binmode.o textmode.o textreadmode.o
>> TARGET_LIBS:=$(LIB_NAME) $(CYGWIN_START) $(GMON_START) $(LIBGMON_A) $(SUBLIBS) $(INSTOBJS) $(EXTRALIBS)
>>
>> -ifneq "${filter -O%,$(CFLAGS)}" ""
>> +ifneq "" ""
>>
>> -    void *rv = malloc(size);
>> +    void *rv = LocalAlloc(0x40,size);
>
> There are a few things in your patch which make no sense.  The above are
> two of them.  I am not going to look further.  The patch certainly can't
> go in as is.
>
> cgf
>
The two of them is now

  ifneq "${filter -O%,$(CFLAGS)}" ""
+ifneq '$(profile)' '1'
  endif
...
...
+endif

+#if !defined(PROFILE)
      void *rv = malloc(size);
+#else
+    void *rv = LocalAlloc(LMEM_FIXED,size);
+#endif

changelog of winsup-profile-support-3.diff
Following patch are not effective unless you 'make profile=1'
	
	* profil.h: (struct profinfo::{queue,operational}): New member.
	(struct clk): New struct.
	* gmon.h: (struct gmonparam::comm_kcount): New member.
	* gmon.c: (_gmonparam): Add NO_COPY_INIT.
	* profil.c: (prof): Ditto.
	(profile_off): Flush profiling request.
	(apc_spawnthread): New function.
	(profile_on): Initialize init_global_security prior to use it, and 
spawn the consumer by issuing APC call.
	(fake_sbrk): Use LocalAlloc instead of malloc.
	(monstartup): Claim memory for comm_kcount.
	(_mcleanup): Alter formatting of cleanup filename, decide hz which 
maximizes kcount, calculate kcount using comm_kcount. 	
	* gcrt0.c (PROFILE): Define.
	(_monstartup): Use it.
	* exceptions.cc (ctrl_c_handler): Stop the consumer thread explicitly 
to avoid deadlock.
	* external.cc (exit_process): Ditto.
	* pinfo.cc (pinfo::exit): Ditto.
	* init.cc (respawn_wow64_process): Ditto.
	 (dll_entry): call __cyg_profile_{func,tls}_{ctor,dtor} to 
{un}initialize instrument function.
	* dcrt0.cc (dll_crt0_0): call _monstartup,atexit in proper order.
	* Makefile.in (EXTRA_DEPENDENCIES_1): Define variable.
	(EXTRA_LDFLAGS_1): Ditto.
	(profile): Ditto.
	(PROFILE_OPT_OUT): Ditto.
	(CFLAGS_SAVE): Clobber CFLAGS.
	(CFLAGS): Redefine.
	(gcrt1.o): use gcrt0.c as prerequisite.
	(TEST_DLL_NAME): use EXTRA_DEPENDENCIES_?, EXTRA_LDFLAGS_?.
	* sec_helper.cc (init_global_security): Check if called twice.
	* boundbuffer.c: New file.
	* boundbuffer.h: Ditto.
	* instrument.c: Ditto.	
	* instrument.h: Ditto.
	
changelog of winsup-makefile.diff
     * Makefile.common (ALL_CFLAGS): Replace simple expansion to 
recursive expansion.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: winsup-profile-support-3.diff
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20110829/3e852400/attachment.ksh>
-------------- next part --------------
Index: winsup/Makefile.common
===================================================================
RCS file: /cvs/src/src/winsup/Makefile.common,v
retrieving revision 1.56
diff -u -r1.56 Makefile.common
--- winsup/Makefile.common      7 Jul 2009 20:12:43 -0000       1.56
+++ winsup/Makefile.common      19 Aug 2011 20:22:40 -0000
@@ -113,7 +113,7 @@
 LIBM:=$(newlib_build)/libm/libm.a
 CRT0:=$(cygwin_build)/crt0.o

-ALL_CFLAGS:=$(DEFS) $(MALLOC_DEBUG) $(CFLAGS) $(GCC_DEFAULT_OPTIONS)
+ALL_CFLAGS=$(DEFS) $(MALLOC_DEBUG) $(CFLAGS) $(GCC_DEFAULT_OPTIONS)
 ALL_CXXFLAGS=$(DEFS) $(MALLOC_DEBUG) $(CXXFLAGS) $(GCC_DEFAULT_OPTIONS)

 ifndef PREPROCESS


More information about the Cygwin-patches mailing list