Merge pull request #124 from feizheng10/save_dfs

refactoring saved df files
This commit is contained in:
Cole Ramos
2023-05-10 10:43:00 -05:00
committad av GitHub
förälder 27952a57c0 2e0a603930
incheckning 8f9f607083
4 ändrade filer med 30 tillägg och 24 borttagningar
+1
Visa fil
@@ -208,6 +208,7 @@ def run_cli(args, runs):
runs,
archConfigs["gfx90a"],
output,
args.df_file_dir,
args.decimal,
args.time_unit,
args.cols,
-15
Visa fil
@@ -718,21 +718,6 @@ def load_table_data(workload, dir, is_gui, debug, verbose):
debug,
)
# Save workload
name = "saved_analysis"
out_path = os.path.join(dir, name)
try:
os.mkdir(out_path)
if verbose >= 1:
print("Created a Saved Analysis folder")
except OSError as error:
if verbose >= 1:
print("Saved Analysis folder exists")
for id, df in workload.dfs.items():
if "coll_level" in list(df.columns):
df = df.drop(["coll_level", "Tips"], axis=1)
df.to_csv(os.path.join(out_path, str(id) + ".csv"), index=False)
def build_comparable_columns(time_unit):
"""
+23 -9
Visa fil
@@ -23,6 +23,7 @@
##############################################################################el
import pandas as pd
from pathlib import Path
from tabulate import tabulate
from omniperf_analyze.utils import schema, parser
@@ -47,7 +48,9 @@ def string_multiple_lines(source, width, max_rows):
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.
"""
@@ -152,15 +155,26 @@ def show_all(runs, archConfigs, output, decimal, time_unit, selected_cols, verbo
if not df.empty:
# 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"]:
ss += (
str(table_config["id"] // 100)
+ "."
+ str(table_config["id"] % 100)
+ " "
+ table_config["title"]
+ "\n"
)
ss += table_id_str + " " + table_config["title"] + "\n"
if df_file_dir:
p = Path(df_file_dir)
if not p.exists():
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:
# "columnwise: True" is a special attr of a table/df
+6
Visa fil
@@ -476,6 +476,12 @@ def parse(my_parser):
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(
"--cols",
type=int,