mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-09 11:28:42 -05:00
Added QueueSize information to be exported too.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5245 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
9fcc9277c2
commit
e0af833f47
@ -58,11 +58,13 @@ class RsBwRates
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RsBwRates()
|
RsBwRates()
|
||||||
:mRateIn(0), mRateOut(0), mMaxRateIn(0), mMaxRateOut(0) {return;}
|
:mRateIn(0), mRateOut(0), mMaxRateIn(0), mMaxRateOut(0), mQueueIn(0), mQueueOut(0) {return;}
|
||||||
float mRateIn;
|
float mRateIn;
|
||||||
float mRateOut;
|
float mRateOut;
|
||||||
float mMaxRateIn;
|
float mMaxRateIn;
|
||||||
float mMaxRateOut;
|
float mMaxRateOut;
|
||||||
|
int mQueueIn;
|
||||||
|
int mQueueOut;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -86,6 +88,7 @@ virtual void getRates(RsBwRates &rates)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual int getQueueSize(bool /* in */) { return 0;}
|
||||||
virtual float getRate(bool in)
|
virtual float getRate(bool in)
|
||||||
{
|
{
|
||||||
if (in)
|
if (in)
|
||||||
|
@ -742,6 +742,8 @@ int pqihandler::ExtractRates(std::map<std::string, RsBwRates> &ratemap, RsBw
|
|||||||
total.mMaxRateOut = getMaxRate(false);
|
total.mMaxRateOut = getMaxRate(false);
|
||||||
total.mRateIn = 0;
|
total.mRateIn = 0;
|
||||||
total.mRateOut = 0;
|
total.mRateOut = 0;
|
||||||
|
total.mQueueIn = 0;
|
||||||
|
total.mQueueOut = 0;
|
||||||
|
|
||||||
/* Lock once rates have been retrieved */
|
/* Lock once rates have been retrieved */
|
||||||
RsStackMutex stack(coreMtx); /**************** LOCKED MUTEX ****************/
|
RsStackMutex stack(coreMtx); /**************** LOCKED MUTEX ****************/
|
||||||
@ -756,6 +758,8 @@ int pqihandler::ExtractRates(std::map<std::string, RsBwRates> &ratemap, RsBw
|
|||||||
|
|
||||||
total.mRateIn += peerRates.mRateIn;
|
total.mRateIn += peerRates.mRateIn;
|
||||||
total.mRateOut += peerRates.mRateOut;
|
total.mRateOut += peerRates.mRateOut;
|
||||||
|
total.mQueueIn += peerRates.mQueueIn;
|
||||||
|
total.mQueueOut += peerRates.mQueueOut;
|
||||||
|
|
||||||
ratemap[it->first] = peerRates;
|
ratemap[it->first] = peerRates;
|
||||||
|
|
||||||
|
@ -452,6 +452,23 @@ pqiconnect *pqiperson::getKid(uint32_t type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pqiperson::getRates(RsBwRates &rates)
|
||||||
|
{
|
||||||
|
// get the rate from the active one.
|
||||||
|
if ((!active) || (activepqi == NULL))
|
||||||
|
return;
|
||||||
|
activepqi -> getRates(rates);
|
||||||
|
}
|
||||||
|
|
||||||
|
int pqiperson::getQueueSize(bool in)
|
||||||
|
{
|
||||||
|
// get the rate from the active one.
|
||||||
|
if ((!active) || (activepqi == NULL))
|
||||||
|
return 0;
|
||||||
|
return activepqi -> getQueueSize(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
float pqiperson::getRate(bool in)
|
float pqiperson::getRate(bool in)
|
||||||
{
|
{
|
||||||
// get the rate from the active one.
|
// get the rate from the active one.
|
||||||
|
@ -136,6 +136,8 @@ virtual int tick();
|
|||||||
int notifyEvent(NetInterface *ni, int event);
|
int notifyEvent(NetInterface *ni, int event);
|
||||||
|
|
||||||
// PQInterface for rate control overloaded....
|
// PQInterface for rate control overloaded....
|
||||||
|
virtual int getQueueSize(bool in);
|
||||||
|
virtual void getRates(RsBwRates &rates);
|
||||||
virtual float getRate(bool in);
|
virtual float getRate(bool in);
|
||||||
virtual void setMaxRate(bool in, float val);
|
virtual void setMaxRate(bool in, float val);
|
||||||
virtual void setRateCap(float val_in, float val_out);
|
virtual void setRateCap(float val_in, float val_out);
|
||||||
|
@ -924,3 +924,18 @@ void pqistreamer::inReadBytes(int inb)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pqistreamer::getQueueSize(bool in)
|
||||||
|
{
|
||||||
|
if (in)
|
||||||
|
return incoming.size();
|
||||||
|
return out_pkt.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void pqistreamer::getRates(RsBwRates &rates)
|
||||||
|
{
|
||||||
|
RateInterface::getRates(rates);
|
||||||
|
rates.mQueueIn = incoming.size();
|
||||||
|
rates.mQueueOut = out_pkt.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +59,8 @@ class pqistreamer: public PQInterface
|
|||||||
virtual int status();
|
virtual int status();
|
||||||
|
|
||||||
time_t getLastIncomingTS(); // Time of last data packet, for checking a connection is alive.
|
time_t getLastIncomingTS(); // Time of last data packet, for checking a connection is alive.
|
||||||
|
virtual void getRates(RsBwRates &rates);
|
||||||
|
virtual int getQueueSize(bool in); // extracting data.
|
||||||
private:
|
private:
|
||||||
/* Implementation */
|
/* Implementation */
|
||||||
|
|
||||||
|
@ -146,6 +146,9 @@ class RsConfigDataRates
|
|||||||
mAllowedOut = 0;
|
mAllowedOut = 0;
|
||||||
|
|
||||||
mAllowedTs = 0;
|
mAllowedTs = 0;
|
||||||
|
|
||||||
|
mQueueIn = 0;
|
||||||
|
mQueueOut = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all in kB/s */
|
/* all in kB/s */
|
||||||
@ -160,6 +163,9 @@ class RsConfigDataRates
|
|||||||
float mAllowedOut;
|
float mAllowedOut;
|
||||||
|
|
||||||
time_t mAllowedTs;
|
time_t mAllowedTs;
|
||||||
|
|
||||||
|
int mQueueIn;
|
||||||
|
int mQueueOut;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,6 +225,9 @@ int p3BandwidthControl::getTotalBandwidthRates(RsConfigDataRates &rates)
|
|||||||
rates.mAllowedOut = 0;
|
rates.mAllowedOut = 0;
|
||||||
rates.mAllowedTs = 0;
|
rates.mAllowedTs = 0;
|
||||||
|
|
||||||
|
rates.mQueueIn = mTotalRates.mQueueIn;
|
||||||
|
rates.mQueueOut = mTotalRates.mQueueOut;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,6 +251,9 @@ int p3BandwidthControl::getAllBandwidthRates(std::map<std::string, RsConfigDataR
|
|||||||
rates.mAllowedOut = bit->second.mAllowedOut / 1000.0;
|
rates.mAllowedOut = bit->second.mAllowedOut / 1000.0;
|
||||||
rates.mAllowedTs = bit->second.mLastRecvd;
|
rates.mAllowedTs = bit->second.mLastRecvd;
|
||||||
|
|
||||||
|
rates.mQueueIn = bit->second.mRates.mQueueIn;
|
||||||
|
rates.mQueueOut = bit->second.mRates.mQueueOut;
|
||||||
|
|
||||||
ratemap[bit->first] = rates;
|
ratemap[bit->first] = rates;
|
||||||
}
|
}
|
||||||
return true ;
|
return true ;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user