diff options
Diffstat (limited to 'linden/indra/newview/llfloaterlagmeter.cpp')
-rw-r--r-- | linden/indra/newview/llfloaterlagmeter.cpp | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/linden/indra/newview/llfloaterlagmeter.cpp b/linden/indra/newview/llfloaterlagmeter.cpp index 4acc524..f43427c 100644 --- a/linden/indra/newview/llfloaterlagmeter.cpp +++ b/linden/indra/newview/llfloaterlagmeter.cpp | |||
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | #include "llfloaterlagmeter.h" | 34 | #include "llfloaterlagmeter.h" |
35 | 35 | ||
36 | #include "llvieweruictrlfactory.h" | 36 | #include "lluictrlfactory.h" |
37 | #include "llviewerstats.h" | 37 | #include "llviewerstats.h" |
38 | #include "llviewerimage.h" | 38 | #include "llviewerimage.h" |
39 | #include "llviewercontrol.h" | 39 | #include "llviewercontrol.h" |
@@ -49,28 +49,26 @@ const LLString LAG_CRITICAL_IMAGE_NAME = "lag_status_critical.tga"; | |||
49 | const LLString LAG_WARNING_IMAGE_NAME = "lag_status_warning.tga"; | 49 | const LLString LAG_WARNING_IMAGE_NAME = "lag_status_warning.tga"; |
50 | const LLString LAG_GOOD_IMAGE_NAME = "lag_status_good.tga"; | 50 | const LLString LAG_GOOD_IMAGE_NAME = "lag_status_good.tga"; |
51 | 51 | ||
52 | LLFloaterLagMeter * LLFloaterLagMeter::sInstance = NULL; | 52 | LLFloaterLagMeter::LLFloaterLagMeter(const LLSD& key) |
53 | |||
54 | LLFloaterLagMeter::LLFloaterLagMeter() | ||
55 | : LLFloater("floater_lagmeter") | 53 | : LLFloater("floater_lagmeter") |
56 | { | 54 | { |
57 | gUICtrlFactory->buildFloater(this, "floater_lagmeter.xml"); | 55 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_lagmeter.xml"); |
58 | 56 | ||
59 | // Don't let this window take keyboard focus -- it's confusing to | 57 | // Don't let this window take keyboard focus -- it's confusing to |
60 | // lose arrow-key driving when testing lag. | 58 | // lose arrow-key driving when testing lag. |
61 | setIsChrome(TRUE); | 59 | setIsChrome(TRUE); |
62 | 60 | ||
63 | mClientButton = LLUICtrlFactory::getButtonByName(this, "client_lagmeter"); | 61 | mClientButton = getChild<LLButton>("client_lagmeter"); |
64 | mClientText = LLUICtrlFactory::getTextBoxByName(this, "client_text"); | 62 | mClientText = getChild<LLTextBox>("client_text"); |
65 | mClientCause = LLUICtrlFactory::getTextBoxByName(this, "client_lag_cause"); | 63 | mClientCause = getChild<LLTextBox>("client_lag_cause"); |
66 | 64 | ||
67 | mNetworkButton = LLUICtrlFactory::getButtonByName(this, "network_lagmeter"); | 65 | mNetworkButton = getChild<LLButton>("network_lagmeter"); |
68 | mNetworkText = LLUICtrlFactory::getTextBoxByName(this, "network_text"); | 66 | mNetworkText = getChild<LLTextBox>("network_text"); |
69 | mNetworkCause = LLUICtrlFactory::getTextBoxByName(this, "network_lag_cause"); | 67 | mNetworkCause = getChild<LLTextBox>("network_lag_cause"); |
70 | 68 | ||
71 | mServerButton = LLUICtrlFactory::getButtonByName(this, "server_lagmeter"); | 69 | mServerButton = getChild<LLButton>("server_lagmeter"); |
72 | mServerText = LLUICtrlFactory::getTextBoxByName(this, "server_text"); | 70 | mServerText = getChild<LLTextBox>("server_text"); |
73 | mServerCause = LLUICtrlFactory::getTextBoxByName(this, "server_lag_cause"); | 71 | mServerCause = getChild<LLTextBox>("server_lag_cause"); |
74 | 72 | ||
75 | LLString config_string = getString("client_frame_rate_critical_fps", mStringArgs); | 73 | LLString config_string = getString("client_frame_rate_critical_fps", mStringArgs); |
76 | mClientFrameTimeCritical = 1.0f / (float)atof( config_string.c_str() ); | 74 | mClientFrameTimeCritical = 1.0f / (float)atof( config_string.c_str() ); |
@@ -127,8 +125,6 @@ LLFloaterLagMeter::LLFloaterLagMeter() | |||
127 | 125 | ||
128 | LLFloaterLagMeter::~LLFloaterLagMeter() | 126 | LLFloaterLagMeter::~LLFloaterLagMeter() |
129 | { | 127 | { |
130 | sInstance = NULL; | ||
131 | |||
132 | // save shrunk status for next time | 128 | // save shrunk status for next time |
133 | gSavedSettings.setBOOL("LagMeterShrunk", mShrunk); | 129 | gSavedSettings.setBOOL("LagMeterShrunk", mShrunk); |
134 | // expand so we save the large window rectangle | 130 | // expand so we save the large window rectangle |
@@ -147,16 +143,9 @@ void LLFloaterLagMeter::draw() | |||
147 | LLFloater::draw(); | 143 | LLFloater::draw(); |
148 | } | 144 | } |
149 | 145 | ||
150 | //static | ||
151 | void LLFloaterLagMeter::show(void *data) | ||
152 | { | ||
153 | if(!sInstance) sInstance = new LLFloaterLagMeter(); | ||
154 | sInstance->open(); | ||
155 | } | ||
156 | |||
157 | void LLFloaterLagMeter::determineClient() | 146 | void LLFloaterLagMeter::determineClient() |
158 | { | 147 | { |
159 | F32 client_frame_time = gViewerStats->mFPSStat.getMeanDuration(); | 148 | F32 client_frame_time = LLViewerStats::getInstance()->mFPSStat.getMeanDuration(); |
160 | bool find_cause = false; | 149 | bool find_cause = false; |
161 | 150 | ||
162 | if (!gFocusMgr.getAppHasFocus()) | 151 | if (!gFocusMgr.getAppHasFocus()) |
@@ -207,8 +196,8 @@ void LLFloaterLagMeter::determineClient() | |||
207 | 196 | ||
208 | void LLFloaterLagMeter::determineNetwork() | 197 | void LLFloaterLagMeter::determineNetwork() |
209 | { | 198 | { |
210 | F32 packet_loss = gViewerStats->mPacketsLostPercentStat.getMean(); | 199 | F32 packet_loss = LLViewerStats::getInstance()->mPacketsLostPercentStat.getMean(); |
211 | F32 ping_time = gViewerStats->mSimPingStat.getMean(); | 200 | F32 ping_time = LLViewerStats::getInstance()->mSimPingStat.getMean(); |
212 | bool find_cause_loss = false; | 201 | bool find_cause_loss = false; |
213 | bool find_cause_ping = false; | 202 | bool find_cause_ping = false; |
214 | 203 | ||
@@ -258,7 +247,7 @@ void LLFloaterLagMeter::determineNetwork() | |||
258 | 247 | ||
259 | void LLFloaterLagMeter::determineServer() | 248 | void LLFloaterLagMeter::determineServer() |
260 | { | 249 | { |
261 | F32 sim_frame_time = gViewerStats->mSimFrameMsec.getCurrent(); | 250 | F32 sim_frame_time = LLViewerStats::getInstance()->mSimFrameMsec.getCurrent(); |
262 | bool find_cause = false; | 251 | bool find_cause = false; |
263 | 252 | ||
264 | if(sim_frame_time >= mServerFrameTimeCritical) | 253 | if(sim_frame_time >= mServerFrameTimeCritical) |
@@ -282,23 +271,23 @@ void LLFloaterLagMeter::determineServer() | |||
282 | 271 | ||
283 | if(find_cause) | 272 | if(find_cause) |
284 | { | 273 | { |
285 | if(gViewerStats->mSimSimPhysicsMsec.getCurrent() > mServerSingleProcessMaxTime) | 274 | if(LLViewerStats::getInstance()->mSimSimPhysicsMsec.getCurrent() > mServerSingleProcessMaxTime) |
286 | { | 275 | { |
287 | mServerCause->setText( getString("server_physics_cause_msg", mStringArgs) ); | 276 | mServerCause->setText( getString("server_physics_cause_msg", mStringArgs) ); |
288 | } | 277 | } |
289 | else if(gViewerStats->mSimScriptMsec.getCurrent() > mServerSingleProcessMaxTime) | 278 | else if(LLViewerStats::getInstance()->mSimScriptMsec.getCurrent() > mServerSingleProcessMaxTime) |
290 | { | 279 | { |
291 | mServerCause->setText( getString("server_scripts_cause_msg", mStringArgs) ); | 280 | mServerCause->setText( getString("server_scripts_cause_msg", mStringArgs) ); |
292 | } | 281 | } |
293 | else if(gViewerStats->mSimNetMsec.getCurrent() > mServerSingleProcessMaxTime) | 282 | else if(LLViewerStats::getInstance()->mSimNetMsec.getCurrent() > mServerSingleProcessMaxTime) |
294 | { | 283 | { |
295 | mServerCause->setText( getString("server_net_cause_msg", mStringArgs) ); | 284 | mServerCause->setText( getString("server_net_cause_msg", mStringArgs) ); |
296 | } | 285 | } |
297 | else if(gViewerStats->mSimAgentMsec.getCurrent() > mServerSingleProcessMaxTime) | 286 | else if(LLViewerStats::getInstance()->mSimAgentMsec.getCurrent() > mServerSingleProcessMaxTime) |
298 | { | 287 | { |
299 | mServerCause->setText( getString("server_agent_cause_msg", mStringArgs) ); | 288 | mServerCause->setText( getString("server_agent_cause_msg", mStringArgs) ); |
300 | } | 289 | } |
301 | else if(gViewerStats->mSimImagesMsec.getCurrent() > mServerSingleProcessMaxTime) | 290 | else if(LLViewerStats::getInstance()->mSimImagesMsec.getCurrent() > mServerSingleProcessMaxTime) |
302 | { | 291 | { |
303 | mServerCause->setText( getString("server_images_cause_msg", mStringArgs) ); | 292 | mServerCause->setText( getString("server_images_cause_msg", mStringArgs) ); |
304 | } | 293 | } |