def _construct_extra_atrace_args(options, categories):
  """Construct extra arguments (-a, -k, categories) for atrace command.

  Args:
      options: Tracing options.
      categories: Categories of trace events to capture.
  """
  extra_args = []

  if options.app_name is not None:
    extra_args.extend(['-a', options.app_name])

  if options.kfuncs is not None:
    extra_args.extend(['-k', options.kfuncs])

  extra_args.extend(categories)
  return extra_args