summaryrefslogtreecommitdiffstats
path: root/src/stateless/cp/trex_vm_splitter.cpp
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-05-09 18:35:12 +0300
committerHanoh Haim <hhaim@cisco.com>2016-05-09 18:35:12 +0300
commit4d319010eaeb17cce9af55ef00feb71a6930c931 (patch)
treef24ff342607de2985cf70a83fa56af1bf9aaa863 /src/stateless/cp/trex_vm_splitter.cpp
parent8b4df27252f317b33e11a626997748971625a47c (diff)
fix cache splitter
Diffstat (limited to 'src/stateless/cp/trex_vm_splitter.cpp')
-rw-r--r--src/stateless/cp/trex_vm_splitter.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/stateless/cp/trex_vm_splitter.cpp b/src/stateless/cp/trex_vm_splitter.cpp
index 963b4525..5069c535 100644
--- a/src/stateless/cp/trex_vm_splitter.cpp
+++ b/src/stateless/cp/trex_vm_splitter.cpp
@@ -40,6 +40,34 @@ TrexVmSplitter::split(TrexStream *stream, std::vector<TrexStream *> core_streams
m_core_streams = &core_streams;
m_stream = stream;
+ uint16_t cache_size=m_stream->m_cache_size;
+ /* split the cache_size */
+ if (cache_size>0) {
+
+ /* TBD need to check if we need to it is not too big from pool */
+ if (cache_size > 10000) {
+ throw TrexException("Cache is too big try to reduce it ");
+ }
+
+ /* split like variable splitters with leftovers */
+ uint16_t cache_per_core = cache_size/m_dp_core_count;
+ uint16_t leftover = cache_size % m_dp_core_count;
+
+ if (cache_per_core<1) {
+ cache_per_core=1;
+ leftover=0;
+ }
+
+ for (TrexStream *core_stream : *m_core_streams) {
+ core_stream->m_cache_size = cache_per_core;
+ if (leftover) {
+ core_stream->m_cache_size+=1;
+ leftover-=1;
+ }
+ }
+ }
+
+
/* if we cannot split - compile the main and duplicate */
bool rc = split_internal();
if (!rc) {