Skip to content

Commit

Permalink
reformatting
Browse files Browse the repository at this point in the history
Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com>
  • Loading branch information
JoseSantosAMD committed Aug 15, 2023
1 parent c81df91 commit 7173d06
Showing 1 changed file with 80 additions and 80 deletions.
160 changes: 80 additions & 80 deletions src/omniperf_analyze/utils/tty.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,86 +33,86 @@


def smartUnits(df):
for idx, row in df[df["Unit"] == "Gb/s"].items():
for curr_metric in row:
curr_row = df[df["Metric"] == curr_metric]
if not curr_row.empty:
if "Value" in curr_row:
if isinstance(
curr_row["Value"][0],
float,
):
if curr_row.Value[0] < 0.001:
df.loc[
(df["Metric"] == curr_metric),
"Unit",
] = "Kb/s"
df.loc[
(df["Metric"] == curr_metric),
"Value",
] = (
1000000 * curr_row.Value
)
elif curr_row.Value[0] < 1:
df.loc[
(df["Metric"] == curr_metric),
"Unit",
] = "Mb/s"
df.loc[
(df["Metric"] == curr_metric),
"Value",
] = (
1000 * curr_row.Value
)
elif "Avg" in curr_row:
if isinstance(curr_row["Avg"][0], float):
if curr_row.Avg[0] < 0.001:
df.loc[
(df["Metric"] == curr_metric),
"Unit",
] = "Kb/s"
df.loc[
(df["Metric"] == curr_metric),
"Avg",
] = (
1000000 * curr_row.Avg
)
df.loc[
(df["Metric"] == curr_metric),
"Min",
] = (
1000000 * curr_row.Min
)
df.loc[
(df["Metric"] == curr_metric),
"Max",
] = (
1000000 * curr_row.Max
)
elif curr_row.Avg[0] < 1:
df.loc[
(df["Metric"] == curr_metric),
"Unit",
] = "Mb/s"
df.loc[
(df["Metric"] == curr_metric),
"Avg",
] = (
1000 * curr_row.Avg
)
df.loc[
(df["Metric"] == curr_metric),
"Min",
] = (
1000 * curr_row.Min
)
df.loc[
(df["Metric"] == curr_metric),
"Max",
] = (
1000 * curr_row.Max
)
return df
for idx, row in df[df["Unit"] == "Gb/s"].items():
for curr_metric in row:
curr_row = df[df["Metric"] == curr_metric]
if not curr_row.empty:
if "Value" in curr_row:
if isinstance(
curr_row["Value"][0],
float,
):
if curr_row.Value[0] < 0.001:
df.loc[
(df["Metric"] == curr_metric),
"Unit",
] = "Kb/s"
df.loc[
(df["Metric"] == curr_metric),
"Value",
] = (
1000000 * curr_row.Value
)
elif curr_row.Value[0] < 1:
df.loc[
(df["Metric"] == curr_metric),
"Unit",
] = "Mb/s"
df.loc[
(df["Metric"] == curr_metric),
"Value",
] = (
1000 * curr_row.Value
)
elif "Avg" in curr_row:
if isinstance(curr_row["Avg"][0], float):
if curr_row.Avg[0] < 0.001:
df.loc[
(df["Metric"] == curr_metric),
"Unit",
] = "Kb/s"
df.loc[
(df["Metric"] == curr_metric),
"Avg",
] = (
1000000 * curr_row.Avg
)
df.loc[
(df["Metric"] == curr_metric),
"Min",
] = (
1000000 * curr_row.Min
)
df.loc[
(df["Metric"] == curr_metric),
"Max",
] = (
1000000 * curr_row.Max
)
elif curr_row.Avg[0] < 1:
df.loc[
(df["Metric"] == curr_metric),
"Unit",
] = "Mb/s"
df.loc[
(df["Metric"] == curr_metric),
"Avg",
] = (
1000 * curr_row.Avg
)
df.loc[
(df["Metric"] == curr_metric),
"Min",
] = (
1000 * curr_row.Min
)
df.loc[
(df["Metric"] == curr_metric),
"Max",
] = (
1000 * curr_row.Max
)
return df


def string_multiple_lines(source, width, max_rows):
Expand Down

0 comments on commit 7173d06

Please sign in to comment.