code: def create_csv_report(overall_cycles, fname):
      """Create csv report"""
      header = [
          "function name",
          "loop/function id",
          "loop depth",
          "start offset",
          "end offset",
          "pcycles",
          "parent count",
      ]
      with open(fname, "w") as f:
          writer = csv.writer(f)
          writer.writerow(header)
          for func in overall_cycles:
              func_cycles = overall_cycles[func]
              data = []
              root = -1
              outer_most = -1
              for key, value in func_cycles.items():
                  if value["parent"] == -1:
                      assert (
                          root == -1
                      ), "Can't have multiple root nodes."
                      root = key
  
                  data.append(func)
                  data.append(key)
                  if value["parent"] == -1:
                      data.append(
                          "-"
                      )  # Total cycles over all invocations of this function.
                  elif value["parent"] == root:
                      data.append(0)
                      outer_most = key
                  else:
                      if outer_most > -1:
                          data.append(key - outer_most)
                      else:
                          data.append(key - value["parent"])
                  data.append(hex(value["start"]))
                  data.append(hex(value["end"]))
                  data.append(value["cycles"])
                  data.append(value["count"])
                  writer.writerow(data)
                  data.clear()
  
file_path: tvm/python/tvm/contrib/hexagon/profiling/process_lwp_data.py
imports: import json
  import csv
  import subprocess
  import argparse
  import os
  from re import search, compile
  from collections import OrderedDict
label_desc: Use image node_id 5 for calling a global function with example usage: create_csv_report(overall_cycles, fname) without return types