'Returns a list of all benchmarks.
A benchmark is a tuple containing a method name and a list of tree
numbers.  Trees are prepared by the setup function.'

def benchmarks(self):

    all_trees = self._all_trees()
    benchmarks = []
    for name in dir(self):
        if (not name.startswith('bench_')):
            continue
        method = getattr(self, name)
        if (hasattr(method, 'LIBS') and (self.lib_name not in method.LIBS)):
            method_call = None
        else:
            method_call = method
        if method.__doc__:
            tree_sets = method.__doc__.split()
        else:
            tree_sets = ()
        if tree_sets:
            tree_tuples = [list(map(int, tree_set.split(','))) for tree_set in tree_sets]
        else:
            try:
                arg_count = (method.func_code.co_argcount - 1)
            except AttributeError:
                try:
                    arg_count = (method.__code__.co_argcount - 1)
                except AttributeError:
                    arg_count = 1
            tree_tuples = self._permutations(all_trees, arg_count)
        serialized = getattr(method, 'STRING', False)
        children = getattr(method, 'CHILDREN', False)
        no_change = getattr(method, 'NO_CHANGE', False)
        for tree_tuple in tree_tuples:
            for tn in sorted(getattr(method, 'TEXT', (0,))):
                for an in sorted(getattr(method, 'ATTRIBUTES', (0,))):
                    benchmarks.append((name, method_call, tree_tuple, tn, an, serialized, children, no_change))
    return benchmarks
