This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Re: [PATCH] you can use this patch to profile cygwin
On 2011-07-31 PM 5:26, Corinna Vinschen wrote:
Erm, I tested on 32 bit. The slowdown occured on all platforms, not
only 64 bit. 64 bit is still only half as fast in the date loop for
reason or reasons unknown.
Corinna
I used this code to profile every source compiled with -pg
-finstrument-functions.
It had no documentation. because it existed solely for the purpose to
breakdown the cause of slow start.
Existing profiling code has ability to profile single-thread.so it had
rare useful when the target is cygwin.(it spawns thread.) so i tried
gaving them to consider threaded environment.
And modified profiling code uses instrument function to profile every
function enter/exit. eventually, it resulted in terrible performance
(2.42x slowdown at least)
when the profiling worker is forced to terminated(
ExitProcess,abort,exit.. ) it notifies worker thread and joins the thread.
Also, i modified initial startup a little bit.
and here is instruction.
# apply patch
for i in thread_profile_stuff.diff thread_profile_core.diff; do patch
-p0 <$i;done;
# pass configure parameter to build cygwin if you didn't configured it.
# make sure that cygwin is configured and can be built. from now i
copy-paste some bunch of code.
# in i686-pc-cygwin/winsup/cygwin/Makefile, you should add CFLAGS '-pg
-finstrument-functions' , to make new profiling code effective.
and comment out ifneq "${filter -O%,$(CFLAGS)}" "" too. it would make
profiling code functional ( in cases you need to profile cygheap thread
etc...)
#and use following snippet code to build new cygwin1.dll
s='';for i in boundbuffer pthread instrument kernel32 malloc_wrapper
pseudo-reloc libstdcxx_wrapper cxx gcrt1 gmon profil mcount; do rm $i.o;
s="${s} ${i}.o";done; make CFLAGS='-march=-O2 -g -mfpmath=sse
-Wno-error=unused-but-set-variable' $s -j 4;make;
#there would be no -pg -finstrument-functions in CFLAGS.
#what this does is, keep some source code from to be profiled.
and done. you got new-cygwin1.dll. rename it and try to discover what is
the problem. because it gave gmon out like gmon.%pid.%tid.out when
exited. you would use gprof to see report.
Regards.
Attachment:
thread_profile_core.diff
Description: Text document
Attachment:
thread_profile_stuff.diff
Description: Text document