Merge pull request #126 from feizheng10/simplify_show_all
Simplify interface of tty show
[ROCm/rocprofiler-compute commit: 6dd77db61e]
Cette révision appartient à :
@@ -202,18 +202,9 @@ def run_cli(args, runs):
|
|||||||
runs[d[0]], d[0], is_gui, args.g, args.verbose
|
runs[d[0]], d[0], is_gui, args.g, args.verbose
|
||||||
) # create the loaded table
|
) # create the loaded table
|
||||||
if args.list_kernels:
|
if args.list_kernels:
|
||||||
tty.show_kernels(runs, archConfigs["gfx90a"], output, args.decimal)
|
tty.show_kernels(args, runs, archConfigs["gfx90a"], output)
|
||||||
else:
|
else:
|
||||||
tty.show_all(
|
tty.show_all(args, runs, archConfigs["gfx90a"], output)
|
||||||
runs,
|
|
||||||
archConfigs["gfx90a"],
|
|
||||||
output,
|
|
||||||
args.df_file_dir,
|
|
||||||
args.decimal,
|
|
||||||
args.time_unit,
|
|
||||||
args.cols,
|
|
||||||
args.verbose,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def roofline_only(path_to_dir, dev_id, sort_type, mem_level, kernel_names, verbose):
|
def roofline_only(path_to_dir, dev_id, sort_type, mem_level, kernel_names, verbose):
|
||||||
|
|||||||
@@ -48,13 +48,11 @@ def string_multiple_lines(source, width, max_rows):
|
|||||||
return "\n".join(lines)
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
def show_all(
|
def show_all(args, runs, archConfigs, output):
|
||||||
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.
|
||||||
"""
|
"""
|
||||||
comparable_columns = parser.build_comparable_columns(time_unit)
|
comparable_columns = parser.build_comparable_columns(args.time_unit)
|
||||||
|
|
||||||
for panel_id, panel in archConfigs.panel_configs.items():
|
for panel_id, panel in archConfigs.panel_configs.items():
|
||||||
# Skip panels that don't support baseline comparison
|
# Skip panels that don't support baseline comparison
|
||||||
@@ -72,11 +70,8 @@ def show_all(
|
|||||||
|
|
||||||
for header in list(base_df.keys()):
|
for header in list(base_df.keys()):
|
||||||
if (
|
if (
|
||||||
(not selected_cols)
|
(not args.cols)
|
||||||
or (
|
or (args.cols and base_df.columns.get_loc(header) in args.cols)
|
||||||
selected_cols
|
|
||||||
and base_df.columns.get_loc(header) in selected_cols
|
|
||||||
)
|
|
||||||
or (type == "raw_csv_table")
|
or (type == "raw_csv_table")
|
||||||
):
|
):
|
||||||
if header in hidden_columns:
|
if header in hidden_columns:
|
||||||
@@ -126,7 +121,7 @@ def show_all(
|
|||||||
.pct_change(axis="columns")
|
.pct_change(axis="columns")
|
||||||
.iloc[:, 1]
|
.iloc[:, 1]
|
||||||
)
|
)
|
||||||
if verbose >= 2:
|
if args.verbose >= 2:
|
||||||
print("---------", header, t_df)
|
print("---------", header, t_df)
|
||||||
|
|
||||||
# show value + percentage
|
# show value + percentage
|
||||||
@@ -134,12 +129,12 @@ def show_all(
|
|||||||
t_df = (
|
t_df = (
|
||||||
cur_df[header]
|
cur_df[header]
|
||||||
.astype(float)
|
.astype(float)
|
||||||
.round(decimal)
|
.round(args.decimal)
|
||||||
.map(str)
|
.map(str)
|
||||||
+ " ("
|
+ " ("
|
||||||
+ t_df.astype(float)
|
+ t_df.astype(float)
|
||||||
.mul(100)
|
.mul(100)
|
||||||
.round(decimal)
|
.round(args.decimal)
|
||||||
.map(str)
|
.map(str)
|
||||||
+ "%)"
|
+ "%)"
|
||||||
)
|
)
|
||||||
@@ -147,7 +142,9 @@ def show_all(
|
|||||||
df = pd.concat([df, t_df], axis=1)
|
df = pd.concat([df, t_df], axis=1)
|
||||||
else:
|
else:
|
||||||
cur_df[header] = [
|
cur_df[header] = [
|
||||||
round(float(x), decimal) if x != "" else x
|
round(float(x), args.decimal)
|
||||||
|
if x != ""
|
||||||
|
else x
|
||||||
for x in base_df[header]
|
for x in base_df[header]
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -164,8 +161,8 @@ def show_all(
|
|||||||
if "title" in table_config and table_config["title"]:
|
if "title" in table_config and table_config["title"]:
|
||||||
ss += table_id_str + " " + table_config["title"] + "\n"
|
ss += table_id_str + " " + table_config["title"] + "\n"
|
||||||
|
|
||||||
if df_file_dir:
|
if args.df_file_dir:
|
||||||
p = Path(df_file_dir)
|
p = Path(args.df_file_dir)
|
||||||
if not p.exists():
|
if not p.exists():
|
||||||
p.mkdir()
|
p.mkdir()
|
||||||
if p.is_dir():
|
if p.is_dir():
|
||||||
@@ -191,7 +188,7 @@ def show_all(
|
|||||||
else df,
|
else df,
|
||||||
headers="keys",
|
headers="keys",
|
||||||
tablefmt="fancy_grid",
|
tablefmt="fancy_grid",
|
||||||
floatfmt="." + str(decimal) + "f",
|
floatfmt="." + str(args.decimal) + "f",
|
||||||
)
|
)
|
||||||
+ "\n"
|
+ "\n"
|
||||||
)
|
)
|
||||||
@@ -202,7 +199,7 @@ def show_all(
|
|||||||
print(ss, file=output)
|
print(ss, file=output)
|
||||||
|
|
||||||
|
|
||||||
def show_kernels(runs, archConfigs, output, decimal):
|
def show_kernels(args, runs, archConfigs, output):
|
||||||
"""
|
"""
|
||||||
Show the kernels from top stats.
|
Show the kernels from top stats.
|
||||||
"""
|
"""
|
||||||
@@ -222,7 +219,10 @@ def show_kernels(runs, archConfigs, output, decimal):
|
|||||||
|
|
||||||
print(
|
print(
|
||||||
tabulate(
|
tabulate(
|
||||||
df, headers="keys", tablefmt="fancy_grid", floatfmt="." + str(decimal) + "f"
|
df,
|
||||||
|
headers="keys",
|
||||||
|
tablefmt="fancy_grid",
|
||||||
|
floatfmt="." + str(args.decimal) + "f",
|
||||||
),
|
),
|
||||||
file=output,
|
file=output,
|
||||||
)
|
)
|
||||||
|
|||||||
Référencer dans un nouveau ticket
Bloquer un utilisateur