mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 09:46:29 +02:00
Add test logging, stats, and force domain pings to timer thread
Test code for load testing only.
This commit is contained in:
parent
6df28da0a5
commit
e2e1edc8b0
6 changed files with 47 additions and 3 deletions
|
@ -1055,6 +1055,11 @@ void DomainServer::processListRequestPacket(QSharedPointer<ReceivedMessage> mess
|
|||
_gatekeeper.cleanupICEPeerForNode(sendingNode->getUUID());
|
||||
}
|
||||
|
||||
if (sendingNode->getType() == NodeType::AvatarMixer) {
|
||||
qWarning() << "Avatar Mixer Node Report in.";
|
||||
}
|
||||
|
||||
|
||||
// guard against patched agents asking to hear about other agents
|
||||
auto safeInterestSet = nodeRequestData.interestList.toSet();
|
||||
if (sendingNode->getType() == NodeType::Agent) {
|
||||
|
|
|
@ -545,7 +545,7 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer<Rec
|
|||
|
||||
bool DomainHandler::checkInPacketTimeout() {
|
||||
++_checkInPacketsSinceLastReply;
|
||||
|
||||
qCWarning(networking) << "Check in packet increment";
|
||||
if (_checkInPacketsSinceLastReply > MAX_SILENT_DOMAIN_SERVER_CHECK_INS) {
|
||||
// we haven't heard back from DS in MAX_SILENT_DOMAIN_SERVER_CHECK_INS
|
||||
// so emit our signal that says that
|
||||
|
|
|
@ -246,6 +246,7 @@ void NodeList::processICEPingPacket(QSharedPointer<ReceivedMessage> message) {
|
|||
|
||||
void NodeList::reset(bool skipDomainHandlerReset) {
|
||||
if (thread() != QThread::currentThread()) {
|
||||
|
||||
QMetaObject::invokeMethod(this, "reset", Q_ARG(bool, skipDomainHandlerReset));
|
||||
return;
|
||||
}
|
||||
|
@ -291,16 +292,30 @@ void NodeList::addSetOfNodeTypesToNodeInterestSet(const NodeSet& setOfNodeTypes)
|
|||
|
||||
void NodeList::sendDomainServerCheckIn() {
|
||||
|
||||
static bool foo = false;
|
||||
|
||||
qWarning() << "Send Domain Server Checkin";
|
||||
|
||||
if (!_sendDomainServerCheckInEnabled) {
|
||||
qCDebug(networking) << "Refusing to send a domain-server check in while it is disabled.";
|
||||
return;
|
||||
}
|
||||
|
||||
if (thread() != QThread::currentThread()) {
|
||||
_globalPostedEvents = getGlobalPostedEventCount();
|
||||
|
||||
if (false && thread() != QThread::currentThread()) {
|
||||
qWarning() << "Transition threads on send domain server checkin";
|
||||
QMetaObject::invokeMethod(this, "sendDomainServerCheckIn", Qt::QueuedConnection);
|
||||
|
||||
if (foo) {
|
||||
qWarning() << "swapping threads before previous call completed";
|
||||
}
|
||||
|
||||
foo = true;
|
||||
return;
|
||||
}
|
||||
|
||||
foo = false;
|
||||
if (_isShuttingDown) {
|
||||
qCDebug(networking) << "Refusing to send a domain-server check in while shutting down.";
|
||||
return;
|
||||
|
@ -433,10 +448,17 @@ void NodeList::sendDomainServerCheckIn() {
|
|||
checkinCount = std::min(checkinCount, MAX_CHECKINS_TOGETHER);
|
||||
for (int i = 1; i < checkinCount; ++i) {
|
||||
auto packetCopy = domainPacket->createCopy(*domainPacket);
|
||||
qWarning() << "Domain List/Connect";
|
||||
sendPacket(std::move(packetCopy), _domainHandler.getSockAddr());
|
||||
}
|
||||
qWarning() << "Domain List/Connect";
|
||||
sendPacket(std::move(domainPacket), _domainHandler.getSockAddr());
|
||||
|
||||
} else if (_domainHandler.getIP().isNull()) {
|
||||
qWarning() << "Domain Handler IP Is Null";
|
||||
}
|
||||
else {
|
||||
qWarning() << "Checkin packet timed out.";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -100,6 +100,8 @@ public:
|
|||
virtual Node::LocalID getDomainLocalID() const override { return _domainHandler.getLocalID(); }
|
||||
virtual HifiSockAddr getDomainSockAddr() const override { return _domainHandler.getSockAddr(); }
|
||||
|
||||
unsigned getGlobalPostedEventCount() { return _globalPostedEvents; }
|
||||
|
||||
public slots:
|
||||
void reset(bool skipDomainHandlerReset = false);
|
||||
void resetFromDomainHandler() { reset(true); }
|
||||
|
@ -171,6 +173,7 @@ private:
|
|||
bool _isShuttingDown { false };
|
||||
QTimer _keepAlivePingTimer;
|
||||
bool _requestsDomainListData { false };
|
||||
unsigned _globalPostedEvents { 0 };
|
||||
|
||||
bool _sendDomainServerCheckInEnabled { true };
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ ThreadedAssignment::ThreadedAssignment(ReceivedMessage& message) :
|
|||
// if the NL tells us we got a DS response, clear our member variable of queued check-ins
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
connect(nodeList.data(), &NodeList::receivedDomainServerList, this, &ThreadedAssignment::clearQueuedCheckIns);
|
||||
timestamp = p_high_resolution_clock::now();
|
||||
}
|
||||
|
||||
void ThreadedAssignment::setFinished(bool isFinished) {
|
||||
|
@ -102,6 +103,14 @@ void ThreadedAssignment::addPacketStatsAndSendStatsPacket(QJsonObject statsObjec
|
|||
|
||||
statsObject["io_stats"] = ioStats;
|
||||
|
||||
QJsonObject assignmentStats;
|
||||
assignmentStats["numQueuedCheckIns"] = _numQueuedCheckIns;
|
||||
|
||||
assignmentStats["globalPostedEventCount"] = (long long)nodeList->getGlobalPostedEventCount();
|
||||
|
||||
assignmentStats["domainReportDuration"] = domainServerReportPerSec.count();
|
||||
statsObject["assignmentStats"] = assignmentStats;
|
||||
|
||||
nodeList->sendStatsToDomainServer(statsObject);
|
||||
}
|
||||
|
||||
|
@ -113,13 +122,16 @@ void ThreadedAssignment::sendStatsPacket() {
|
|||
void ThreadedAssignment::checkInWithDomainServerOrExit() {
|
||||
// verify that the number of queued check-ins is not >= our max
|
||||
// the number of queued check-ins is cleared anytime we get a response from the domain-server
|
||||
|
||||
timestamp = p_high_resolution_clock::now();
|
||||
|
||||
if (_numQueuedCheckIns >= MAX_SILENT_DOMAIN_SERVER_CHECK_INS) {
|
||||
qCDebug(networking) << "At least" << MAX_SILENT_DOMAIN_SERVER_CHECK_INS << "have been queued without a response from domain-server"
|
||||
<< "Stopping the current assignment";
|
||||
stop();
|
||||
} else {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
QMetaObject::invokeMethod(nodeList.data(), "sendDomainServerCheckIn");
|
||||
QMetaObject::invokeMethod(nodeList.data(), "sendDomainServerCheckIn", Qt::DirectConnection);
|
||||
|
||||
// increase the number of queued check ins
|
||||
_numQueuedCheckIns++;
|
||||
|
|
|
@ -48,6 +48,8 @@ protected:
|
|||
QTimer _domainServerTimer;
|
||||
QTimer _statsTimer;
|
||||
int _numQueuedCheckIns { 0 };
|
||||
p_high_resolution_clock::time_point timestamp;
|
||||
std::chrono::milliseconds domainServerReportPerSec{ 0 };
|
||||
|
||||
protected slots:
|
||||
void domainSettingsRequestFailed();
|
||||
|
|
Loading…
Reference in a new issue