[rocpd] Refactor to use python to convert rocpd to CSV + add CSV tests + remove old cpp implementation (#159)

* Write agent info to CSV

* Write kernel to CSV

* Write memory copy to CSV

* Write memory allocation to CSV

* Write hip api to CSV

* Write hsa api to CSV

* Write marker api to CSV

* Write counters to CSV

* Write scratch memory to CSV

* Write rccl api to CSV

* Write rocdecode api to CSV

* Write rocjpeg api to CSV

* Remove info_process joins

* Format agent id

* Compose full file name is sql writer function

* Add missing fields to kernel traces csv

* Rename vgpr_count to arch_vgpr_count

* Fix kernel name

* Skip empty query results

* Format csv.py

* Delete c++ CSV writer

* Add CSV header comparison test

* Fix comment spacing in csv.py

* Change ALLOC to ALLOCATE in memory allocation writer

* Do not append trace to agent info file name

* Revert changes for VGPR_Count

* Fix csv validation test

* Add sorting by guid

* Use EXISTS to check query results are not empty

* Merge API-specific queries

* Optimize regions query

* Column name mapping for agent info

* Pass config to sql writer

* Move agent id string building to a separate function

* add titled_headers argument

* Remove titled-columns argument

* Improvements for regions csv

* fix CSV validation test

* improve CSV validation test

* remove roctxMarkA from csv validation test

* fix capability field titles in agent info

* remove filter.py from query as that is still experimental

* Remove some aliases, now that query will auto-title the column headers

---------

Co-authored-by: Aleksei Tumakaev <atumakae@amd.com>
Co-authored-by: Young Hui <young.hui@amd.com>
Co-authored-by: Young Hui - AMD <145490163+yhuiYH@users.noreply.github.com>
This commit is contained in:
systems-assistant[bot]
2025-09-19 10:15:57 -04:00
committato da GitHub
parent 9def133275
commit 3f001b0305
10 ha cambiato i file con 628 aggiunte e 986 eliminazioni
@@ -42,6 +42,7 @@ def export_sqlite_query(
export_format: Optional[str] = None,
export_path: Optional[str] = None,
dashboard_template_path: Optional[str] = None,
**kwargs: Optional[dict],
) -> Optional[str]:
"""
Execute a SQLite query and print it to console.
@@ -99,7 +100,21 @@ def export_sqlite_query(
# 3) Export based on format
if export_format == "csv":
df.to_csv(export_path, index=False)
import csv
cols = [f"{itr}" for itr in df.columns.tolist()]
col_names = (
[f"{itr}".title() for itr in cols]
if kwargs.get("title_columns", True)
else cols[:]
)
df.to_csv(
export_path,
index=False,
columns=cols,
header=col_names,
quoting=csv.QUOTE_NONNUMERIC,
)
elif export_format == "html":
write_export(df.to_html(index=False))