def METHOD_NAME(cpu):
    proc = panda.plugins['osi'].get_current_process(cpu)
    thread = panda.plugins['osi'].get_current_thread(cpu)
    global n_insns
    if proc == panda.ffi.NULL:
        print(f"Warning: Unable to identify process at {n_insns}")
        return
    if thread == panda.ffi.NULL:
        print(f"Warning: Unable to identify thread at {n_insns}")
        return
    proc_key = (proc.pid, thread.tid)
    if proc_key not in procinfo:
        procinfo[proc_key] = {"names": set(), #"tids": set(),
                              "first": total_insns, "last": None,
                              "count": 0}
    name = panda.ffi.string(proc.name)  if proc.name != panda.ffi.NULL else "(error)"
    procinfo[proc_key]["names"].add(name)
    #procinfo[proc_key]["tids"].add(thread.tid)
    # Update insn count for last process and indicate it (maybe) ends at total_insns-1
    global last_pid
    if last_pid:
        # count since we last ran is it's old end value, minus where it just ended
        procinfo[last_pid]["count"] += (total_insns-1) - procinfo[last_pid]["last"]  \
                                        if procinfo[last_pid]["last"] is not None \
                                        else (total_insns-1) - procinfo[last_pid]["first"]
        procinfo[last_pid]["last"] = total_insns-1
    last_pid = proc_key
    time_data.append((proc_key, n_insns))
    n_insns = 0