void l7vs::virtualservice_base::handle_throughput_update( const boost::system::error_code& err ){
if( unlikely( LOG_LV_DEBUG == l7vs::Logger::getLogLevel( l7vs::LOG_CAT_L7VSD_VIRTUALSERVICE_THREAD ) ) ){
boost::format formatter("in_function : void virtualservice_base::handle_throughput_update( "
- "const boost::system::error_code& err ) : err = %s, err.message = %s");
- formatter % ( err ? "true" : "false") % err.message();
+ "const boost::system::error_code& err ) : err = %s, err.message = %s, current_up_recvsize = %ld, current_down_recvsize = %ld, wait_count_up = %ld, wait_count_down = %ld");
+ formatter % ( err ? "true" : "false") % err.message() % current_up_recvsize.get() % current_down_recvsize.get() % wait_count_up.get() % wait_count_down.get();
l7vs::Logger::putLogDebug( l7vs::LOG_CAT_L7VSD_VIRTUALSERVICE_THREAD, 7, formatter.str(), __FILE__, __LINE__ );
}
if( likely( !err ) ){
if( wait_count_up != 0 ) wait_count_up--;
if( wait_count_down != 0 ) wait_count_down--;
+ if( wait_count_up == 0 ) {
+ throughput_up = 0;
+ }
+
+ if( wait_count_down == 0 ) {
+ throughput_down = 0;
+ }
+
if( current_up_recvsize != 0 ){
+
+ double byte_sec_up_val = 0.0;
if( 0 != element.qos_upstream ){
// wait_count = ( current_throughput(byte/s)(=(recvsize / interval(ms)) * 1000 ) / qos_limit_throughput ) - 1(thistime)
- wait_count_up = ( ( ( current_up_recvsize.get() / param_data.bps_interval ) * 1000 ) / element.qos_upstream );
+ //wait_count_up = ( ( ( current_up_recvsize.get() / param_data.bps_interval ) * 1000 ) / element.qos_upstream );
+
+ byte_sec_up_val = ( (double)current_up_recvsize.get() / param_data.bps_interval );
+ wait_count_up = (unsigned long long)( ( byte_sec_up_val * 1000 ) / element.qos_upstream );
+
if( wait_count_up > 0 ) wait_count_up--;
}
// throughput = recvsize / ( (thistime(1) + all_wait_time) * interval(ms) ) * 1000
- throughput_up = ( current_up_recvsize.get() / ( param_data.bps_interval * ( wait_count_up.get() + 1 ) ) ) * 1000;
+ //throughput_up = ( current_up_recvsize.get() / ( param_data.bps_interval * ( wait_count_up.get() + 1 ) ) ) * 1000;
+
+ byte_sec_up_val = ( (double)current_up_recvsize.get() / ( param_data.bps_interval * ( wait_count_up.get() + 1 ) ) );
+ throughput_up = (unsigned long long)( byte_sec_up_val * 1000 );
+
current_up_recvsize = 0ULL;
}
if( current_down_recvsize != 0 ){
+ double byte_sec_down_val = 0.0;
if( 0 != element.qos_downstream ){
// wait_count = ( current_throughput(byte/s)(=(recvsize / interval(ms)) * 1000 ) / qos_limit_throughput ) - 1(thistime)
- wait_count_down = ( ( ( current_down_recvsize.get() / param_data.bps_interval ) * 1000 ) / element.qos_downstream );
+ //wait_count_down = ( ( ( current_down_recvsize.get() / param_data.bps_interval ) * 1000 ) / element.qos_downstream );
+
+ byte_sec_down_val = ( (double)current_down_recvsize.get() / param_data.bps_interval );
+ wait_count_down = (unsigned long long)( ( byte_sec_down_val * 1000 ) / element.qos_downstream );
+
if( wait_count_down > 0 ) wait_count_down--;
}
// throughput = recvsize / ( (thistime(1) + all_wait_time) * interval(ms) ) * 1000
- throughput_down = ( current_down_recvsize.get() / ( param_data.bps_interval * ( wait_count_down.get() + 1 ) ) ) * 1000;
+ //throughput_down = ( current_down_recvsize.get() / ( param_data.bps_interval * ( wait_count_down.get() + 1 ) ) ) * 1000;
+
+ byte_sec_down_val = ( (double)current_down_recvsize.get() / ( param_data.bps_interval * ( wait_count_down.get() + 1 ) ) );
+ throughput_down = (unsigned long long)( byte_sec_down_val * 1000 );
+
current_down_recvsize = 0ULL;
}
calc_bps_timer->async_wait( boost::bind( &l7vs::virtualservice_tcp::handle_throughput_update,
this, boost::asio::placeholders::error ) );
if( unlikely( LOG_LV_DEBUG == l7vs::Logger::getLogLevel( l7vs::LOG_CAT_L7VSD_VIRTUALSERVICE_THREAD ) ) ){
- boost::format formatter1("throughput(upstream) dump : %d");
- formatter1 % throughput_up.get();
+ boost::format formatter1("throughput(upstream) dump : %d, wait_count_up dump : %d");
+ formatter1 % throughput_up.get() % wait_count_up.get();
l7vs::Logger::putLogDebug( l7vs::LOG_CAT_L7VSD_VIRTUALSERVICE_THREAD, 8, formatter1.str(), __FILE__, __LINE__ );
- boost::format formatter2("throughput(downstream) dump : %d");
- formatter2 % throughput_down.get();
+ boost::format formatter2("throughput(downstream) dump : %d, wait_count_down dump : %d");
+ formatter2 % throughput_down.get() % wait_count_down.get();
l7vs::Logger::putLogDebug( l7vs::LOG_CAT_L7VSD_VIRTUALSERVICE_THREAD, 9, formatter2.str(), __FILE__, __LINE__ );
}
}else