mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-03 14:45:12 -04:00
added display of TR forwarding probability as a function of depth
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4625 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b3bcfe9d30
commit
c650265704
3 changed files with 34 additions and 11 deletions
|
@ -68,6 +68,8 @@ class TurtleTrafficStatisticsInfo
|
||||||
float tr_dn_Bps ; // tunnel requests dnload bitrate (in Bytes per sec.)
|
float tr_dn_Bps ; // tunnel requests dnload bitrate (in Bytes per sec.)
|
||||||
float total_up_Bps ; // turtle network management bitrate (in Bytes per sec.)
|
float total_up_Bps ; // turtle network management bitrate (in Bytes per sec.)
|
||||||
float total_dn_Bps ; // turtle network management bitrate (in Bytes per sec.)
|
float total_dn_Bps ; // turtle network management bitrate (in Bytes per sec.)
|
||||||
|
|
||||||
|
std::vector<float> forward_probabilities ; // probability to forward a TR as a function of depth.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Interface class for turtle hopping.
|
// Interface class for turtle hopping.
|
||||||
|
|
|
@ -85,6 +85,11 @@ static const time_t TUNNEL_CLEANING_LAPS_TIME = 10 ; /// clean tunnels every
|
||||||
static const uint32_t MAX_TUNNEL_REQS_PER_SECOND= 1 ; /// maximum number of tunnel requests issued per second. Was 0.5 before
|
static const uint32_t MAX_TUNNEL_REQS_PER_SECOND= 1 ; /// maximum number of tunnel requests issued per second. Was 0.5 before
|
||||||
static const uint32_t MAX_ALLOWED_SR_IN_CACHE = 120 ; /// maximum number of search requests allowed in cache. That makes 2 per sec.
|
static const uint32_t MAX_ALLOWED_SR_IN_CACHE = 120 ; /// maximum number of search requests allowed in cache. That makes 2 per sec.
|
||||||
|
|
||||||
|
static const float depth_peer_probability[7] = { 1.0f,0.99f,0.9f,0.7f,0.4f,0.15f,0.1f } ;
|
||||||
|
static const int TUNNEL_REQUEST_PACKET_SIZE = 50 ;
|
||||||
|
static const int MAX_TR_FORWARD_PER_SEC = 20 ;
|
||||||
|
static const int DISTANCE_SQUEEZING_POWER = 8 ;
|
||||||
|
|
||||||
p3turtle::p3turtle(p3LinkMgr *lm,ftServer *fs)
|
p3turtle::p3turtle(p3LinkMgr *lm,ftServer *fs)
|
||||||
:p3Service(RS_SERVICE_TYPE_TURTLE), p3Config(CONFIG_TYPE_TURTLE), mLinkMgr(lm), mTurtleMtx("p3turtle")
|
:p3Service(RS_SERVICE_TYPE_TURTLE), p3Config(CONFIG_TYPE_TURTLE), mLinkMgr(lm), mTurtleMtx("p3turtle")
|
||||||
{
|
{
|
||||||
|
@ -1562,10 +1567,6 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item)
|
||||||
//
|
//
|
||||||
// When the number of peers increases, the speed limit is reached faster, but the behavior per peer is the same.
|
// When the number of peers increases, the speed limit is reached faster, but the behavior per peer is the same.
|
||||||
//
|
//
|
||||||
static const float depth_peer_probability[7] = { 1.0f,0.99f,0.9f,0.7f,0.4f,0.15f,0.1f } ;
|
|
||||||
static const int TUNNEL_REQUEST_PACKET_SIZE = 50 ;
|
|
||||||
static const int MAX_TR_FORWARD_PER_SEC = 20 ;
|
|
||||||
static const int DISTANCE_SQUEEZING_POWER = 8 ;
|
|
||||||
|
|
||||||
float forward_probability ;
|
float forward_probability ;
|
||||||
|
|
||||||
|
@ -1579,13 +1580,13 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item)
|
||||||
#ifdef P3TURTLE_DEBUG
|
#ifdef P3TURTLE_DEBUG
|
||||||
std::cerr << "Forwarding probability: depth=" << item->depth << ", distance to max speed=" << distance_to_maximum << ", corrected=" << corrected_distance << ", prob.=" << forward_probability << std::endl;
|
std::cerr << "Forwarding probability: depth=" << item->depth << ", distance to max speed=" << distance_to_maximum << ", corrected=" << corrected_distance << ", prob.=" << forward_probability << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if(forward_probability < 0.1)
|
// if(forward_probability < 0.1)
|
||||||
{
|
// {
|
||||||
#ifdef P3TURTLE_DEBUG
|
//#ifdef P3TURTLE_DEBUG
|
||||||
std::cerr << "Dropped packet!" << std::endl;
|
// std::cerr << "Dropped packet!" << std::endl;
|
||||||
#endif
|
//#endif
|
||||||
return ;
|
// return ;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the item contains an already handled tunnel request, give up. This
|
// If the item contains an already handled tunnel request, give up. This
|
||||||
|
@ -2122,6 +2123,17 @@ void p3turtle::getTrafficStatistics(TurtleTrafficStatisticsInfo& info) const
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||||
info = _traffic_info ;
|
info = _traffic_info ;
|
||||||
|
|
||||||
|
float distance_to_maximum = std::min(100.0f,info.tr_up_Bps/(float)(TUNNEL_REQUEST_PACKET_SIZE*MAX_TR_FORWARD_PER_SEC)) ;
|
||||||
|
info.forward_probabilities.clear() ;
|
||||||
|
|
||||||
|
for(int i=0;i<=6;++i)
|
||||||
|
{
|
||||||
|
float corrected_distance = pow(distance_to_maximum,DISTANCE_SQUEEZING_POWER) ;
|
||||||
|
float forward_probability = pow(depth_peer_probability[i],corrected_distance) ;
|
||||||
|
|
||||||
|
info.forward_probabilities.push_back(forward_probability) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void p3turtle::getInfo( std::vector<std::vector<std::string> >& hashes_info,
|
void p3turtle::getInfo( std::vector<std::vector<std::string> >& hashes_info,
|
||||||
|
|
|
@ -313,6 +313,15 @@ void TurtleRouterStatisticsWidget::updateTunnelStatistics(const std::vector<std:
|
||||||
painter.drawText(ox+2*cellx,oy+celly,tr("Outgoing file data")+"\t: " + speedString(info.data_up_Bps) ) ; oy += celly ;
|
painter.drawText(ox+2*cellx,oy+celly,tr("Outgoing file data")+"\t: " + speedString(info.data_up_Bps) ) ; oy += celly ;
|
||||||
painter.drawText(ox+2*cellx,oy+celly,tr("Forwarded data ")+"\t: " + speedString(info.unknown_updn_Bps) ) ; oy += celly ;
|
painter.drawText(ox+2*cellx,oy+celly,tr("Forwarded data ")+"\t: " + speedString(info.unknown_updn_Bps) ) ; oy += celly ;
|
||||||
|
|
||||||
|
QString prob_string ;
|
||||||
|
|
||||||
|
for(uint i=0;i<info.forward_probabilities.size();++i)
|
||||||
|
prob_string += QString::number(info.forward_probabilities[i],'g',2) + " (" + QString::number(i) + ") " ;
|
||||||
|
|
||||||
|
painter.drawText(ox+2*cellx,oy+celly,tr("TR Forward probabilities")+"\t: " + prob_string ) ;
|
||||||
|
oy += celly ;
|
||||||
|
oy += celly ;
|
||||||
|
|
||||||
// update the pixmap
|
// update the pixmap
|
||||||
//
|
//
|
||||||
pixmap = tmppixmap;
|
pixmap = tmppixmap;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue