From 6519c62d6da6287b51c51232fe1c71bbeee94192 Mon Sep 17 00:00:00 2001
From: Drake Arconis <drake@alchemyviewer.org>
Date: Mon, 7 Aug 2017 08:42:52 -0400
Subject: [PATCH] Fix storage of network stat data to be Kilobits instead of
 Kilobytes

---
 indra/newview/llstartup.cpp                      |  4 ++--
 indra/newview/llstatusbar.cpp                    |  1 +
 indra/newview/lltexturefetch.cpp                 |  2 +-
 indra/newview/llviewerstats.cpp                  |  6 +++---
 indra/newview/llviewerstats.h                    |  2 +-
 indra/newview/llworld.cpp                        |  2 +-
 .../default/xui/en/floater_scene_load_stats.xml  | 16 +++++++---------
 .../skins/default/xui/en/floater_stats.xml       |  9 ++++++++-
 .../default/xui/en/panel_preferences_setup.xml   |  2 +-
 9 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index d97416ead4..fa14d57b01 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1835,7 +1835,7 @@ bool idle_startup()
 			{
 				LL_DEBUGS("AppInit") << "Fast network connection, increasing max bandwidth to " 
 					<< FASTER_RATE_BPS/1024.f 
-					<< " kbps" << LL_ENDL;
+					<< " Kbps" << LL_ENDL;
 				gViewerThrottle.setMaxBandwidth(FASTER_RATE_BPS / 1024.f);
 			}
 			else if (rate_bps > FAST_RATE_BPS
@@ -1843,7 +1843,7 @@ bool idle_startup()
 			{
 				LL_DEBUGS("AppInit") << "Fast network connection, increasing max bandwidth to " 
 					<< FAST_RATE_BPS/1024.f 
-					<< " kbps" << LL_ENDL;
+					<< " Kbps" << LL_ENDL;
 				gViewerThrottle.setMaxBandwidth(FAST_RATE_BPS / 1024.f);
 			}
 
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index 70de01232f..a6b1f8b601 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -204,6 +204,7 @@ BOOL LLStatusBar::postBuild()
 	sgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT);
 	sgp.mouse_opaque(false);
 	sgp.stat("activemessagedatareceived");
+	sgp.unit_label("Kbps");
 	sgp.decimal_digits(0);
 	mSGBandwidth = LLUICtrlFactory::create<LLStatGraph>(sgp);
 	addChild(mSGBandwidth);
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 7f9c408bb6..63bc488776 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -1580,7 +1580,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
 		mGetReason.clear();
 		LL_DEBUGS(LOG_TXT) << "HTTP GET: " << mID << " Offset: " << mRequestedOffset
 						   << " Bytes: " << mRequestedSize
-						   << " Bandwidth(kbps): " << mFetcher->getTextureBandwidth() << "/" << mFetcher->mMaxBandwidth
+						   << " Bandwidth(Kbps): " << mFetcher->getTextureBandwidth() << "/" << mFetcher->mMaxBandwidth
 						   << LL_ENDL;
 
 		// Will call callbackHttpGet when curl request completes
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index e2eb7f7062..a1e41cb1a2 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -70,7 +70,7 @@ namespace LLStatViewer
 {
 
 LLTrace::CountStatHandle<>	FPS("FPS", "Frames rendered"),
-							PACKETS_IN("Packets In", "Packets received"),
+							PACKETS_IN("packetsinstat", "Packets received"),
 							PACKETS_LOST("packetsloststat", "Packets lost"),
 							PACKETS_OUT("packetsoutstat", "Packets sent"),
 							TEXTURE_PACKETS("texturepacketsstat", "Texture data packets received"),
@@ -100,7 +100,7 @@ LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kilotriangles> >
 LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Kilotriangles> >
 							TRIANGLES_DRAWN_PER_FRAME("trianglesdrawnperframestat");
 
-LLTrace::CountStatHandle<F64Kilobytes >	
+LLTrace::CountStatHandle<F64Kilobits >	
 							ACTIVE_MESSAGE_DATA_RECEIVED("activemessagedatareceived", "Message system data received on all active regions"),
 							LAYERS_NETWORK_DATA_RECEIVED("layersdatareceived", "Network data received for layer data (terrain)"),
 							OBJECT_NETWORK_DATA_RECEIVED("objectdatareceived", "Network data received for objects"),
@@ -404,7 +404,7 @@ void update_statistics()
 	
 	// Reset all of these values.
 	gVLManager.resetBitCounts();
-	gObjectData = (U32Bytes)0;
+	gObjectData = U32Bits(0);
 //	gDecodedBits = 0;
 
 	// Only update texture stats periodically so that they are less noisy
diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h
index ede0d0cd15..73f15839fc 100644
--- a/indra/newview/llviewerstats.h
+++ b/indra/newview/llviewerstats.h
@@ -142,7 +142,7 @@ extern LLTrace::CountStatHandle<>			FPS,
 
 extern LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kilotriangles> > TRIANGLES_DRAWN;
 
-extern LLTrace::CountStatHandle<F64Kilobytes >	ACTIVE_MESSAGE_DATA_RECEIVED,
+extern LLTrace::CountStatHandle<F64Kilobits >	ACTIVE_MESSAGE_DATA_RECEIVED,
 																	LAYERS_NETWORK_DATA_RECEIVED,
 																	OBJECT_NETWORK_DATA_RECEIVED,
 																	ASSET_UDP_DATA_RECEIVED,
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 73ac6fceb8..77414f6f12 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -854,7 +854,7 @@ void LLWorld::updateNetStats()
 		regionp->updateNetStats();
 		bits += regionp->mBitsReceived;
 		packets += llfloor( regionp->mPacketsReceived );
-		regionp->mBitsReceived = (F32Bits)0.f;
+		regionp->mBitsReceived = F32Bits(0.f);
 		regionp->mPacketsReceived = 0.f;
 	}
 
diff --git a/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml b/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml
index 62cce3a1e3..a2e2e9290a 100644
--- a/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml
+++ b/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml
@@ -41,7 +41,7 @@
         <stat_bar name="bandwidth"
                   label="UDP Data Received"
                   orientation="horizontal"
-                  unit_label="kbps"
+                  unit_label="Kbps"
                   stat="activemessagedatareceived"
                   bar_max="5000"
                   tick_spacing="500"
@@ -139,7 +139,6 @@
                     label="Packets In"
                     orientation="horizontal"
                     stat="packetsinstat"
-                    unit_label="/sec" 
                     bar_max="1024.f" 
                     tick_spacing="128.f"
                     precision="1"
@@ -148,7 +147,6 @@
                     label="Packets Out"
                     orientation="horizontal"
                     stat="packetsoutstat"
-                    unit_label="/sec"  
                     bar_max="1024.f" 
                     tick_spacing="128.f"
                     precision="1"
@@ -157,7 +155,7 @@
                     label="Objects"
                     orientation="horizontal"
                     stat="objectdatareceived"
-                    unit_label="kbps"
+                    unit_label="Kbps"
                     bar_max="1024.f"
                     tick_spacing="128.f"
                     precision="1"
@@ -166,7 +164,7 @@
                     label="Texture"
                     orientation="horizontal"
                     stat="texturedatareceived"
-                    unit_label="kbps"
+                    unit_label="Kbps"
                     bar_max="1024.f"
                     tick_spacing="128.f"
                     precision="1"
@@ -175,7 +173,7 @@
                     label="Asset"
                     orientation="horizontal"
                     stat="assetudpdatareceived"
-                    unit_label="kbps"
+                    unit_label="Kbps"
                     bar_max="1024.f"
                     tick_spacing="128.f"
                     precision="1"
@@ -184,7 +182,7 @@
                     label="Layers"
                     orientation="horizontal"
                     stat="layersdatareceived"
-                    unit_label="kbps"
+                    unit_label="Kbps"
                     bar_max="1024.f"
                     tick_spacing="128.f"
                     precision="1"
@@ -193,7 +191,7 @@
                     label="Actual In"
                     orientation="horizontal"
                     stat="messagedatain"
-                    unit_label="kbps"
+                    unit_label="Kbps"
                     bar_max="1024.f"
                     tick_spacing="128.f"
                     precision="1"
@@ -202,7 +200,7 @@
                     label="Actual Out"
                     orientation="horizontal"
                     stat="messagedataout"
-                    unit_label="kbps"
+                    unit_label="Kbps"
                     bar_max="1024.f"
                     tick_spacing="128.f"
                     precision="1"
diff --git a/indra/newview/skins/default/xui/en/floater_stats.xml b/indra/newview/skins/default/xui/en/floater_stats.xml
index caced4a5b7..8a057995ee 100644
--- a/indra/newview/skins/default/xui/en/floater_stats.xml
+++ b/indra/newview/skins/default/xui/en/floater_stats.xml
@@ -38,6 +38,7 @@
        <stat_bar name="bandwidth"
                   label="UDP Data Received"
                   stat="activemessagedatareceived"
+                  unit_label="Kbps"
                   decimal_digits="0"
                   show_bar="true"/>
         <stat_bar name="packet_loss"
@@ -179,7 +180,7 @@
                    setting="OpenDebugStatNet">
           <stat_bar name="packetsinstat"
                     label="Packets In"
-                    stat="Packets In"
+                    stat="packetsinstat"
                     decimal_digits="1"/>
           <stat_bar name="packetsoutstat"
                     label="Packets Out"
@@ -188,26 +189,32 @@
           <stat_bar name="objectdatareceived"
                     label="Objects"
                     stat="objectdatareceived"
+                    unit_label="Kbps"
                     decimal_digits="1"/>
           <stat_bar name="texturedatareceived"
                     label="Texture"
                     stat="texturedatareceived"
+                    unit_label="Kbps"
                     decimal_digits="1"/>
           <stat_bar name="assetudpdatareceived"
                     label="Asset"
                     stat="assetudpdatareceived"
+                    unit_label="Kbps"
                     decimal_digits="1"/>
           <stat_bar name="layersdatareceived"
                     label="Layers"
                     stat="layersdatareceived"
+                    unit_label="Kbps"
                     decimal_digits="1"/>
           <stat_bar name="messagedatain"
                     label="Actual In"
                     stat="messagedatain"
+                    unit_label="Kbps"
                     decimal_digits="1"/>
           <stat_bar name="messagedataout"
                     label="Actual Out"
                     stat="messagedataout"
+                    unit_label="Kbps"
                     decimal_digits="1"
                     show_history="false"/>
           <stat_bar name="vfspendingoperations"
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
index 4f9f70fb28..f6ad131bb2 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
@@ -61,7 +61,7 @@
    name="text_box2"
    top_delta="0"
    width="200">
-    kbps
+    Kbps
   </text>
   <check_box
    control_name="ConnectionPortEnabled"
-- 
GitLab