From 960139aa6f02f90c6102d3c5d5c38b5ebe689f9c Mon Sep 17 00:00:00 2001 From: Monty Brandenberg Date: Thu, 2 May 2013 19:12:59 -0400 Subject: 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 | 6 ++-- indra/llcommon/lldeadmantimer.h | 2 +- indra/llcommon/tests/lldeadmantimer_test.cpp | 47 +++++++++++----------------- 3 files changed, 23 insertions(+), 32 deletions(-) (limited to 'indra/llcommon') 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)); -- cgit v1.2.3