'This is the basic execute method for the tests inherited from base_test.
If you want to implement a benchmark test, it\'s better to implement
the run_once function, to cope with the profiling infrastructure. For
other tests, you can just override the default implementation.
:param test_length: The minimum test length in seconds. We\'ll run the
run_once function for a number of times large enough to cover the
minimum test length.
:param iterations: A number of iterations that we\'ll run the run_once
function. This parameter is incompatible with test_length and will
be silently ignored if you specify both.
:param profile_only: If true run X iterations with profilers enabled.
If false run X iterations and one with profiling if profiles are
enabled. If None, default to the value of job.default_profile_only.
:param _get_time: [time.time] Used for unit test time injection.
:param postprocess_profiled_run: Run the postprocessing for the
profiled run.'

def execute(self, iterations=None, test_length=None, profile_only=None, _get_time=time.time, postprocess_profiled_run=None, constraints=(), *args, **dargs):

    profilers = self.job.profilers
    if profilers.active():
        profilers.stop(self)
    if (profile_only is None):
        profile_only = self.job.default_profile_only
    if (iterations and test_length):
        logging.debug('Iterations    parameter    ignored    (timed    execution)')
    if test_length:
        test_start = _get_time()
        time_elapsed = 0
        timed_counter = 0
        logging.debug('Test    started.    Specified    %d    s    as    the    minimum    test    length', test_length)
        while (time_elapsed < test_length):
            timed_counter = (timed_counter + 1)
            if (time_elapsed == 0):
                logging.debug('Executing    iteration    %d', timed_counter)
            elif (time_elapsed > 0):
                logging.debug('Executing    iteration    %d,    time_elapsed    %d    s', timed_counter, time_elapsed)
            self._call_run_once(constraints, profile_only, postprocess_profiled_run, args, dargs)
            test_iteration_finish = _get_time()
            time_elapsed = (test_iteration_finish - test_start)
        logging.debug('Test    finished    after    %d    iterations,    time    elapsed:    %d    s', timed_counter, time_elapsed)
    else:
        if (iterations is None):
            iterations = 1
        if (iterations > 1):
            logging.debug('Test    started.    Specified    %d    iterations', iterations)
        for self.iteration in xrange(1, (iterations + 1)):
            if (iterations > 1):
                logging.debug('Executing    iteration    %d    of    %d', self.iteration, iterations)
            self._call_run_once(constraints, profile_only, postprocess_profiled_run, args, dargs)
    if (not profile_only):
        self.iteration += 1
        self.run_once_profiling(postprocess_profiled_run, *args, **dargs)
    self.postprocess()
    self.process_failed_constraints()
