code: def check_example_timing(rcheck_dir: Path, threshold: float) -> None:
      with open(rcheck_dir / "xgboost-Ex.timings", "r") as fd:
          timings = fd.readlines()
          newlines = []
          for line in timings:
              line = line.strip()
              newlines.append(line)
          con_timings = "\n".join(newlines)
          df = pd.read_csv(StringIO(con_timings), delimiter="\t")
          ratio_n = "user/elapsed"
          df[ratio_n] = df["user"] / df["elapsed"]
          offending = df[df[ratio_n] > threshold]
  
      try:
          # requires the tabulate package
          df.to_markdown("timings.md")
          offending.to_markdown("offending.md")
      except ImportError:
          print("failed to export markdown files.")
          pass
  
      if offending.shape[0] == 0:
          return
  
      print(offending)
      raise ValueError("There are examples using too many threads")
  
file_path: xgboost/tests/ci_build/test_r_package.py
imports: import argparse
  import os
  import shutil
  import subprocess
  from io import StringIO
  from pathlib import Path
  from platform import system
  from test_utils import R_PACKAGE, ROOT, DirectoryExcursion, cd, print_time, record_time
label_desc: Use image node_id 4 for calling a global function with example usage: check_example_timing(rcheck_dir, threshold) without return types