aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/CpuUtils.py
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2023-10-05 12:27:08 +0000
committerPeter Mikus <peter.mikus@protonmail.ch>2023-10-09 12:09:10 +0000
commitc3ce59c652caaee06b3090f387f8826c15102703 (patch)
tree8665d3acd3c5c69baa0b329ff65217fb569b5e91 /resources/libraries/python/CpuUtils.py
parent68f39d30d623b95dfe13a20d73313b7c173eec2a (diff)
feat(trex): Multilink
Signed-off-by: Peter Mikus <peter.mikus@protonmail.ch> Change-Id: I36c5d175a34555ad9ce88d69a824f366b54dbc81
Diffstat (limited to 'resources/libraries/python/CpuUtils.py')
-rw-r--r--resources/libraries/python/CpuUtils.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/resources/libraries/python/CpuUtils.py b/resources/libraries/python/CpuUtils.py
index 5f43e211a2..8871a5b651 100644
--- a/resources/libraries/python/CpuUtils.py
+++ b/resources/libraries/python/CpuUtils.py
@@ -388,7 +388,7 @@ class CpuUtils:
@staticmethod
def get_affinity_trex(
- node, if_key, tg_mtc=1, tg_dtc=1, tg_ltc=1):
+ node, if_key, tg_mtc=1, tg_dtc=1, tg_ltc=1, tg_dtc_offset=0):
"""Get affinity for T-Rex. Result will be used to pin T-Rex threads.
:param node: TG node.
@@ -396,11 +396,13 @@ class CpuUtils:
:param tg_mtc: TG main thread count.
:param tg_dtc: TG dataplane thread count.
:param tg_ltc: TG latency thread count.
+ :param tg_dtc_offset: TG dataplane thread offset.
:type node: dict
:type if_key: str
:type tg_mtc: int
:type tg_dtc: int
:type tg_ltc: int
+ :type tg_dtc_offset: int
:returns: List of CPUs allocated to T-Rex including numa node.
:rtype: int, int, int, list
"""
@@ -412,12 +414,11 @@ class CpuUtils:
smt_used=False)
threads = CpuUtils.cpu_slice_of_list_per_node(
- node, cpu_node, skip_cnt=tg_mtc, cpu_cnt=tg_dtc,
- smt_used=False)
+ node, cpu_node, skip_cnt=tg_mtc + tg_ltc + tg_dtc_offset,
+ cpu_cnt=tg_dtc, smt_used=False)
latency_thread_id = CpuUtils.cpu_slice_of_list_per_node(
- node, cpu_node, skip_cnt=tg_mtc + tg_dtc, cpu_cnt=tg_ltc,
- smt_used=False)
+ node, cpu_node, skip_cnt=tg_mtc, cpu_cnt=tg_ltc, smt_used=False)
return master_thread_id[0], latency_thread_id[0], cpu_node, threads