Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.1
1.4.2
42 changes: 26 additions & 16 deletions perf-postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,23 @@ def get_all_data_lines(input_file_path):
return meta_data_lines, perf_events_lines, perf_data_lines


# return the number of cpus in a set
# example sets:
# simple range: "0-95"
# individual cpus: "1+4+5+9"
# individual cpus and range(s): "1+4-7+9+12-14"
def count_cpus_in_set(cpu_set):
count = 0
subsets = cpu_set.split("+")
for subset in subsets:
if "-" in subset:
low_high = subset.split("-")
count += int(low_high[1]) - int(low_high[0]) + 1
else:
count += 1
return count


# get_metadata
def get_metadata_as_dict(meta_data_lines, txns=None):
meta_data = {}
Expand Down Expand Up @@ -312,14 +329,7 @@ def get_metadata_as_dict(meta_data_lines, txns=None):
assert len(docker_HASH) == len(docker_SETS)
meta_data["CPUSETS"] = {}
for i, docker_SET in enumerate(docker_SETS):
if "-" in docker_SET: # range of cpus
num_of_cpus = (
int(docker_SET.split("-")[1])
- int(docker_SET.split("-")[0])
+ 1
)
else: # either one cpu, or a list of cpus separated by + sign
num_of_cpus = len(docker_SET.split("+"))
num_of_cpus = count_cpus_in_set(docker_SET)
meta_data["CPUSETS"][docker_HASH[i]] = num_of_cpus

elif line.startswith("Percpu mode"):
Expand Down Expand Up @@ -542,9 +552,11 @@ def extract_dataframe(perf_data_lines, meta_data, perf_mode):

# fix metric name X.1, X.2, etc -> just X
perf_data_df["metric"] = perf_data_df.apply(
lambda x: ".".join(x["metric"].split(".")[:-1])
if len(re.findall(r"^[0-9]*$", x["metric"].split(".")[-1])) > 0
else x["metric"],
lambda x: (
".".join(x["metric"].split(".")[:-1])
if len(re.findall(r"^[0-9]*$", x["metric"].split(".")[-1])) > 0
else x["metric"]
),
axis=1,
)

Expand Down Expand Up @@ -844,11 +856,11 @@ def substitute_event_in_expression(
if event_df.shape == (1,): # system wide
if "sys" not in evaluated_expressions:
evaluated_expressions["sys"] = exp_to_evaluate.replace(
"[" + event + "]", str(event_df[0])
"[" + event + "]", str(event_df.iloc[0])
)
else:
evaluated_expressions["sys"] = evaluated_expressions["sys"].replace(
"[" + event + "]", str(event_df[0])
"[" + event + "]", str(event_df.iloc[0])
)
else:
for index in event_df.index:
Expand Down Expand Up @@ -1016,9 +1028,7 @@ def generate_metrics(
+ (
"System"
if perf_mode == Mode.System
else "CPU"
if perf_mode == Mode.CPU
else "Socket"
else "CPU" if perf_mode == Mode.CPU else "Socket"
)
+ " mode"
)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black==22.8.0
black==24.8.0
flake8
pytype
simpleeval
Expand Down
8 changes: 4 additions & 4 deletions src/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<link rel="icon" type="image/x-icon" href="https://www.intel.com/favicon.ico" />
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, width=device-width" />
<script src="https://unpkg.com/react@latest/umd/react.development.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/react-dom@latest/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@mui/material@latest/umd/material-ui.development.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/babel-standalone@latest/babel.min.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/react@18.3.1/umd/react.development.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@mui/material@5.16.7/umd/material-ui.development.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/babel-standalone@6.26.0/babel.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.3.3/echarts.min.js"
integrity="sha512-2L0h0GhoIHQEjti/1KwfjcbyaTHy+hPPhE1o5wTCmviYcPO/TD9oZvUxFQtWvBkCSTIpt+fjsx1CCx6ekb51gw=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
Expand Down
2 changes: 1 addition & 1 deletion src/perf_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def nmi_watchdog_enabled():
return None
try:
nmi_watchdog_status = int(proc_output.decode().strip())
except (ValueError) as e:
except ValueError as e:
logging.warning(f"Failed to interpret nmi_watchdog status: {e}")
return None
return nmi_watchdog_status == 1
Expand Down