diff options
author | Monty Brandenberg <monty@lindenlab.com> | 2013-05-02 19:12:59 -0400 |
---|---|---|
committer | Monty Brandenberg <monty@lindenlab.com> | 2013-05-02 19:12:59 -0400 |
commit | 960139aa6f02f90c6102d3c5d5c38b5ebe689f9c (patch) | |
tree | 013c7b51afe4b765723fbf5ebf41fb6640d3d09a | |
parent | 11cca95187f01f594172ca950315dcd8d99dc2c3 (diff) |
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.
-rw-r--r-- | indra/llcommon/lldeadmantimer.cpp | 6 | ||||
-rw-r--r-- | indra/llcommon/lldeadmantimer.h | 2 | ||||
-rw-r--r-- | indra/llcommon/tests/lldeadmantimer_test.cpp | 47 | ||||
-rwxr-xr-x | indra/newview/llmeshrepository.cpp | 10 |
4 files changed, 29 insertions, 36 deletions
diff --git a/indra/llcommon/lldeadmantimer.cpp b/indra/llcommon/lldeadmantimer.cpp index 2ba757d2af..7d9097e344 100644 --- a/indra/llcommon/lldeadmantimer.cpp +++ b/indra/llcommon/lldeadmantimer.cpp @@ -110,13 +110,13 @@ void LLDeadmanTimer::stop(time_type now) bool LLDeadmanTimer::isExpired(time_type now, F64 & started, F64 & stopped, U64 & count, - LLProcInfo::time_type & user_cpu, LLProcInfo::time_type & sys_cpu) + U64 & user_cpu, U64 & sys_cpu) { const bool status(isExpired(now, started, stopped, count)); if (status) { - user_cpu = mUEndCPU - mUStartCPU; - sys_cpu = mSEndCPU - mSStartCPU; + user_cpu = U64(mUEndCPU - mUStartCPU); + sys_cpu = U64(mSEndCPU - mSStartCPU); } return status; } diff --git a/indra/llcommon/lldeadmantimer.h b/indra/llcommon/lldeadmantimer.h index a6022852b9..0dde16b717 100644 --- a/indra/llcommon/lldeadmantimer.h +++ b/indra/llcommon/lldeadmantimer.h @@ -190,7 +190,7 @@ public: /// left unchanged. /// bool isExpired(time_type now, F64 & started, F64 & stopped, U64 & count, - LLProcInfo::time_type & user_cpu, LLProcInfo::time_type & sys_cpu); + U64 & user_cpu, U64 & sys_cpu); /// Identical to the six-arugment form except is does without the /// CPU time return if the caller isn't interested in it. diff --git a/indra/llcommon/tests/lldeadmantimer_test.cpp b/indra/llcommon/tests/lldeadmantimer_test.cpp index a4ec76a016..7fd2dde6e0 100644 --- a/indra/llcommon/tests/lldeadmantimer_test.cpp +++ b/indra/llcommon/tests/lldeadmantimer_test.cpp @@ -81,16 +81,15 @@ void deadmantimer_object_t::test<1>() { // With cpu metrics F64 started(42.0), stopped(97.0); - U64 count(U64L(8)); - LLProcInfo::time_type user_cpu(29000), sys_cpu(57000); + U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000); LLDeadmanTimer timer(10.0, true); ensure_equals("WCM isExpired() returns false after ctor()", timer.isExpired(0, started, stopped, count, user_cpu, sys_cpu), false); ensure_approximately_equals("WCM t1 - isExpired() does not modify started", started, F64(42.0), 2); ensure_approximately_equals("WCM t1 - isExpired() does not modify stopped", stopped, F64(97.0), 2); ensure_equals("WCM t1 - isExpired() does not modify count", count, U64L(8)); - ensure_equals("WCM t1 - isExpired() does not modify user_cpu", user_cpu, LLProcInfo::time_type(29000)); - ensure_equals("WCM t1 - isExpired() does not modify sys_cpu", sys_cpu, LLProcInfo::time_type(57000)); + ensure_equals("WCM t1 - isExpired() does not modify user_cpu", user_cpu, U64L(29000)); + ensure_equals("WCM t1 - isExpired() does not modify sys_cpu", sys_cpu, U64L(57000)); } } @@ -112,8 +111,7 @@ void deadmantimer_object_t::test<2>() { // With cpu metrics F64 started(42.0), stopped(97.0); - U64 count(U64L(8)); - LLProcInfo::time_type user_cpu(29000), sys_cpu(57000); + U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000); LLDeadmanTimer timer(0.0, true); // Zero is pre-expired ensure_equals("WCM isExpired() still returns false with 0.0 time ctor()", @@ -141,8 +139,7 @@ void deadmantimer_object_t::test<3>() { // With cpu metrics F64 started(42.0), stopped(97.0); - U64 count(U64L(8)); - LLProcInfo::time_type user_cpu(29000), sys_cpu(57000); + U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000); LLDeadmanTimer timer(0.0, true); timer.start(0); @@ -172,8 +169,7 @@ void deadmantimer_object_t::test<4>() { // With cpu metrics F64 started(42.0), stopped(97.0); - U64 count(U64L(8)); - LLProcInfo::time_type user_cpu(29000), sys_cpu(57000); + U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000); LLDeadmanTimer timer(0.0, true); timer.start(0); @@ -205,8 +201,7 @@ void deadmantimer_object_t::test<5>() { // With cpu metrics F64 started(42.0), stopped(97.0); - U64 count(U64L(8)); - LLProcInfo::time_type user_cpu(29000), sys_cpu(57000); + U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000); LLDeadmanTimer timer(10.0, true); timer.start(0); @@ -215,8 +210,8 @@ void deadmantimer_object_t::test<5>() ensure_approximately_equals("WCM t5 - isExpired() does not modify started", started, F64(42.0), 2); ensure_approximately_equals("WCM t5 - isExpired() does not modify stopped", stopped, F64(97.0), 2); ensure_equals("WCM t5 - isExpired() does not modify count", count, U64L(8)); - ensure_equals("WCM t5 - isExpired() does not modify user_cpu", user_cpu, LLProcInfo::time_type(29000)); - ensure_equals("WCM t5 - isExpired() does not modify sys_cpu", sys_cpu, LLProcInfo::time_type(57000)); + ensure_equals("WCM t5 - isExpired() does not modify user_cpu", user_cpu, U64L(29000)); + ensure_equals("WCM t5 - isExpired() does not modify sys_cpu", sys_cpu, U64L(57000)); } } @@ -247,8 +242,7 @@ void deadmantimer_object_t::test<6>() { // With cpu metrics F64 started(42.0), stopped(97.0); - U64 count(U64L(8)); - LLProcInfo::time_type user_cpu(29000), sys_cpu(57000); + U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000); LLDeadmanTimer timer(10.0, true); // Would like to do subtraction on current time but can't because @@ -263,8 +257,8 @@ void deadmantimer_object_t::test<6>() ensure_approximately_equals("WCM t6 - isExpired() does not modify started", started, F64(42.0), 2); ensure_approximately_equals("WCM t6 - isExpired() does not modify stopped", stopped, F64(97.0), 2); ensure_equals("t6 - isExpired() does not modify count", count, U64L(8)); - ensure_equals("WCM t6 - isExpired() does not modify user_cpu", user_cpu, LLProcInfo::time_type(29000)); - ensure_equals("WCM t6 - isExpired() does not modify sys_cpu", sys_cpu, LLProcInfo::time_type(57000)); + ensure_equals("WCM t6 - isExpired() does not modify user_cpu", user_cpu, U64L(29000)); + ensure_equals("WCM t6 - isExpired() does not modify sys_cpu", sys_cpu, U64L(57000)); } } @@ -293,9 +287,8 @@ void deadmantimer_object_t::test<7>() { // With cpu metrics F64 started(42.0), stopped(97.0); - U64 count(U64L(8)); + U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000); LLDeadmanTimer timer(10.0, true); - LLProcInfo::time_type user_cpu(29000), sys_cpu(57000); // Would like to do subtraction on current time but can't because // the implementation on Windows is zero-based. We wrap around @@ -343,9 +336,8 @@ void deadmantimer_object_t::test<8>() { // With cpu metrics F64 started(42.0), stopped(97.0); - U64 count(U64L(8)); + U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000); LLDeadmanTimer timer(10.0, true); - LLProcInfo::time_type user_cpu(29000), sys_cpu(57000); // Would like to do subtraction on current time but can't because // the implementation on Windows is zero-based. We wrap around @@ -367,8 +359,8 @@ void deadmantimer_object_t::test<8>() ensure_approximately_equals("WCM t8 - 2nd isExpired() does not modify started", started, F64(42.0), 2); ensure_approximately_equals("WCM t8 - 2nd isExpired() does not modify stopped", stopped, F64(97.0), 2); ensure_equals("WCM t8 - 2nd isExpired() does not modify count", count, U64L(8)); - ensure_equals("WCM t8 - 2nd isExpired() does not modify user_cpu", user_cpu, LLProcInfo::time_type(29000)); - ensure_equals("WCM t8 - 2nd isExpired() does not modify sys_cpu", sys_cpu, LLProcInfo::time_type(57000)); + ensure_equals("WCM t8 - 2nd isExpired() does not modify user_cpu", user_cpu, U64L(29000)); + ensure_equals("WCM t8 - 2nd isExpired() does not modify sys_cpu", sys_cpu, U64L(57000)); } } @@ -423,9 +415,8 @@ void deadmantimer_object_t::test<9>() { // With cpu metrics F64 started(42.0), stopped(97.0); - U64 count(U64L(8)); + U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000); LLDeadmanTimer timer(5.0, true); - LLProcInfo::time_type user_cpu(29000), sys_cpu(57000); LLDeadmanTimer::time_type now(LLDeadmanTimer::getNow()); F64 real_start(u64_time_to_float(now)); @@ -553,9 +544,9 @@ void deadmantimer_object_t::test<10>() { // With cpu metrics F64 started(42.0), stopped(97.0); - U64 count(U64L(8)); + U64 count(U64L(8)), user_cpu(29000), sys_cpu(57000); + LLDeadmanTimer timer(5.0, true); - LLProcInfo::time_type user_cpu(29000), sys_cpu(57000); LLDeadmanTimer::time_type now(LLDeadmanTimer::getNow()); F64 real_start(u64_time_to_float(now)); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 2a863a3103..4d3937ded1 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -96,7 +96,7 @@ U32 LLMeshRepository::sLODPending = 0; U32 LLMeshRepository::sCacheBytesRead = 0; U32 LLMeshRepository::sCacheBytesWritten = 0; U32 LLMeshRepository::sPeakKbps = 0; -LLDeadmanTimer LLMeshRepository::sQuiescentTimer(15.0, true); +LLDeadmanTimer LLMeshRepository::sQuiescentTimer(15.0, true); // true -> gather cpu metrics const U32 MAX_TEXTURE_UPLOAD_RETRIES = 5; @@ -3769,9 +3769,9 @@ void LLMeshRepository::metricsProgress(unsigned int this_count) void LLMeshRepository::metricsUpdate() { F64 started, stopped; - U64 total_count; - - if (sQuiescentTimer.isExpired(0, started, stopped, total_count)) + U64 total_count(U64L(0)), user_cpu(U64L(0)), sys_cpu(U64L(0)); + + if (sQuiescentTimer.isExpired(0, started, stopped, total_count, user_cpu, sys_cpu)) { LLSD metrics; @@ -3781,6 +3781,8 @@ void LLMeshRepository::metricsUpdate() metrics["stop"] = stopped; metrics["downloads"] = LLSD::Integer(total_count); metrics["teleports"] = LLSD::Integer(metrics_teleport_start_count); + metrics["user_cpu"] = double(user_cpu) / 1.0e6; + metrics["sys_cpu"] = double(sys_cpu) / 1.0e6; llinfos << "EventMarker " << metrics << llendl; } } |