viz: tabulate sqtt (#13078)

* viz: tabulate sqtt

* nomore asdict
This commit is contained in:
qazal 2025-11-04 00:03:15 +08:00 committed by GitHub
commit 2d2040bc92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,7 +1,6 @@
#!/usr/bin/env python3
import multiprocessing, pickle, difflib, os, threading, json, time, sys, webbrowser, socket, argparse, socketserver, functools, codecs, io, struct
import subprocess, ctypes, pathlib
from dataclasses import asdict
from contextlib import redirect_stdout
from decimal import Decimal
from http.server import BaseHTTPRequestHandler
@ -197,7 +196,8 @@ def mem_layout(dev_events:list[tuple[int, int, float, DevEvent]], start_ts:int,
def load_sqtt(profile:list[ProfileEvent]) -> None:
from extra.sqtt.roc import decode
rctx = decode(profile)
steps = [{"name":x[0], "depth":0, "data":{"src":json.dumps({k:asdict(v) for k,v in x[1].items()}, indent=2), "lang":"txt", "device":"AMD"},
steps = [{"name":x[0], "depth":0, "data":{"rows":[(e.inst, e.hit, e.lat, e.stall, str(e.typ).split("_")[-1]) for e in x[1].values()],
"cols":["Instruction", "Hit Count", "Latency", "Stall", "Type"], "summary":[]},
"query":f"/render?ctx={len(ctxs)}&step={i}&fmt=counters"} for i,x in enumerate(rctx.wave_events.items())]
if steps: ctxs.append({"name":"Counters", "steps":steps})