summaryrefslogtreecommitdiffstats
path: root/src/stateless/dp
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2015-11-08 11:39:09 +0200
committerimarom <imarom@cisco.com>2015-11-08 11:39:09 +0200
commitbc7d9ee81604fd33607569ac4f03ca8b91777b29 (patch)
treec1d033860162fd68c76dc5578501c0f5373ae477 /src/stateless/dp
parentf6b521fb76e74036c626c10f6ae11ea525ac97b7 (diff)
code review notes:
1. performance improvement for stateless DP core object (direct object) 2. exit scheduler loop is now using a scheduled message and not IF 3. duration for inifinite is negative number 4. fixed stop_traffic scheduled node time
Diffstat (limited to 'src/stateless/dp')
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.cpp16
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.h13
2 files changed, 21 insertions, 8 deletions
diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp
index 5f4e553a..35ce43a8 100644
--- a/src/stateless/dp/trex_stateless_dp_core.cpp
+++ b/src/stateless/dp/trex_stateless_dp_core.cpp
@@ -30,7 +30,9 @@ usec_to_sec(double usec) {
return (usec / (1000 * 1000));
}
-TrexStatelessDpCore::TrexStatelessDpCore(uint8_t thread_id, CFlowGenListPerThread *core) {
+
+void
+TrexStatelessDpCore::create(uint8_t thread_id, CFlowGenListPerThread *core) {
m_thread_id = thread_id;
m_core = core;
@@ -73,7 +75,7 @@ TrexStatelessDpCore::start_scheduler() {
m_core->m_node_gen.add_node(node_sync);
double old_offset = 0.0;
- m_core->m_node_gen.flush_file(100000000, 0.0, false, m_core, old_offset);
+ m_core->m_node_gen.flush_file(-1, 0.0, false, m_core, old_offset);
}
void
@@ -176,14 +178,14 @@ TrexStatelessDpCore::stop_traffic(uint8_t port_id) {
m_state = STATE_IDLE;
/* stop the scheduler */
- CGenNode *node = m_core->create_node() ;
+ CGenNode *node = m_core->create_node() ;
- node->m_type = CGenNode::EXIT_SCHED;
+ node->m_type = CGenNode::EXIT_SCHED;
- /* make sure it will be scheduled after the current node */
- node->m_time = m_core->m_node_gen.m_p_queue.top()->m_time;
+ /* make sure it will be scheduled after the current node */
+ node->m_time = m_core->m_cur_time_sec + 0.0001;
- m_core->m_node_gen.add_node(node);
+ m_core->m_node_gen.add_node(node);
}
}
diff --git a/src/stateless/dp/trex_stateless_dp_core.h b/src/stateless/dp/trex_stateless_dp_core.h
index f3b5ff62..f4dbad08 100644
--- a/src/stateless/dp/trex_stateless_dp_core.h
+++ b/src/stateless/dp/trex_stateless_dp_core.h
@@ -42,7 +42,18 @@ public:
STATE_TRANSMITTING
};
- TrexStatelessDpCore(uint8_t thread_id, CFlowGenListPerThread *core);
+ TrexStatelessDpCore() {
+ m_thread_id = 0;
+ m_core = NULL;
+ }
+
+ /**
+ * "static constructor"
+ *
+ * @param thread_id
+ * @param core
+ */
+ void create(uint8_t thread_id, CFlowGenListPerThread *core);
/**
* launch the stateless DP core code