From e91a192301db37f99a4f5a817f3b4c47b448417a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 26 Jan 2016 11:11:52 -0500 Subject: SL-315 WIP - added callstack info to joint debugging. Made joint debugging run-time configurable via debug setting DebugAvatarJoints --- indra/llcharacter/lljoint.cpp | 27 ++++++++++++++++++++++++++- indra/llcharacter/lljoint.h | 4 ++++ indra/llcommon/StackWalker.cpp | 2 +- indra/llcommon/StackWalker.h | 2 +- indra/llcommon/llcallstack.cpp | 15 +++++++++------ indra/llcommon/llcallstack.h | 3 ++- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llviewercontrol.cpp | 8 ++++++++ indra/newview/llvoavatar.cpp | 3 +++ indra/newview/llvoavatarself.cpp | 3 --- 10 files changed, 65 insertions(+), 13 deletions(-) diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index 8fcab454dc..a314692edc 100755 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -32,6 +32,8 @@ #include "lljoint.h" #include "llmath.h" +#include "llcallstack.h" +#include S32 LLJoint::sNumUpdates = 0; S32 LLJoint::sNumTouches = 0; @@ -313,7 +315,11 @@ const LLVector3& LLJoint::getPosition() bool do_debug_joint(const std::string& name) { - return false; + if (std::find(LLJoint::s_debugJointNames.begin(), LLJoint::s_debugJointNames.end(),name) != LLJoint::s_debugJointNames.end()) + { + return true; + } + return false; } //-------------------------------------------------------------------- @@ -325,7 +331,9 @@ void LLJoint::setPosition( const LLVector3& pos ) { if (do_debug_joint(getName())) { + LLCallStack cs; LL_DEBUGS("Avatar") << " joint " << getName() << " set pos " << pos << LL_ENDL; + LL_DEBUGS("Avatar") << "STACK:\n" << "====================\n" << cs << "====================" << LL_ENDL; } } mXform.setPosition(pos); @@ -427,6 +435,23 @@ void LLJoint::updatePos(const std::string& av_info) setPosition(pos); } +// init static +LLJoint::debug_joint_name_t LLJoint::s_debugJointNames = debug_joint_name_t(); + +//-------------------------------------------------------------------- +// setDebugJointNames +//-------------------------------------------------------------------- +void LLJoint::setDebugJointNames(const debug_joint_name_t& names) +{ + s_debugJointNames = names; +} +void LLJoint::setDebugJointNames(const std::string& names_string) +{ + debug_joint_name_t names; + boost::split(names, names_string, boost::is_any_of(" :,")); + setDebugJointNames(names); +} + //-------------------------------------------------------------------- // getWorldPosition() //-------------------------------------------------------------------- diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index 424f172318..ab21f73122 100755 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -130,6 +130,10 @@ public: // debug statics static S32 sNumTouches; static S32 sNumUpdates; + typedef std::set debug_joint_name_t; + static debug_joint_name_t s_debugJointNames; + static void setDebugJointNames(const debug_joint_name_t& names); + static void setDebugJointNames(const std::string& names_string); LLPosOverrideMap m_attachmentOverrides; LLVector3 m_posBeforeOverrides; diff --git a/indra/llcommon/StackWalker.cpp b/indra/llcommon/StackWalker.cpp index da52386a22..768595f5de 100644 --- a/indra/llcommon/StackWalker.cpp +++ b/indra/llcommon/StackWalker.cpp @@ -4,7 +4,7 @@ * http://stackwalker.codeplex.com/ * * - * $LicenseInfo:firstyear=2016&license=viewerlgpl$ + * $LicenseInfo:firstyear=2016&license=bsd$ * * History: * 2005-07-27 v1 - First public release on http://www.codeproject.com/ diff --git a/indra/llcommon/StackWalker.h b/indra/llcommon/StackWalker.h index f4ef8d557f..b29cdbfc81 100644 --- a/indra/llcommon/StackWalker.h +++ b/indra/llcommon/StackWalker.h @@ -4,7 +4,7 @@ * * * - * $LicenseInfo:firstyear=2016&license=viewerlgpl$ + * $LicenseInfo:firstyear=2016&license=bsd$ * * LICENSE (http://www.opensource.org/licenses/bsd-license.php) * diff --git a/indra/llcommon/llcallstack.cpp b/indra/llcommon/llcallstack.cpp index 87eb37de16..02cf4d0173 100644 --- a/indra/llcommon/llcallstack.cpp +++ b/indra/llcommon/llcallstack.cpp @@ -39,12 +39,14 @@ public: ~LLCallStackImpl() { } - void getStack(std::vector& stack) + void getStack(std::vector& stack, S32 skip_count=0) { m_stack.clear(); ShowCallstack(); - // Skip the first 2 lines because they're just bookkeeping for LLCallStack. - for (S32 i=3; i& stack) + void getStack(std::vector& stack, S32 skip_count=0) { stack.clear(); } @@ -72,14 +74,15 @@ public: LLCallStackImpl *LLCallStack::s_impl = NULL; -LLCallStack::LLCallStack() +LLCallStack::LLCallStack(S32 skip_count): + m_skipCount(skip_count) { if (!s_impl) { s_impl = new LLCallStackImpl; } LLTimer t; - s_impl->getStack(m_strings); + s_impl->getStack(m_strings, m_skipCount); } std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack) diff --git a/indra/llcommon/llcallstack.h b/indra/llcommon/llcallstack.h index 6059d4f2c5..598db3d404 100644 --- a/indra/llcommon/llcallstack.h +++ b/indra/llcommon/llcallstack.h @@ -29,10 +29,11 @@ class LLCallStackImpl; class LLCallStack { public: - LLCallStack(); + LLCallStack(S32 skip_count=0); std::vector m_strings; private: static LLCallStackImpl *s_impl; + S32 m_skipCount; }; LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 32707e7653..e1f2ecff0c 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2182,6 +2182,17 @@ String Value + + DebugAvatarJoints + + Comment + List of joints to emit additional debugging info about. + Persist + 1 + Type + String + Value + DebugAvatarRezTime diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 612fd9a326..3532a872c9 100755 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -120,6 +120,13 @@ static bool handleTerrainDetailChanged(const LLSD& newvalue) } +static bool handleDebugAvatarJointsChanged(const LLSD& newvalue) +{ + std::string new_string = newvalue.asString(); + LLJoint::setDebugJointNames(new_string); + return true; +} + static bool handleDeferredDebugSettingChanged(const LLSD& newvalue) { LLNotificationsUtil::add("ChangeDeferredDebugSetting"); @@ -769,6 +776,7 @@ void settings_setup_listeners() gSavedSettings.getControl("SpellCheckDictionary")->getSignal()->connect(boost::bind(&handleSpellCheckChanged)); gSavedSettings.getControl("LoginLocation")->getSignal()->connect(boost::bind(&handleLoginLocationChanged)); gSavedSettings.getControl("IncludeEnhancedSkeleton")->getCommitSignal()->connect(boost::bind(&handleDeferredDebugSettingChanged, _2)); + gSavedSettings.getControl("DebugAvatarJoints")->getCommitSignal()->connect(boost::bind(&handleDebugAvatarJointsChanged, _2)); } #if TEST_CACHED_CONTROL diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index efc07fffe5..ffe51ee0ae 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1084,6 +1084,9 @@ void LLVOAvatar::initClass() gAnimLibrary.animStateSetString(ANIM_AGENT_PELVIS_FIX,"pelvis_fix"); gAnimLibrary.animStateSetString(ANIM_AGENT_TARGET,"target"); gAnimLibrary.animStateSetString(ANIM_AGENT_WALK_ADJUST,"walk_adjust"); + + // Where should this be set initially? + LLJoint::setDebugJointNames(gSavedSettings.getString("DebugAvatarJoints")); } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 0648ee6732..aadcce95b9 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -207,9 +207,6 @@ bool update_avatar_rez_metrics() gAgentAvatarp->updateAvatarRezMetrics(false); - LLCallStack cs; - LL_INFOS() << "CallStack:\n" << cs << LL_ENDL; - return false; } -- cgit v1.2.3