diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llviewerstats.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llvoicevivox.cpp | 194 | ||||
-rw-r--r-- | indra/newview/llvoicevivox.h | 32 |
3 files changed, 120 insertions, 109 deletions
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index f52c82dab7..af7412562a 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -62,6 +62,7 @@ #include "llmeshrepository.h" //for LLMeshRepository::sBytesReceived #include "llsdserialize.h" #include "llcorehttputil.h" +#include "llvoicevivox.h" namespace LLStatViewer { @@ -570,6 +571,8 @@ void send_stats() fail["off_circuit"] = (S32) gMessageSystem->mOffCircuitPackets; fail["invalid"] = (S32) gMessageSystem->mInvalidOnCircuitPackets; + body["stats"]["voice"] = LLVoiceVivoxStats::getInstance()->read(); + // Misc stats, two strings and two ints // These are not expecticed to persist across multiple releases // Comment any changes with your name and the expected release revision 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) { diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index 81e924e438..355264133e 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -1038,5 +1038,37 @@ class LLVivoxSecurity : public LLSingleton<LLVivoxSecurity> std::string mAccountHandle; }; +class LLVoiceVivoxStats : public LLSingleton<LLVoiceVivoxStats> +{ + LLSINGLETON(LLVoiceVivoxStats); + LOG_CLASS(LLVoiceVivoxStats); + virtual ~LLVoiceVivoxStats(); + + private: + F64SecondsImplicit mStartTime; + + U32 mConnectCycles; + + F64 mConnectTime; + U32 mConnectAttempts; + + F64 mProvisionTime; + U32 mProvisionAttempts; + + F64 mEstablishTime; + U32 mEstablishAttempts; + + public: + + void reset(); + void connectionAttemptStart(); + void connectionAttemptEnd(bool success); + void provisionAttemptStart(); + void provisionAttemptEnd(bool success); + void establishAttemptStart(); + void establishAttemptEnd(bool success); + LLSD read(); +}; + #endif //LL_VIVOX_VOICE_CLIENT_H |