code: def benchmark_common_options(cmd):
      def check_language(ctx, param, value):
          if value not in {"cpp", "java"}:
              raise click.BadParameter("cpp or java is supported now")
          return value
  
      options = [
          click.option(
              "--src",
              metavar="<arrow_src>",
              show_default=True,
              default=None,
              callback=validate_arrow_sources,
              help="Specify Arrow source directory",
          ),
          click.option(
              "--preserve",
              type=BOOL,
              default=False,
              show_default=True,
              is_flag=True,
              help="Preserve workspace for investigation.",
          ),
          click.option(
              "--output",
              metavar="<output>",
              type=click.File("w", encoding="utf8"),
              default=None,
              help="Capture output result into file.",
          ),
          click.option(
              "--language",
              metavar="<lang>",
              type=str,
              default="cpp",
              show_default=True,
              callback=check_language,
              help="Specify target language for the benchmark",
          ),
          click.option(
              "--build-extras",
              type=str,
              multiple=True,
              help="Extra flags/options to pass to mvn build. "
              "Can be stacked. For language=java",
          ),
          click.option(
              "--benchmark-extras",
              type=str,
              multiple=True,
              help="Extra flags/options to pass to mvn benchmark. "
              "Can be stacked. For language=java",
          ),
          click.option(
              "--cmake-extras",
              type=str,
              multiple=True,
              help="Extra flags/options to pass to cmake invocation. "
              "Can be stacked. For language=cpp",
          ),
          click.option(
              "--cpp-benchmark-extras",
              type=str,
              multiple=True,
              help="Extra flags/options to pass to C++ benchmark executables. "
              "Can be stacked. For language=cpp",
          ),
      ]
  
      cmd = java_toolchain_options(cmd)
      cmd = cpp_toolchain_options(cmd)
      return _apply_options(cmd, options)
  
imports: from collections import namedtuple
  from io import StringIO
  import click
  import json
  import logging
  import os
  import pathlib
  import sys
  from .benchmark.codec import JsonEncoder
  from .benchmark.compare import RunnerComparator, DEFAULT_THRESHOLD
  from .benchmark.runner import CppBenchmarkRunner, JavaBenchmarkRunner
  from .compat import _import_pandas
  from .lang.cpp import CppCMakeDefinition, CppConfiguration
  from .utils.cli import ArrowBool, validate_arrow_sources, add_optional_command
  from .utils.lint import linter, python_numpydoc, LintValidationException
  from .utils.logger import logger, ctx
  from .utils.source import ArrowSources
  from .utils.tmpdir import tmpdir
label_desc: Use image node_id 11 for calling a global function with example usage: benchmark_common_options(cmd) and returns: _apply_options, value