Skip to content

Commit

Permalink
update cpuset split script
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq-b authored and zh-jq committed Feb 25, 2025
1 parent dd1ae44 commit 247b664
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/cpuset_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
def get_physical_core(i: int):
with open(f"/sys/devices/system/cpu/cpu{i}/topology/core_id", 'r') as f:
core = f.read()
return core.rstrip()
return int(core.rstrip())


def cpu_set_to_list(s: str):
# Convert CPU SET mask to CPU ID list
cpus = []
i = 0
for c in reversed(s):
# the value of /sys/devices/system/node/node0/cpumap is delimited by ','
if c == ',':
continue

n = int(c, 16)

if n & 0b0001:
Expand Down

0 comments on commit 247b664

Please sign in to comment.