function getHandlerCommandsForMode(handlerName, mode) {
            var commandNames = [];

            if (mode && mode.handlers[handlerName]) {
                commandNames = commandNames.concat(mode.handlers[handlerName]);
            }
            if (config.getHandlers()[handlerName]) {
                commandNames = commandNames.concat(config.getHandlers()[handlerName]);
            }
            commandNames = commandNames.filter(function(cmdName) {
                return command.isVisible({ // Fake session
                    mode: mode
                }, command.lookup(cmdName), true);
            });
            return commandNames;
        }
Used to implement adaptive timing. This method records the time it took
to execute a particular handler and multiplies it with a multiplciation factor
to be used in the next timeout, making sure that expensive handlers aren't
using up all CPU cycles in the sandbox.