add option to save dfs

Signed-off-by: fei.zheng <fei.zheng@amd.com>


[ROCm/rocprofiler-compute commit: 1104371651]
This commit is contained in:
fei.zheng
2023-05-03 17:45:29 -06:00
parent 9e42cd9ef1
commit c8df0bf75f
3 changed files with 27 additions and 9 deletions
@@ -209,6 +209,7 @@ def run_cli(args, runs):
runs, runs,
archConfigs["gfx90a"], archConfigs["gfx90a"],
output, output,
args.df_file_dir,
args.decimal, args.decimal,
args.time_unit, args.time_unit,
args.cols, args.cols,
@@ -23,6 +23,7 @@
##############################################################################el ##############################################################################el
import pandas as pd import pandas as pd
from pathlib import Path
from tabulate import tabulate from tabulate import tabulate
from omniperf_analyze.utils import schema, parser from omniperf_analyze.utils import schema, parser
@@ -47,7 +48,8 @@ def string_multiple_lines(source, width, max_rows):
return "\n".join(lines) return "\n".join(lines)
def show_all(runs, archConfigs, output, decimal, time_unit, selected_cols, verbose): def show_all(runs, archConfigs, output, df_file_dir, decimal, time_unit,
selected_cols, verbose):
""" """
Show all panels with their data in plain text mode. Show all panels with their data in plain text mode.
""" """
@@ -152,15 +154,24 @@ def show_all(runs, archConfigs, output, decimal, time_unit, selected_cols, verbo
if not df.empty: if not df.empty:
# subtitle for each table in a panel if existing # subtitle for each table in a panel if existing
table_id_str = str(table_config["id"] // 100) + "." + str(
table_config["id"] % 100)
if "title" in table_config and table_config["title"]: if "title" in table_config and table_config["title"]:
ss += ( ss += (table_id_str + " " + table_config["title"] +
str(table_config["id"] // 100) "\n")
+ "."
+ str(table_config["id"] % 100) if df_file_dir:
+ " " p = Path(df_file_dir)
+ table_config["title"] if not p.exists():
+ "\n" p.mkdir()
) if p.is_dir():
if "title" in table_config and table_config[
"title"]:
table_id_str += ("_" + table_config["title"])
df.to_csv(p.joinpath(
table_id_str.replace(" ", "_") + ".csv"),
index=False)
# NB: # NB:
# "columnwise: True" is a special attr of a table/df # "columnwise: True" is a special attr of a table/df
@@ -468,6 +468,12 @@ def parse(my_parser):
default=2, default=2,
help="\t\tSpecify the decimal to display. (DEFAULT: 2)", help="\t\tSpecify the decimal to display. (DEFAULT: 2)",
) )
analyze_group.add_argument(
"--save-dfs",
dest="df_file_dir",
metavar="",
help="\t\tSpecify the dirctory to save analysis dataframe csv files.",
)
analyze_group.add_argument( analyze_group.add_argument(
"--cols", "--cols",
type=int, type=int,