SH-4161 Integrate cpu metrics into LLDeadmanTimer and then metrics viewer

Thu, 02 May 2013 19:12:59 -0400

author
Monty Brandenberg <monty@lindenlab.com>
date
Thu, 02 May 2013 19:12:59 -0400
changeset 40674
e871c50e5754
parent 40673
b28cbb28f165
child 40675
6289b8edf5fa
child 40714
09d692569c32

SH-4161 Integrate cpu metrics into LLDeadmanTimer and then metrics viewer
Normalize deadman timer's args on U64/F64. Internals remain the
same. Modify mesh to collect and output enhanced CPU metrics.

indra/llcommon/lldeadmantimer.cpp file | annotate | diff | revisions
indra/llcommon/lldeadmantimer.h file | annotate | diff | revisions
indra/llcommon/tests/lldeadmantimer_test.cpp file | annotate | diff | revisions
indra/newview/llmeshrepository.cpp file | annotate | diff | revisions
     1.1 --- a/indra/llcommon/lldeadmantimer.cpp	Thu May 02 21:59:53 2013 +0000
     1.2 +++ b/indra/llcommon/lldeadmantimer.cpp	Thu May 02 19:12:59 2013 -0400
     1.3 @@ -110,13 +110,13 @@
     1.4  
     1.5  
     1.6  bool LLDeadmanTimer::isExpired(time_type now, F64 & started, F64 & stopped, U64 & count,
     1.7 -							   LLProcInfo::time_type & user_cpu, LLProcInfo::time_type & sys_cpu)
     1.8 +							   U64 & user_cpu, U64 & sys_cpu)
     1.9  {
    1.10  	const bool status(isExpired(now, started, stopped, count));
    1.11  	if (status)
    1.12  	{
    1.13 -		user_cpu = mUEndCPU - mUStartCPU;
    1.14 -		sys_cpu = mSEndCPU - mSStartCPU;
    1.15 +		user_cpu = U64(mUEndCPU - mUStartCPU);
    1.16 +		sys_cpu = U64(mSEndCPU - mSStartCPU);
    1.17  	}
    1.18  	return status;
    1.19  }
     2.1 --- a/indra/llcommon/lldeadmantimer.h	Thu May 02 21:59:53 2013 +0000
     2.2 +++ b/indra/llcommon/lldeadmantimer.h	Thu May 02 19:12:59 2013 -0400
     2.3 @@ -190,7 +190,7 @@
     2.4  	///					left unchanged.
     2.5  	///
     2.6  	bool isExpired(time_type now, F64 & started, F64 & stopped, U64 & count,
     2.7 -				   LLProcInfo::time_type & user_cpu, LLProcInfo::time_type & sys_cpu);
     2.8 +				   U64 & user_cpu, U64 & sys_cpu);
     2.9  
    2.10  	/// Identical to the six-arugment form except is does without the
    2.11  	/// CPU time return if the caller isn't interested in it.
     3.1 --- a/indra/llcommon/tests/lldeadmantimer_test.cpp	Thu May 02 21:59:53 2013 +0000
     3.2 +++ b/indra/llcommon/tests/lldeadmantimer_test.cpp	Thu May 02 19:12:59 2013 -0400
     3.3 @@ -81,16 +81,15 @@
     3.4  	{
     3.5  		// With cpu metrics
     3.6  		F64 started(42.0), stopped(97.0);
     3.7 -		U64 count(U64L(8));
     3.8 -		LLProcInfo::time_type user_cpu(29000), sys_cpu(57000);
     3.9 +		U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000);
    3.10  		LLDeadmanTimer timer(10.0, true);
    3.11  
    3.12  		ensure_equals("WCM isExpired() returns false after ctor()", timer.isExpired(0, started, stopped, count, user_cpu, sys_cpu), false);
    3.13  		ensure_approximately_equals("WCM t1 - isExpired() does not modify started", started, F64(42.0), 2);
    3.14  		ensure_approximately_equals("WCM t1 - isExpired() does not modify stopped", stopped, F64(97.0), 2);
    3.15  		ensure_equals("WCM t1 - isExpired() does not modify count", count, U64L(8));
    3.16 -		ensure_equals("WCM t1 - isExpired() does not modify user_cpu", user_cpu, LLProcInfo::time_type(29000));
    3.17 -		ensure_equals("WCM t1 - isExpired() does not modify sys_cpu", sys_cpu, LLProcInfo::time_type(57000));
    3.18 +		ensure_equals("WCM t1 - isExpired() does not modify user_cpu", user_cpu, U64L(29000));
    3.19 +		ensure_equals("WCM t1 - isExpired() does not modify sys_cpu", sys_cpu, U64L(57000));
    3.20  	}
    3.21  }
    3.22  
    3.23 @@ -112,8 +111,7 @@
    3.24  	{
    3.25  		// With cpu metrics
    3.26  		F64 started(42.0), stopped(97.0);
    3.27 -		U64 count(U64L(8));
    3.28 -		LLProcInfo::time_type user_cpu(29000), sys_cpu(57000);
    3.29 +		U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000);
    3.30  		LLDeadmanTimer timer(0.0, true);			// Zero is pre-expired
    3.31  		
    3.32  		ensure_equals("WCM isExpired() still returns false with 0.0 time ctor()",
    3.33 @@ -141,8 +139,7 @@
    3.34  	{
    3.35  		// With cpu metrics
    3.36  		F64 started(42.0), stopped(97.0);
    3.37 -		U64 count(U64L(8));
    3.38 -		LLProcInfo::time_type user_cpu(29000), sys_cpu(57000);
    3.39 +		U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000);
    3.40  		LLDeadmanTimer timer(0.0, true);
    3.41  
    3.42  		timer.start(0);
    3.43 @@ -172,8 +169,7 @@
    3.44  	{
    3.45  		// With cpu metrics
    3.46  		F64 started(42.0), stopped(97.0);
    3.47 -		U64 count(U64L(8));
    3.48 -		LLProcInfo::time_type user_cpu(29000), sys_cpu(57000);
    3.49 +		U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000);
    3.50  		LLDeadmanTimer timer(0.0, true);
    3.51  	
    3.52  		timer.start(0);
    3.53 @@ -205,8 +201,7 @@
    3.54  	{
    3.55  		// With cpu metrics
    3.56  		F64 started(42.0), stopped(97.0);
    3.57 -		U64 count(U64L(8));
    3.58 -		LLProcInfo::time_type user_cpu(29000), sys_cpu(57000);
    3.59 +		U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000);
    3.60  		LLDeadmanTimer timer(10.0, true);
    3.61  	
    3.62  		timer.start(0);
    3.63 @@ -215,8 +210,8 @@
    3.64  		ensure_approximately_equals("WCM t5 - isExpired() does not modify started", started, F64(42.0), 2);
    3.65  		ensure_approximately_equals("WCM t5 - isExpired() does not modify stopped", stopped, F64(97.0), 2);
    3.66  		ensure_equals("WCM t5 - isExpired() does not modify count", count, U64L(8));
    3.67 -		ensure_equals("WCM t5 - isExpired() does not modify user_cpu", user_cpu, LLProcInfo::time_type(29000));
    3.68 -		ensure_equals("WCM t5 - isExpired() does not modify sys_cpu", sys_cpu, LLProcInfo::time_type(57000));
    3.69 +		ensure_equals("WCM t5 - isExpired() does not modify user_cpu", user_cpu, U64L(29000));
    3.70 +		ensure_equals("WCM t5 - isExpired() does not modify sys_cpu", sys_cpu, U64L(57000));
    3.71  	}
    3.72  }
    3.73  
    3.74 @@ -247,8 +242,7 @@
    3.75  	{
    3.76  		// With cpu metrics
    3.77  		F64 started(42.0), stopped(97.0);
    3.78 -		U64 count(U64L(8));
    3.79 -		LLProcInfo::time_type user_cpu(29000), sys_cpu(57000);
    3.80 +		U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000);
    3.81  		LLDeadmanTimer timer(10.0, true);
    3.82  
    3.83  		// Would like to do subtraction on current time but can't because
    3.84 @@ -263,8 +257,8 @@
    3.85  		ensure_approximately_equals("WCM t6 - isExpired() does not modify started", started, F64(42.0), 2);
    3.86  		ensure_approximately_equals("WCM t6 - isExpired() does not modify stopped", stopped, F64(97.0), 2);
    3.87  		ensure_equals("t6 - isExpired() does not modify count", count, U64L(8));
    3.88 -		ensure_equals("WCM t6 - isExpired() does not modify user_cpu", user_cpu, LLProcInfo::time_type(29000));
    3.89 -		ensure_equals("WCM t6 - isExpired() does not modify sys_cpu", sys_cpu, LLProcInfo::time_type(57000));
    3.90 +		ensure_equals("WCM t6 - isExpired() does not modify user_cpu", user_cpu, U64L(29000));
    3.91 +		ensure_equals("WCM t6 - isExpired() does not modify sys_cpu", sys_cpu, U64L(57000));
    3.92  	}
    3.93  }
    3.94  
    3.95 @@ -293,9 +287,8 @@
    3.96  	{
    3.97  		// With cpu metrics
    3.98  		F64 started(42.0), stopped(97.0);
    3.99 -		U64 count(U64L(8));
   3.100 +		U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000);
   3.101  		LLDeadmanTimer timer(10.0, true);
   3.102 -		LLProcInfo::time_type user_cpu(29000), sys_cpu(57000);
   3.103  		
   3.104  		// Would like to do subtraction on current time but can't because
   3.105  		// the implementation on Windows is zero-based.  We wrap around
   3.106 @@ -343,9 +336,8 @@
   3.107  	{
   3.108  		// With cpu metrics
   3.109  		F64 started(42.0), stopped(97.0);
   3.110 -		U64 count(U64L(8));
   3.111 +		U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000);
   3.112  		LLDeadmanTimer timer(10.0, true);
   3.113 -		LLProcInfo::time_type user_cpu(29000), sys_cpu(57000);
   3.114  
   3.115  		// Would like to do subtraction on current time but can't because
   3.116  		// the implementation on Windows is zero-based.  We wrap around
   3.117 @@ -367,8 +359,8 @@
   3.118  		ensure_approximately_equals("WCM t8 - 2nd isExpired() does not modify started", started, F64(42.0), 2);
   3.119  		ensure_approximately_equals("WCM t8 - 2nd isExpired() does not modify stopped", stopped, F64(97.0), 2);
   3.120  		ensure_equals("WCM t8 - 2nd isExpired() does not modify count", count, U64L(8));
   3.121 -		ensure_equals("WCM t8 - 2nd isExpired() does not modify user_cpu", user_cpu, LLProcInfo::time_type(29000));
   3.122 -		ensure_equals("WCM t8 - 2nd isExpired() does not modify sys_cpu", sys_cpu, LLProcInfo::time_type(57000));
   3.123 +		ensure_equals("WCM t8 - 2nd isExpired() does not modify user_cpu", user_cpu, U64L(29000));
   3.124 +		ensure_equals("WCM t8 - 2nd isExpired() does not modify sys_cpu", sys_cpu, U64L(57000));
   3.125  	}
   3.126  }
   3.127  
   3.128 @@ -423,9 +415,8 @@
   3.129  	{
   3.130  		// With cpu metrics
   3.131  		F64 started(42.0), stopped(97.0);
   3.132 -		U64 count(U64L(8));
   3.133 +		U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000);
   3.134  		LLDeadmanTimer timer(5.0, true);
   3.135 -		LLProcInfo::time_type user_cpu(29000), sys_cpu(57000);
   3.136  
   3.137  		LLDeadmanTimer::time_type now(LLDeadmanTimer::getNow());
   3.138  		F64 real_start(u64_time_to_float(now));
   3.139 @@ -553,9 +544,9 @@
   3.140  	{
   3.141  		// With cpu metrics
   3.142  		F64 started(42.0), stopped(97.0);
   3.143 -		U64 count(U64L(8));
   3.144 +		U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000);
   3.145 +
   3.146  		LLDeadmanTimer timer(5.0, true);
   3.147 -		LLProcInfo::time_type user_cpu(29000), sys_cpu(57000);
   3.148  
   3.149  		LLDeadmanTimer::time_type now(LLDeadmanTimer::getNow());
   3.150  		F64 real_start(u64_time_to_float(now));
     4.1 --- a/indra/newview/llmeshrepository.cpp	Thu May 02 21:59:53 2013 +0000
     4.2 +++ b/indra/newview/llmeshrepository.cpp	Thu May 02 19:12:59 2013 -0400
     4.3 @@ -96,7 +96,7 @@
     4.4  U32 LLMeshRepository::sCacheBytesRead = 0;
     4.5  U32 LLMeshRepository::sCacheBytesWritten = 0;
     4.6  U32 LLMeshRepository::sPeakKbps = 0;
     4.7 -LLDeadmanTimer LLMeshRepository::sQuiescentTimer(15.0, true);
     4.8 +LLDeadmanTimer LLMeshRepository::sQuiescentTimer(15.0, true);	// true -> gather cpu metrics
     4.9  
    4.10  	
    4.11  const U32 MAX_TEXTURE_UPLOAD_RETRIES = 5;
    4.12 @@ -3769,9 +3769,9 @@
    4.13  void LLMeshRepository::metricsUpdate()
    4.14  {
    4.15  	F64 started, stopped;
    4.16 -	U64 total_count;
    4.17 -
    4.18 -	if (sQuiescentTimer.isExpired(0, started, stopped, total_count))
    4.19 +	U64 total_count(U64L(0)), user_cpu(U64L(0)), sys_cpu(U64L(0));
    4.20 +	
    4.21 +	if (sQuiescentTimer.isExpired(0, started, stopped, total_count, user_cpu, sys_cpu))
    4.22  	{
    4.23  		LLSD metrics;
    4.24  
    4.25 @@ -3781,6 +3781,8 @@
    4.26  		metrics["stop"] = stopped;
    4.27  		metrics["downloads"] = LLSD::Integer(total_count);
    4.28  		metrics["teleports"] = LLSD::Integer(metrics_teleport_start_count);
    4.29 +		metrics["user_cpu"] = double(user_cpu) / 1.0e6;
    4.30 +		metrics["sys_cpu"] = double(sys_cpu) / 1.0e6;
    4.31  		llinfos << "EventMarker " << metrics << llendl;
    4.32  	}
    4.33  }

mercurial