code: def trace_to_dicts(target, trace, options, pid, tid):
      """Read a file-like object |trace| containing -ftime-trace data and yields
      about:tracing dict per eligible event in that log."""
      for event in read_events(trace, options):
          # Check if any event duration is greater than the duration from ninja.
          ninja_time = (target.end - target.start) * 1000
          if event["dur"] > ninja_time:
              print(
                  "Inconsistent timing found (clang time > ninja time). Please"
                  " ensure that timings are from consistent builds."
              )
              sys.exit(1)
  
          # Set tid and pid from ninja log.
          event["pid"] = pid
          event["tid"] = tid
  
          # Offset trace time stamp by ninja start time.
          event["ts"] += target.start * 1000
  
          yield event
  
file_path: scipy/tools/ninjatracing.py
imports: import json
  import os
  import argparse
  import re
  import sys
label_desc: Use image node_id 3 for calling a global function with example usage: trace_to_dicts(target, trace, options, pid, tid) without return types