diff options
author | Oz Linden <oz@lindenlab.com> | 2017-03-01 11:53:18 -0500 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2017-03-01 11:53:18 -0500 |
commit | 089fb07c618e8f171716d28ae5ad594e3ee86261 (patch) | |
tree | 1bde43dadd700520e8f428902af7f7df4f0f64b6 /indra/newview/llvoicevivox.cpp | |
parent | ef5195f52a0ac13cc544906c8d7799dd39eb59ad (diff) |
VOICE-5: Add voice connection stats to the ViewerStats message
Diffstat (limited to 'indra/newview/llvoicevivox.cpp')
-rw-r--r-- | indra/newview/llvoicevivox.cpp | 194 |
1 files changed, 85 insertions, 109 deletions
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 97361e3d4e..9c4937cf16 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -148,119 +148,96 @@ class LLVivoxVoiceClientMuteListObserver : public LLMuteListObserver /* virtual */ void onChange() { LLVivoxVoiceClient::getInstance()->muteListChanged();} }; -class LLVivoxVoiceStats -{ -private: - LOG_CLASS(LLVivoxVoiceStats); - - F64SecondsImplicit mStartTime; - - U32 mConnectCycles; - F64 mConnectTime; - U32 mConnectAttempts; - - F64 mProvisionTime; - U32 mProvisionAttempts; +void LLVoiceVivoxStats::reset() +{ + mStartTime = -1.0f; + mConnectCycles = 0; + mConnectTime = -1.0f; + mConnectAttempts = 0; + mProvisionTime = -1.0f; + mProvisionAttempts = 0; + mEstablishTime = -1.0f; + mEstablishAttempts = 0; +} - F64 mEstablishTime; - U32 mEstablishAttempts; +LLVoiceVivoxStats::LLVoiceVivoxStats() +{ + reset(); +} -public: - void reset() - { - mStartTime = -1.0f; - mConnectCycles = 0; - mConnectTime = -1.0f; - mConnectAttempts = 0; - mProvisionTime = -1.0f; - mProvisionAttempts = 0; - mEstablishTime = -1.0f; - mEstablishAttempts = 0; - } - - LLVivoxVoiceStats() - { - reset(); - } - - void connectionAttemptStart() - { - if (!mConnectAttempts) - { - mStartTime = LLTimer::getTotalTime(); - mConnectCycles++; - } - mConnectAttempts++; - } +LLVoiceVivoxStats::~LLVoiceVivoxStats() +{ +} - void connectionAttemptEnd(bool success) - { - if ( success ) - { - mConnectTime = (LLTimer::getTotalTime() - mStartTime) / USEC_PER_SEC; - } - } +void LLVoiceVivoxStats::connectionAttemptStart() +{ + if (!mConnectAttempts) + { + mStartTime = LLTimer::getTotalTime(); + mConnectCycles++; + } + mConnectAttempts++; +} - void provisionAttemptStart() - { - if (!mProvisionAttempts) - { - mStartTime = LLTimer::getTotalTime(); - } - mProvisionAttempts++; - } +void LLVoiceVivoxStats::connectionAttemptEnd(bool success) +{ + if ( success ) + { + mConnectTime = (LLTimer::getTotalTime() - mStartTime) / USEC_PER_SEC; + } +} - void provisionAttemptEnd(bool success) - { - if ( success ) - { - mProvisionTime = (LLTimer::getTotalTime() - mStartTime) / USEC_PER_SEC; - } - } +void LLVoiceVivoxStats::provisionAttemptStart() +{ + if (!mProvisionAttempts) + { + mStartTime = LLTimer::getTotalTime(); + } + mProvisionAttempts++; +} - void establishAttemptStart() - { - if (!mEstablishAttempts) - { - mStartTime = LLTimer::getTotalTime(); - } - mEstablishAttempts++; - } +void LLVoiceVivoxStats::provisionAttemptEnd(bool success) +{ + if ( success ) + { + mProvisionTime = (LLTimer::getTotalTime() - mStartTime) / USEC_PER_SEC; + } +} - void establishAttemptEnd(bool success) - { - if ( success ) - { - mEstablishTime = (LLTimer::getTotalTime() - mStartTime) / USEC_PER_SEC; - } - } +void LLVoiceVivoxStats::establishAttemptStart() +{ + if (!mEstablishAttempts) + { + mStartTime = LLTimer::getTotalTime(); + } + mEstablishAttempts++; +} - void log() - { - LLSD stats(LLSD::emptyMap()); - stats["cycles"] = LLSD::Integer(mConnectCycles); +void LLVoiceVivoxStats::establishAttemptEnd(bool success) +{ + if ( success ) + { + mEstablishTime = (LLTimer::getTotalTime() - mStartTime) / USEC_PER_SEC; + } +} - LLSD connect(LLSD::emptyMap()); - connect["attempts"] = LLSD::Integer(mConnectAttempts); - connect["time"] = LLSD::Real(mConnectTime); - stats["connect"] = connect; +LLSD LLVoiceVivoxStats::read() +{ + LLSD stats(LLSD::emptyMap()); - LLSD provision(LLSD::emptyMap()); - provision["attempts"] = LLSD::Integer(mProvisionAttempts); - provision["time"] = LLSD::Real(mProvisionTime); - stats["provision"] = provision; + stats["connect_cycles"] = LLSD::Integer(mConnectCycles); + stats["connect_attempts"] = LLSD::Integer(mConnectAttempts); + stats["connect_time"] = LLSD::Real(mConnectTime); - LLSD establish(LLSD::emptyMap()); - establish["attempts"] = LLSD::Integer(mEstablishAttempts); - establish["time"] = LLSD::Real(mEstablishTime); - stats["establish"] = establish; + stats["provision_attempts"] = LLSD::Integer(mProvisionAttempts); + stats["provision_time"] = LLSD::Real(mProvisionTime); - LL_INFOS("Voice") << "Setup stats " << ll_stream_notation_sd(stats) << LL_ENDL; - } -}; + stats["establish_attempts"] = LLSD::Integer(mEstablishAttempts); + stats["establish_time"] = LLSD::Real(mEstablishTime); -LLVivoxVoiceStats Stats; + return stats; +} static LLVivoxVoiceClientMuteListObserver mutelist_listener; static bool sMuteListListener_listening = false; @@ -696,7 +673,7 @@ void LLVivoxVoiceClient::voiceControlCoro() bool LLVivoxVoiceClient::startAndConnectSession() { bool ok = false; - Stats.reset(); + LLVoiceVivoxStats::getInstance()->reset(); if (startAndLaunchDaemon()) { @@ -708,7 +685,6 @@ bool LLVivoxVoiceClient::startAndConnectSession() } } } - Stats.log(); if (!ok) { @@ -833,10 +809,10 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon() LL_DEBUGS("Voice") << "Connecting to vivox daemon:" << mDaemonHost << LL_ENDL; - Stats.reset(); + LLVoiceVivoxStats::getInstance()->reset(); while (!mConnected) { - Stats.connectionAttemptStart(); + LLVoiceVivoxStats::getInstance()->connectionAttemptStart(); LL_DEBUGS("Voice") << "Attempting to connect to vivox daemon: " << mDaemonHost << LL_ENDL; closeSocket(); if (!mSocket) @@ -845,7 +821,7 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon() } mConnected = mSocket->blockingConnect(mDaemonHost); - Stats.connectionAttemptEnd(mConnected); + LLVoiceVivoxStats::getInstance()->connectionAttemptEnd(mConnected); if (!mConnected) { llcoro::suspendUntilTimeout(CONNECT_THROTTLE_SECONDS); @@ -915,7 +891,7 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() bool provisioned = false; do { - Stats.provisionAttemptStart(); + LLVoiceVivoxStats::getInstance()->provisionAttemptStart(); result = httpAdapter->postAndSuspend(httpRequest, url, LLSD(), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; @@ -930,7 +906,7 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() else if (!status) { LL_WARNS("Voice") << "Unable to provision voice account." << LL_ENDL; - Stats.provisionAttemptEnd(false); + LLVoiceVivoxStats::getInstance()->provisionAttemptEnd(false); return false; } else @@ -939,7 +915,7 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() } } while (!provisioned && retryCount <= PROVISION_RETRY_MAX); - Stats.provisionAttemptEnd(provisioned); + LLVoiceVivoxStats::getInstance()->provisionAttemptEnd(provisioned); if (! provisioned ) { LL_WARNS("Voice") << "Could not access voice provision cap after " << retryCount << " attempts." << LL_ENDL; @@ -972,7 +948,7 @@ bool LLVivoxVoiceClient::establishVoiceConnection() if (!mVoiceEnabled && mIsInitialized) return false; - Stats.establishAttemptStart(); + LLVoiceVivoxStats::getInstance()->establishAttemptStart(); connectorCreate(); LLSD result; @@ -984,7 +960,7 @@ bool LLVivoxVoiceClient::establishVoiceConnection() while (!result.has("connector")); bool connected = result["connector"]; - Stats.establishAttemptEnd(connected); + LLVoiceVivoxStats::getInstance()->establishAttemptEnd(connected); if (!mVoiceEnabled && mIsInitialized) { |