Sampling profiler - Factor Documentation (original) (raw)
The tools.profiler.sampling vocabulary provides an interface to Factor's sampling profiler. It provides words for running the profiler: profile ( quot -- )
General statistics can then be collected:
gc-time ( -- n )
foreign-time ( -- n )
foreign-thread-time ( -- n )
More detailed by-function profile reports can be generated:
top-down-max-depth ( max-depth -- tree )
cross-section ( depth -- tree )
flat ( -- flat )
The report data can then be printed:
Profile data can be saved for future reporting:
most-recent-profile-data ( -- profile-data )
top-down* ( profile-data -- tree )
top-down-max-depth* ( max-depth profile-data -- tree )
cross-section* ( depth profile-data -- tree )
flat* ( profile-data -- flat )
For example, the following will profile a call to the foo word, and generate and display a top-down tree profile from the results:
[ foo ] profile top-down profile.