From 4e3fddf271e6ff4557f594b6a8c036ab2a4e413f Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Fri, 8 Mar 2013 17:08:00 -0800
Subject: [PATCH] fixed remaining sample and add calls

---
 indra/newview/llfloaterjoystick.cpp  |  2 +-
 indra/newview/llviewerassetstats.cpp |  6 +++---
 indra/newview/llviewercamera.cpp     |  4 ++--
 indra/newview/llviewerstats.h        | 13 ++++++++++++-
 4 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp
index 25c119d9e19..7fcebc965ad 100644
--- a/indra/newview/llfloaterjoystick.cpp
+++ b/indra/newview/llfloaterjoystick.cpp
@@ -77,7 +77,7 @@ void LLFloaterJoystick::draw()
 	for (U32 i = 0; i < 6; i++)
 	{
 		F32 value = joystick->getJoystickAxis(i);
-		sJoystickAxes[i]->sample(value * gFrameIntervalSeconds.value());
+		sample(*sJoystickAxes[i], value * gFrameIntervalSeconds.value());
 		if (mAxisStatsBar[i])
 		{
 			F32 minbar, maxbar;
diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp
index 0c72c3c5aa5..8623af52ff1 100644
--- a/indra/newview/llviewerassetstats.cpp
+++ b/indra/newview/llviewerassetstats.cpp
@@ -547,21 +547,21 @@ void record_enqueue(LLViewerAssetType::EType at, bool with_http, bool is_temp)
 {
 	const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
 
-	sEnqueued[int(eac)]->add(1);
+	add(*sEnqueued[int(eac)], 1);
 }
 
 void record_dequeue(LLViewerAssetType::EType at, bool with_http, bool is_temp)
 {
 	const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
 
-	sDequeued[int(eac)]->add(1);
+	add(*sDequeued[int(eac)], 1);
 }
 
 void record_response(LLViewerAssetType::EType at, bool with_http, bool is_temp, LLViewerAssetStats::duration_t duration)
 {
 	const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp));
 
-	sResponse[int(eac)]->sample<LLTrace::Microseconds>(duration);
+	sample(*sResponse[int(eac)], LLTrace::Microseconds(duration));
 }
 
 void record_avatar_stats()
diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp
index 6e0a2c88a83..9ca5f07f35b 100644
--- a/indra/newview/llviewercamera.cpp
+++ b/indra/newview/llviewercamera.cpp
@@ -167,8 +167,8 @@ void LLViewerCamera::updateCameraLocation(const LLVector3 &center,
 	F32 drot;
 	rotation.getAngleAxis(&drot, &x, &y, &z);
 
-	sVelocityStat.add(dpos);
-	sAngularVelocityStat.add(drot);
+	add(sVelocityStat, dpos);
+	add(sAngularVelocityStat, drot);
 	
 	mAverageSpeed = LLTrace::get_frame_recording().getPeriodMeanPerSec(sVelocityStat);
 	mAverageAngularSpeed = LLTrace::get_frame_recording().getPeriodMeanPerSec(sAngularVelocityStat);
diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h
index a82c64317ea..069a726e5e1 100644
--- a/indra/newview/llviewerstats.h
+++ b/indra/newview/llviewerstats.h
@@ -41,6 +41,8 @@ struct SimMeasurementSampler : public LLInstanceTracker<SimMeasurementSampler, E
 	:	LLInstanceTracker<SimMeasurementSampler, ESimStatID>(id)
 	{}
 	virtual ~SimMeasurementSampler() {}
+
+	virtual void sample(F64 value) = 0;
 };
 
 template<typename T = F64>
@@ -52,9 +54,18 @@ struct SimMeasurement : public LLTrace::MeasurementStatHandle<T>, public SimMeas
 	{}
 
 	using SimMeasurementSampler::getInstance;
-};
 
+	/*virtual*/ void sample(F64 value)
+	{
+		LLTrace::sample(*this, value);
+	}
+};
 
+template<typename T, typename VALUE_T>
+void sample(SimMeasurement<T>& measurement, VALUE_T value)
+{
+	LLTrace::sample(measurement, value);
+}
 extern LLTrace::CountStatHandle<>						FPS,
 											PACKETS_IN,
 											PACKETS_LOST,
-- 
GitLab