diff options
author | Hanoh Haim <hhaim@cisco.com> | 2017-02-08 15:21:11 +0200 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2017-02-09 09:56:00 +0200 |
commit | 2dab8f65015e9fa90df395be6ee1a07e9ac71044 (patch) | |
tree | aabab12f12e50e34f09f092c7f19dc7948de0134 /src/bp_sim.cpp | |
parent | c9b62af88eb92ca403e43c34a2279c80d8d6f57b (diff) |
move to active flows
Signed-off-by: Hanoh Haim <hhaim@cisco.com>
Diffstat (limited to 'src/bp_sim.cpp')
-rwxr-xr-x | src/bp_sim.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp index aa80c475..f540f21b 100755 --- a/src/bp_sim.cpp +++ b/src/bp_sim.cpp @@ -3541,6 +3541,8 @@ bool CFlowGenListPerThread::Create(uint32_t thread_id, /* split the clients to threads */ CTupleGenYamlInfo * tuple_gen = &m_flow_list->m_yaml_info.m_tuple_gen; + double active_flows_per_core = flow_list->get_worse_case_active_flows()/(double)m_max_threads; + m_smart_gen.Create(0,m_thread_id); /* split the clients to threads using the mask */ @@ -3553,8 +3555,7 @@ bool CFlowGenListPerThread::Create(uint32_t thread_id, m_smart_gen.add_client_pool(tuple_gen->m_client_pool[i].m_dist, portion.m_ip_start, portion.m_ip_end, - get_longest_flow(i,true), - get_total_kcps(i,true)*1000, + active_flows_per_core, m_flow_list->m_client_config_info, tuple_gen->m_client_pool[i].m_tcp_aging_sec, tuple_gen->m_client_pool[i].m_udp_aging_sec @@ -3567,13 +3568,12 @@ bool CFlowGenListPerThread::Create(uint32_t thread_id, m_smart_gen.add_server_pool(tuple_gen->m_server_pool[i].m_dist, portion.m_ip_start, portion.m_ip_end, - get_longest_flow(i,false), - get_total_kcps(i,false)*1000, + active_flows_per_core, tuple_gen->m_server_pool[i].m_is_bundling); } - init_from_global(portion); + init_from_global(); CMessagingManager * rx_dp=CMsgIns::Ins()->getRxDp(); @@ -3645,7 +3645,7 @@ void CFlowGenListPerThread::defer_client_port_free(CGenNode *p){ /* copy all info from global and div by num of threads */ -void CFlowGenListPerThread::init_from_global(CIpPortion& portion){ +void CFlowGenListPerThread::init_from_global(){ /* copy generator , it is the same */ m_yaml_info =m_flow_list->m_yaml_info; @@ -5002,6 +5002,25 @@ void CFlowGenList::dump_client_config(FILE *fd) { m_client_config_info.dump(fd); } +/* take the total CPS and multi by the longest flow */ +double CFlowGenList::get_worse_case_active_flows(){ + CFlowStats sum; + CFlowStats stats; + int i; + double max_duration=-1.0; + + for (i=0; i<(int)m_cap_gen.size(); i++) { + CFlowGeneratorRec * lp=m_cap_gen[i]; + lp->getFlowStats(&stats); + + if ( stats.duration_sec > max_duration){ + max_duration=stats.duration_sec; + } + sum.Add(stats); + } + return (sum.m_cps*max_duration); +} + int CFlowGenList::update_active_flows(uint32_t active_flows){ double d_active_flow=(double)active_flows; CFlowStats stats; |