CygProfiler is a set of functions for use with gcc's -finstrument-functions option. See info page of gcc for details and description of this option.
To use it, compile your program with -finstrument-functions and link together with cyg-profile.c. Somewhere at the beginning of the program call cygprofile_enable() to start logging all function entries and exits into a logfile.
By default the name of the logfile is cyglog.$PID, but you can set a different one using cygprofile_setfilename(). To get current logfile name use cygprofile_getfilename(). To see if logging is enabled use cygprofile_isenabled(). You can stop logging by calling cygprofile_disable().
Note that subsequent enabling of logging will overwrite the previous log with the same name!
After you have created a logfile run cyg-resolve.pl with the program name that created the logfile as a first argument and the logfile name as a second argument. On stdout you'll see a log of all instrumentalized functions invoked while logging was enabled.
用 Graphviz 可视化函数调用
No comments:
Post a Comment