profiler — Sampling profiler of Cygwin programs with their DLLs


profiler [-defw] [-o FILENAME] [-s N] PROGRAM ARG... | -p PID

profiler -h | -V


  -d, --debug            Display debugging messages (toggle: default false)
  -e, --events           Display Windows DEBUG_EVENTS (toggle: default false)
  -f, --fork-profile     Profiles child processes (toggle: default false)
  -h, --help             Display usage information and exit
  -o, --output=FILENAME  Write output to file FILENAME rather than stdout
  -p, --pid=N            Attach to running program with Cygwin pid N
                         ...                    or with Windows pid -N
  -s, --sample-rate=N    Set IP sampling rate to N Hz (default 100)
  -v, --verbose          Display more status messages (toggle: default false)
  -V, --version          Display version information and exit
  -w, --new-window       Launch given command in a new window


The profiler utility executes a given program and any children of that program, collecting the location of the CPU instruction pointer (IP) many times per second. (It is optional to collect this info from child processes.) This info gives a profile of the program's execution, showing where the most time is being spent. This profiling technique is called "IP sampling".

A novel feature of profiler is that time spent in DLLs loaded with or by your program is profiled too. You use gprof to process and display the resulting profile information. In this fashion you can determine whether your own code, the Cygwin DLL, or another DLL has "hot spots" that might benefit from tuning.

(See also ssp, another profiler that operates in a different fashion: stepping by instruction. This can provide a different view on your program's operation.)

Here is an example of profiler operation:

$ profiler du -khs .
22G     .
97 samples across 83 buckets written to gmon.out.5908.cygwin1.dll
4 samples across 4 buckets written to gmon.out.5908.KernelBase.dll
1 sample across 1 bucket written to gmon.out.5908.kernel32.dll
7318 samples across 42 buckets written to gmon.out.5908.ntdll.dll
5 samples across 4 buckets written to gmon.out.5908.du.exe