Skip to content

Commit 4ec6d4d

Browse files
authored
Merge pull request #73 from intel/prep142
Prep142
2 parents 6d0dcc9 + edff0c3 commit 4ec6d4d

File tree

5 files changed

+33
-23
lines changed

5 files changed

+33
-23
lines changed

_version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.1
1+
1.4.2

perf-postprocess.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,23 @@ def get_all_data_lines(input_file_path):
254254
return meta_data_lines, perf_events_lines, perf_data_lines
255255

256256

257+
# return the number of cpus in a set
258+
# example sets:
259+
# simple range: "0-95"
260+
# individual cpus: "1+4+5+9"
261+
# individual cpus and range(s): "1+4-7+9+12-14"
262+
def count_cpus_in_set(cpu_set):
263+
count = 0
264+
subsets = cpu_set.split("+")
265+
for subset in subsets:
266+
if "-" in subset:
267+
low_high = subset.split("-")
268+
count += int(low_high[1]) - int(low_high[0]) + 1
269+
else:
270+
count += 1
271+
return count
272+
273+
257274
# get_metadata
258275
def get_metadata_as_dict(meta_data_lines, txns=None):
259276
meta_data = {}
@@ -312,14 +329,7 @@ def get_metadata_as_dict(meta_data_lines, txns=None):
312329
assert len(docker_HASH) == len(docker_SETS)
313330
meta_data["CPUSETS"] = {}
314331
for i, docker_SET in enumerate(docker_SETS):
315-
if "-" in docker_SET: # range of cpus
316-
num_of_cpus = (
317-
int(docker_SET.split("-")[1])
318-
- int(docker_SET.split("-")[0])
319-
+ 1
320-
)
321-
else: # either one cpu, or a list of cpus separated by + sign
322-
num_of_cpus = len(docker_SET.split("+"))
332+
num_of_cpus = count_cpus_in_set(docker_SET)
323333
meta_data["CPUSETS"][docker_HASH[i]] = num_of_cpus
324334

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

543553
# fix metric name X.1, X.2, etc -> just X
544554
perf_data_df["metric"] = perf_data_df.apply(
545-
lambda x: ".".join(x["metric"].split(".")[:-1])
546-
if len(re.findall(r"^[0-9]*$", x["metric"].split(".")[-1])) > 0
547-
else x["metric"],
555+
lambda x: (
556+
".".join(x["metric"].split(".")[:-1])
557+
if len(re.findall(r"^[0-9]*$", x["metric"].split(".")[-1])) > 0
558+
else x["metric"]
559+
),
548560
axis=1,
549561
)
550562

@@ -844,11 +856,11 @@ def substitute_event_in_expression(
844856
if event_df.shape == (1,): # system wide
845857
if "sys" not in evaluated_expressions:
846858
evaluated_expressions["sys"] = exp_to_evaluate.replace(
847-
"[" + event + "]", str(event_df[0])
859+
"[" + event + "]", str(event_df.iloc[0])
848860
)
849861
else:
850862
evaluated_expressions["sys"] = evaluated_expressions["sys"].replace(
851-
"[" + event + "]", str(event_df[0])
863+
"[" + event + "]", str(event_df.iloc[0])
852864
)
853865
else:
854866
for index in event_df.index:
@@ -1016,9 +1028,7 @@ def generate_metrics(
10161028
+ (
10171029
"System"
10181030
if perf_mode == Mode.System
1019-
else "CPU"
1020-
if perf_mode == Mode.CPU
1021-
else "Socket"
1031+
else "CPU" if perf_mode == Mode.CPU else "Socket"
10221032
)
10231033
+ " mode"
10241034
)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
black==22.8.0
1+
black==24.8.0
22
flake8
33
pytype
44
simpleeval

src/base.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
<link rel="icon" type="image/x-icon" href="https://www.intel.com/favicon.ico" />
1111
<meta charset="utf-8" />
1212
<meta name="viewport" content="initial-scale=1, width=device-width" />
13-
<script src="https://unpkg.com/react@latest/umd/react.development.js" crossorigin="anonymous"></script>
14-
<script src="https://unpkg.com/react-dom@latest/umd/react-dom.development.js"></script>
15-
<script src="https://unpkg.com/@mui/material@latest/umd/material-ui.development.js" crossorigin="anonymous"></script>
16-
<script src="https://unpkg.com/babel-standalone@latest/babel.min.js" crossorigin="anonymous"></script>
13+
<script src="https://unpkg.com/react@18.3.1/umd/react.development.js" crossorigin="anonymous"></script>
14+
<script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.development.js"></script>
15+
<script src="https://unpkg.com/@mui/material@5.16.7/umd/material-ui.development.js" crossorigin="anonymous"></script>
16+
<script src="https://unpkg.com/babel-standalone@6.26.0/babel.min.js" crossorigin="anonymous"></script>
1717
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.3.3/echarts.min.js"
1818
integrity="sha512-2L0h0GhoIHQEjti/1KwfjcbyaTHy+hPPhE1o5wTCmviYcPO/TD9oZvUxFQtWvBkCSTIpt+fjsx1CCx6ekb51gw=="
1919
crossorigin="anonymous" referrerpolicy="no-referrer"></script>

src/perf_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def nmi_watchdog_enabled():
148148
return None
149149
try:
150150
nmi_watchdog_status = int(proc_output.decode().strip())
151-
except (ValueError) as e:
151+
except ValueError as e:
152152
logging.warning(f"Failed to interpret nmi_watchdog status: {e}")
153153
return None
154154
return nmi_watchdog_status == 1

0 commit comments

Comments
 (0)