mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 22:36:39 +02:00
windows build
This commit is contained in:
parent
b6b2b7f58b
commit
dec16c8f0b
2 changed files with 15 additions and 11 deletions
|
@ -57,6 +57,11 @@ void PacketSender::queuePacketForSending(const HifiSockAddr& address, unsigned c
|
||||||
_totalBytesQueued += packetLength;
|
_totalBytesQueued += packetLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PacketSender::setPacketsPerSecond(int packetsPerSecond) {
|
||||||
|
_packetsPerSecond = std::max(MINIMUM_PACKETS_PER_SECOND, packetsPerSecond);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PacketSender::process() {
|
bool PacketSender::process() {
|
||||||
if (isThreaded()) {
|
if (isThreaded()) {
|
||||||
return threadedProcess();
|
return threadedProcess();
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Generalized threaded processor for queueing and sending of outbound packets.
|
/// Generalized threaded processor for queueing and sending of outbound packets.
|
||||||
class PacketSender : public virtual GenericThread {
|
class PacketSender : public virtual GenericThread {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -44,9 +44,8 @@ public:
|
||||||
/// \param ssize_t packetLength size of data
|
/// \param ssize_t packetLength size of data
|
||||||
/// \thread any thread, typically the application thread
|
/// \thread any thread, typically the application thread
|
||||||
void queuePacketForSending(const HifiSockAddr& address, unsigned char* packetData, ssize_t packetLength);
|
void queuePacketForSending(const HifiSockAddr& address, unsigned char* packetData, ssize_t packetLength);
|
||||||
|
|
||||||
void setPacketsPerSecond(int packetsPerSecond)
|
void setPacketsPerSecond(int packetsPerSecond);
|
||||||
{ _packetsPerSecond = std::max(MINIMUM_PACKETS_PER_SECOND, packetsPerSecond); }
|
|
||||||
int getPacketsPerSecond() const { return _packetsPerSecond; }
|
int getPacketsPerSecond() const { return _packetsPerSecond; }
|
||||||
|
|
||||||
void setPacketSenderNotify(PacketSenderNotify* notify) { _notify = notify; }
|
void setPacketSenderNotify(PacketSenderNotify* notify) { _notify = notify; }
|
||||||
|
@ -66,19 +65,19 @@ public:
|
||||||
void setProcessCallIntervalHint(int usecsPerProcessCall) { _usecsPerProcessCallHint = usecsPerProcessCall; }
|
void setProcessCallIntervalHint(int usecsPerProcessCall) { _usecsPerProcessCallHint = usecsPerProcessCall; }
|
||||||
|
|
||||||
/// returns the packets per second send rate of this object over its lifetime
|
/// returns the packets per second send rate of this object over its lifetime
|
||||||
float getLifetimePPS() const
|
float getLifetimePPS() const
|
||||||
{ return getLifetimeInSeconds() == 0 ? 0 : (float)((float)_totalPacketsSent / getLifetimeInSeconds()); }
|
{ return getLifetimeInSeconds() == 0 ? 0 : (float)((float)_totalPacketsSent / getLifetimeInSeconds()); }
|
||||||
|
|
||||||
/// returns the bytes per second send rate of this object over its lifetime
|
/// returns the bytes per second send rate of this object over its lifetime
|
||||||
float getLifetimeBPS() const
|
float getLifetimeBPS() const
|
||||||
{ return getLifetimeInSeconds() == 0 ? 0 : (float)((float)_totalBytesSent / getLifetimeInSeconds()); }
|
{ return getLifetimeInSeconds() == 0 ? 0 : (float)((float)_totalBytesSent / getLifetimeInSeconds()); }
|
||||||
|
|
||||||
/// returns the packets per second queued rate of this object over its lifetime
|
/// returns the packets per second queued rate of this object over its lifetime
|
||||||
float getLifetimePPSQueued() const
|
float getLifetimePPSQueued() const
|
||||||
{ return getLifetimeInSeconds() == 0 ? 0 : (float)((float)_totalPacketsQueued / getLifetimeInSeconds()); }
|
{ return getLifetimeInSeconds() == 0 ? 0 : (float)((float)_totalPacketsQueued / getLifetimeInSeconds()); }
|
||||||
|
|
||||||
/// returns the bytes per second queued rate of this object over its lifetime
|
/// returns the bytes per second queued rate of this object over its lifetime
|
||||||
float getLifetimeBPSQueued() const
|
float getLifetimeBPSQueued() const
|
||||||
{ return getLifetimeInSeconds() == 0 ? 0 : (float)((float)_totalBytesQueued / getLifetimeInSeconds()); }
|
{ return getLifetimeInSeconds() == 0 ? 0 : (float)((float)_totalBytesQueued / getLifetimeInSeconds()); }
|
||||||
|
|
||||||
/// returns lifetime of this object from first packet sent to now in usecs
|
/// returns lifetime of this object from first packet sent to now in usecs
|
||||||
|
@ -104,7 +103,7 @@ protected:
|
||||||
int _usecsPerProcessCallHint;
|
int _usecsPerProcessCallHint;
|
||||||
uint64_t _lastProcessCallTime;
|
uint64_t _lastProcessCallTime;
|
||||||
SimpleMovingAverage _averageProcessCallTime;
|
SimpleMovingAverage _averageProcessCallTime;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<NetworkPacket> _packets;
|
std::vector<NetworkPacket> _packets;
|
||||||
uint64_t _lastSendTime;
|
uint64_t _lastSendTime;
|
||||||
|
@ -112,7 +111,7 @@ private:
|
||||||
|
|
||||||
bool threadedProcess();
|
bool threadedProcess();
|
||||||
bool nonThreadedProcess();
|
bool nonThreadedProcess();
|
||||||
|
|
||||||
uint64_t _lastPPSCheck;
|
uint64_t _lastPPSCheck;
|
||||||
int _packetsOverCheckInterval;
|
int _packetsOverCheckInterval;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue