(C) 2002 Robert Collins How to profile cygwin1.dll. The hard way: Build libc.a and libm.a with -pg. Build all the cygwin1.dll source - except mcount.c - with -pg and no -O2. -O2 interferes with -pg in some inlined code. Link libgmon.a into cygwin1.dll. build cyggmon.dll and copy to /usr/bin. I used a CCNOPROF target in Makefile.in to make this relatively easy. The gmon code must be in a dll, so that multiple .dll's all built with profiling will all access the same instance of _gmonparam. The result if this is not done is that only the code in .a and .o items gets recorded to the gmon.out file. Voila.