The initial version that landed for T133646 (https://gerrit.wikimedia.org/r/444773) measures the time spent in execute() and in runScript() for a given module.
This currently misses out on anything asynchronous, such as a $.ready or mw.requestIdleCallback closure.
The idea is to, when the profiler is enabled, instrument these during execution and measure their time as well.