summaryrefslogtreecommitdiffstats
path: root/src/bp_sim.cpp
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-12-25 14:50:14 +0200
committerHanoh Haim <hhaim@cisco.com>2016-12-25 14:50:31 +0200
commitdc66a3a82aab2ce41aa6ded38087e02b1eeb9493 (patch)
tree6d9eb5a917f613c6cc7862ae2316abeb181c7f12 /src/bp_sim.cpp
parentc25e1862e21807ee2d4f1f356e5a6970fd598edf (diff)
add a way to change tw configuration
Signed-off-by: Hanoh Haim <hhaim@cisco.com>
Diffstat (limited to 'src/bp_sim.cpp')
-rwxr-xr-xsrc/bp_sim.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp
index 68cc325d..baf891ad 100755
--- a/src/bp_sim.cpp
+++ b/src/bp_sim.cpp
@@ -2862,6 +2862,11 @@ void operator >> (const YAML::Node& node, CFlowsYamlInfo & flows_info) {
flows_info.m_tuple_gen.get_server_pool_id(fi.m_server_pool_name);
flows_info.m_vec.push_back(fi);
}
+
+ if ( node.FindValue("tw") ){
+ node["tw"] >> flows_info.m_tw;
+ }
+
}
void CVlanYamlInfo::Dump(FILE *fd){
@@ -2931,6 +2936,7 @@ void CFlowsYamlInfo::Dump(FILE *fd){
for (i=0; i<(int)m_vec.size(); i++) {
m_vec[i].Dump(fd);
}
+ m_tw.Dump(fd);
}
@@ -3015,6 +3021,7 @@ bool CFlowsYamlInfo::verify_correctness(uint32_t num_threads) {
int CFlowsYamlInfo::load_from_yaml_file(std::string file_name){
m_vec.clear();
+ m_tw.reset();
if ( !utl_is_file_exists (file_name) ){
printf(" ERROR file %s does not exist \n",file_name.c_str());
@@ -3064,6 +3071,21 @@ int CFlowsYamlInfo::load_from_yaml_file(std::string file_name){
m_is_plugin_configured=true;
}
}
+
+ if ( m_tw.m_info_exist ){
+
+ CTimerWheelYamlInfo *lp=&m_tw;
+ std::string err;
+ if (!lp->Verify(err)){
+ std::cout << err << "\n";
+ exit(-1);
+ }
+
+ CParserOption* po = &CGlobalInfo::m_options;
+ po->set_tw_bucket_time_in_usec(lp->m_bucket_time_usec);
+ po->set_tw_buckets(lp->m_buckets);
+ po->set_tw_levels(lp->m_levels);
+ }
return 0;
}
@@ -3476,9 +3498,10 @@ bool CFlowGenListPerThread::Create(uint32_t thread_id,
0 ,
socket_id);
- RC_HTW_t tw_res=m_tw.Create(TW_BUCKETS,3);
+ RC_HTW_t tw_res=m_tw.Create(TW_BUCKETS,TW_LEVELS);
if (tw_res != RC_HTW_OK){
CHTimerWheelErrorStr err(tw_res);
+ printf("Timer wheel configuration error,please look into the manual for details \n");
printf("ERROR %-30s - %s \n",err.get_str(),err.get_help_str());
exit(1);
}
@@ -5194,7 +5217,12 @@ void CParserOption::dump(FILE *fd){
fprintf(fd," latency : %d pkt/sec \n",m_latency_rate);
fprintf(fd," zmq_port : %d \n",m_zmq_port);
fprintf(fd," telnet_port : %d \n",m_telnet_port);
- fprintf(fd," expected_ports : %d \n",m_expected_portd);
+ fprintf(fd," expected_ports : %d \n",m_expected_portd);
+ fprintf(fd," tw_bucket_usec : %f usec \n",get_tw_bucket_time_in_sec()*1000000.0);
+ fprintf(fd," tw_buckets : %lu usec \n",(ulong)get_tw_buckets());
+ fprintf(fd," tw_levels : %lu usec \n",(ulong)get_tw_levels());
+
+
if (preview.get_vlan_mode_enable() ) {
fprintf(fd," vlans : [%d,%d] \n",m_vlan_port[0],m_vlan_port[1]);
}