code: def adjust_per_loop_counts(overall_cycles, data):
      """
      Use execution count and the number of entries recorded for each function/loop
      to compute the overall cycles spent on them.
      """
      for func in overall_cycles:
          func_cycles = overall_cycles[func]
          for id in func_cycles:
              exec_count = data["loop_counts"][id]
              rec_count = func_cycles[id]["count"]
              assert (
                  exec_count != 0
              ), "Execution count should have been non-zero."
              assert (
                  rec_count != 0
              ), "Entry count should have been non-zero."
              exec_cycles = (
                  (int(func_cycles[id]["cycles"])) * exec_count
              ) // rec_count
              func_cycles[id]["cycles"] = exec_cycles
              func_cycles[id]["count"] = exec_count
          overall_cycles.update(
              {func: OrderedDict(sorted(func_cycles.items()))}
          )
      return overall_cycles
  
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 4 for calling a global function with example usage: adjust_per_loop_counts(overall_cycles, data) and returns: overall_cycles