summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rpc-server/commands/trex_rpc_cmd_stream.cpp1
-rw-r--r--src/stateless/cp/trex_streams_compiler.cpp9
-rw-r--r--src/stateless/cp/trex_streams_compiler.h19
3 files changed, 27 insertions, 2 deletions
diff --git a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
index 1e8328dc..fa3d96b2 100644
--- a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
+++ b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
@@ -619,6 +619,7 @@ TrexRpcCmdValidate::_run(const Json::Value &params, Json::Value &result) {
result["result"]["rate"]["max_pps"] = graph->get_max_pps();
result["result"]["rate"]["max_line_util"] = graph->get_max_bps() / port->get_port_speed_bps();
+ result["result"]["graph"]["expected_duration"] = graph->get_duration();
result["result"]["graph"]["events_count"] = (int)graph->get_events().size();
result["result"]["graph"]["events"] = Json::arrayValue;
diff --git a/src/stateless/cp/trex_streams_compiler.cpp b/src/stateless/cp/trex_streams_compiler.cpp
index d83e4ab6..478e09f8 100644
--- a/src/stateless/cp/trex_streams_compiler.cpp
+++ b/src/stateless/cp/trex_streams_compiler.cpp
@@ -536,6 +536,9 @@ TrexStreamsGraph::add_rate_events_for_stream_cont(double &offset_usec, const Tre
/* no more events after this stream */
offset_usec = -1;
+
+ /* also mark we have an inifite time */
+ m_graph_obj->m_expected_duration = -1;
}
/**
@@ -648,6 +651,7 @@ TrexStreamsGraph::generate_graph_for_one_root(uint32_t root_stream_id) {
/* loop detection */
auto search = loop_hash.find(stream->m_next_stream_id);
if (search != loop_hash.end()) {
+ m_graph_obj->on_loop_detection();
break;
}
@@ -720,6 +724,11 @@ TrexStreamsGraphObj::find_max_rate() {
max_rate_bps = std::max(max_rate_bps, current_rate_bps);
}
+ /* if not mark as inifite - get the last event time */
+ if (m_expected_duration != -1) {
+ m_expected_duration = m_rate_events.back().time;
+ }
+
m_max_pps = max_rate_pps;
m_max_bps = max_rate_bps;
}
diff --git a/src/stateless/cp/trex_streams_compiler.h b/src/stateless/cp/trex_streams_compiler.h
index e193a749..7fe2dbf2 100644
--- a/src/stateless/cp/trex_streams_compiler.h
+++ b/src/stateless/cp/trex_streams_compiler.h
@@ -133,6 +133,12 @@ class TrexStreamsGraphObj {
public:
+ TrexStreamsGraphObj() {
+ m_max_pps = 0;
+ m_max_bps = 0;
+ m_expected_duration = 0;
+ }
+
/**
* rate event is defined by those:
* time - the time of the event on the timeline
@@ -155,6 +161,10 @@ public:
return m_max_bps;
}
+ int get_duration() const {
+ return m_expected_duration;
+ }
+
const std::list<rate_event_st> & get_events() const {
return m_rate_events;
}
@@ -162,6 +172,10 @@ public:
private:
+ void on_loop_detection() {
+ m_expected_duration = -1;
+ }
+
void add_rate_event(const rate_event_st &ev) {
m_rate_events.push_back(ev);
}
@@ -169,8 +183,9 @@ private:
void generate();
void find_max_rate();
- double m_max_pps;
- double m_max_bps;
+ double m_max_pps;
+ double m_max_bps;
+ int m_expected_duration;
/* list of rate events */
std::list<rate_event_st> m_rate_events;