Profiler

cmprof is a poor man's profiler.

Usage: cmprof [options] { project.cmp }

The profiler compiles libraries and program using the profile configuration. That means each function is instrumented with a calls to take the timestamp in the start and end of the function. The timestamps are saved to a binary file when profiling the program. The profiler calculates profiling metrics from the timestamps and reports results. Compiler-generated functions are not profiled, only user code.

Long option Short option IDE command Description
--help -h Print help.
--verbose -v Be verbose.
--rebuild-sys -rs Profile | Rebuild | System Rebuild system libraries using the profile configuration. If this option is not given, compiles only the first time and if system library sources changed.
--rebuild-app -ra Profile | Rebuild | Application Rebuild application libraries and the program using the profile configuration. If this option is not given, compiles application only the first time and if application sources changed.
--inclusive -s Profile | Report | Elapsed Time Inclusive Report elapsed inclusive time. Inclusive time includes the time spent in called child functions of a function.
--exclusive -x Profile | Report | Elapsed Time Exclusive Report elapsed exclusive time. Exclusive time does not include time spent in called child function of a function.
--count -c Profile | Report | Execution Count Report number of times a function is called during the profile session.
--all -a Report inclusive and exclusive time and execution count of functions.
--emit-llvm -l Build | Options | Emit LLVM intermediate code Emit LLVM intermediate code to .ll files while compiling.
--emit-opt-llvm -o Build | Options | Emit optimized LLVM intermediate code Emit optimized LLVM intermediate code to .opt.ll files while compiling.
--link-with-debug-runtime -d Build | Options | Link with debug runtime Link with debug version of the runtime library cmrt2xx(d).dll.
--link-using-ms-link -m Build | Options | Use Microsoft's link.exe as the linker Use Microsoft's link.exe as the linker. Link.exe must be found from the PATH. If not given uses LLVM's lld-link as the linker.
--top=N -t=N Show combo box. Report top N functions. If N=* report all functions called during the profile sesssion.

This is an example of a profile report.