Command Profiler is a mod which lets you profile commands and functions using /cmdprof.
You can start the profiler if you have operator privileges using the /cmdprof enable command. For the profiler to stop collecting data do /cmdprof disable, and to reset the current profiled data do /cmdprof reset.
There are three different formats for taking the data
print)save)save except you need to provide bytes as an argument)This does mean that you need access to the server console to view the profiler results.
There are print and save subcommands for viewing the profiler results over the entire duration of the profiler running. (print is sorted by total time taken)
And there are print_trace and save_trace subcommands for viewing the profiler results over the last captured tick. (ordered by execution)
You can configure the profiler using the /cmdprof config subcommand, there are currently 4 options:
granularity - when set to command all commands will be profiled, and when set to function commands will not be profiled individuallymacro_commands_as_templates - when set to false, commands which have macros will have their arguments inlined into the commandfunction_line_numbers - when set to true, commands will include their line number, instead of being set to 0collect_memory_usage, when set to true, all events will track the memory usage (this reduces the performance by quite a bit, not worth using it unless you're trying to make a mod which fixes memory usage issues)macro_function_instantiation_events, when set to true, profiler results will include how long it takes to instantiate a macro function as a separate step, instead of merging it with the command that executes the instantiationYou can open the profiler online using /cmdprof online view, and stop it using /cmdprof online stop. Note that you need to enable the profiler using /cmdprof enable first, otherwise there will be no data provided.
The profiler automatically refreshes data every second when it is running.

A mod which profiles commands and functions