code: def build_log_map(log_file):
      entries = {}
      log_path = os.path.dirname(os.path.abspath(log_file))
      with open(log_file) as log:
          last = 0
          files = {}
          for line in log:
              entry = line.split()
              if len(entry) > 4:
                  obj_file = entry[3]
                  file_size = (
                      os.path.getsize(os.path.join(log_path, obj_file))
                      if os.path.exists(obj_file)
                      else 0
                  )
                  start = int(entry[0])
                  end = int(entry[1])
                  # logic based on ninjatracing
                  if end < last:
                      files = {}
                  last = end
                  files.setdefault(
                      entry[4], (entry[3], start, end, file_size)
                  )
  
          # build entries from files dict
          for entry in files.values():
              entries[entry[0]] = (entry[1], entry[2], entry[3])
  
      return entries
  
file_path: cudf/cpp/scripts/sort_ninja_log.py
imports: import argparse
  import os
  import sys
  import xml.etree.ElementTree
  from pathlib import Path
  from xml.dom import minidom
label_desc: Use image node_id 1 for calling a global function with example usage: build_log_map(log_file) and returns: entries