123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856 |
- /**
- * @file llfloaterstats.cpp
- * @brief Container for statistics view
- *
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2009, Linden Research, Inc.
- *
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
- *
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
- *
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- *
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
- #include "llviewerprecompiledheaders.h"
- #include "llfloaterstats.h"
- #include "llcontainerview.h"
- #include "llfloater.h"
- #include "llscrollcontainer.h"
- #include "llstatview.h"
- #include "lluictrlfactory.h"
- #include "llappviewer.h" // gFrameTimeSeconds
- #include "llpipeline.h"
- #include "llviewercontrol.h"
- #include "llviewerdisplay.h" // gLastFPSAverage
- #include "llviewerobjectlist.h"
- #include "llviewerstats.h"
- #include "llviewertexturelist.h"
- constexpr S32 LL_SCROLL_BORDER = 1;
- LLFloaterStats::LLFloaterStats(const LLSD& val)
- : LLFloater("stats"),
- mStatsContainer(NULL),
- mScrollContainer(NULL),
- mFPSStatBar(NULL),
- mLastFPSAverageCount(0),
- mStatBarMaxFPS(100.f),
- mStatBarLastMaxBW(0),
- mCurrentMaxFPS(0.f),
- mCurrentMaxBW(0.f),
- mLastStatRangeChange(0.f)
- {
- gPipeline.mNeedsDrawStats = true;
- LLUICtrlFactory::getInstance()->buildFloater(this,
- "floater_statistics.xml",
- NULL, false);
- LLRect stats_rect(0, getRect().getHeight() - LLFLOATER_HEADER_SIZE,
- getRect().getWidth() - LLFLOATER_CLOSE_BOX_SIZE, 0);
- mStatsContainer = new LLContainerView("statistics_view", stats_rect);
- mStatsContainer->showLabel(false);
- LLRect scroll_rect(LL_SCROLL_BORDER,
- getRect().getHeight() - LLFLOATER_HEADER_SIZE - LL_SCROLL_BORDER,
- getRect().getWidth() - LL_SCROLL_BORDER,
- LL_SCROLL_BORDER);
- mScrollContainer = new LLScrollableContainer("statistics_scroll",
- scroll_rect, mStatsContainer);
- mScrollContainer->setFollowsAll();
- mScrollContainer->setReserveScrollCorner(true);
- mStatsContainer->setScrollContainer(mScrollContainer);
- addChild(mScrollContainer);
- buildStats();
- }
- //virual
- LLFloaterStats::~LLFloaterStats()
- {
- if (!gSavedSettings.getBool("DebugShowRenderInfo"))
- {
- gPipeline.mNeedsDrawStats = false;
- }
- }
- void LLFloaterStats::setFPSStatBarRange(U32 average)
- {
- mStatBarMaxFPS = (F32)((average / 50U + 1U) * 50U);
- mFPSStatBar->mMaxBar = mStatBarMaxFPS;
- mFPSStatBar->mTickSpacing = mStatBarMaxFPS / 10.f;
- mFPSStatBar->mLabelSpacing = mStatBarMaxFPS / 5.f;
- mCurrentMaxFPS = 0.f;
- mLastStatRangeChange = gFrameTimeSeconds;
- }
- void LLFloaterStats::setBWStatBarRange(U32 max)
- {
- mStatBarLastMaxBW = llmin(((max / 1000U + 1U) * 1000U), 1000000U);
- mBWStatBar->mMaxBar = mStatBarLastMaxBW;
- mBWStatBar->mTickSpacing = mStatBarLastMaxBW / 10.f;
- mBWStatBar->mLabelSpacing = mStatBarLastMaxBW / 2.f;
- mCurrentMaxBW = 0.f;
- mLastStatRangeChange = gFrameTimeSeconds;
- }
- // NOTE: this cannot be implemented as a postBuild() (would cause a crash).
- void LLFloaterStats::buildStats()
- {
- LLRect rect;
- // Basic stats
- LLStatView* stat_viewp = new LLStatView("basic stat view", "Basic",
- "OpenDebugStatBasic", rect);
- addStatView(stat_viewp);
- mFPSStatBar = stat_viewp->addStat("FPS",
- &gViewerStats.mFPSStat,
- "DebugStatModeFPS", true, true);
- mFPSStatBar->setUnitLabel(" fps");
- mFPSStatBar->mMinBar = 0.f;
- mFPSStatBar->mPrecision = 1;
- setFPSStatBarRange(100);
- mLastStatRangeChange = 0.f;
- mBWStatBar = stat_viewp->addStat("Bandwidth",
- &gViewerStats.mKBitStat,
- "DebugStatModeBandwidth", true, false);
- mBWStatBar->setUnitLabel(" Kbps");
- mBWStatBar->mMinBar = 0.f;
- mBWStatBar->mMaxBar = 2048.f;
- mBWStatBar->mTickSpacing = 256.f;
- mBWStatBar->mLabelSpacing = 512.f;
- LLStatBar* stat_barp =
- stat_viewp->addStat("Packet loss",
- &gViewerStats.mPacketsLostPercentStat,
- "DebugStatModePacketLoss");
- stat_barp->setUnitLabel(" %");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 5.f;
- stat_barp->mTickSpacing = 1.f;
- stat_barp->mLabelSpacing = 1.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = true;
- stat_barp->mPrecision = 1;
- stat_barp = stat_viewp->addStat("Ping sim",
- &gViewerStats.mSimPingStat,
- "DebugStatMode");
- stat_barp->setUnitLabel(" ms");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 1000.f;
- stat_barp->mTickSpacing = 100.f;
- stat_barp->mLabelSpacing = 200.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- // Advanced stats
- stat_viewp = new LLStatView("advanced stat view", "Advanced",
- "OpenDebugStatAdvanced", rect);
- addStatView(stat_viewp);
- LLStatView* render_statviewp =
- stat_viewp->addStatView("render stat view", "Render",
- "OpenDebugStatRender", rect);
- stat_barp = render_statviewp->addStat("KTris drawn",
- &gPipeline.mTrianglesDrawnStat,
- "DebugStatModeKTrisDrawnFr");
- stat_barp->setUnitLabel("/fr");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 1000.f;
- stat_barp->mTickSpacing = 250.f;
- stat_barp->mLabelSpacing = 500.f;
- stat_barp->mPerSec = false;
- stat_barp = render_statviewp->addStat("KTris drawn",
- &gPipeline.mTrianglesDrawnStat,
- "DebugStatModeKTrisDrawnSec");
- stat_barp->setUnitLabel("/s");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 50000.f;
- stat_barp->mTickSpacing = 12500.f;
- stat_barp->mLabelSpacing = 25000.f;
- stat_barp = render_statviewp->addStat("Total objects",
- &gObjectList.mNumObjectsStat,
- "DebugStatModeTotalObjs");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 15000.f;
- stat_barp->mTickSpacing = 2500.f;
- stat_barp->mLabelSpacing = 5000.f;
- stat_barp->mPerSec = false;
- stat_barp = render_statviewp->addStat("New objects",
- &gObjectList.mNumNewObjectsStat,
- "DebugStatModeNewObjs");
- stat_barp->setLabel("New Objs");
- stat_barp->setUnitLabel("/s");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 1000.f;
- stat_barp->mTickSpacing = 100.f;
- stat_barp->mLabelSpacing = 500.f;
- // Texture statistics
- LLStatView* texture_statviewp =
- render_statviewp->addStatView("texture stat view", "Texture",
- "OpenDebugStatTexture", rect);
- stat_barp = texture_statviewp->addStat("Count",
- &gTextureList.sNumImagesStat,
- "DebugStatModeTextureCount");
- stat_barp->setUnitLabel("");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 8000.f;
- stat_barp->mTickSpacing = 2000.f;
- stat_barp->mLabelSpacing = 4000.f;
- stat_barp->mPerSec = false;
- stat_barp = texture_statviewp->addStat("Raw count",
- &gTextureList.sNumRawImagesStat,
- "DebugStatModeRawCount");
- stat_barp->setUnitLabel("");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 8000.f;
- stat_barp->mTickSpacing = 2000.f;
- stat_barp->mLabelSpacing = 4000.f;
- stat_barp->mPerSec = false;
- stat_barp = texture_statviewp->addStat("GL memory",
- &gTextureList.sGLTexMemStat,
- "DebugStatModeGLMem");
- stat_barp->setUnitLabel("");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 512.f;
- stat_barp->mTickSpacing = 128.f;
- stat_barp->mLabelSpacing = 256.f;
- stat_barp->mPrecision = 1;
- stat_barp->mPerSec = false;
- stat_barp = texture_statviewp->addStat("Bound memory",
- &gTextureList.sGLBoundMemStat,
- "DebugStatModeBoundMem");
- stat_barp->setUnitLabel("");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 512.f;
- stat_barp->mTickSpacing = 128.f;
- stat_barp->mLabelSpacing = 256.f;
- stat_barp->mPrecision = 1;
- stat_barp->mPerSec = false;
- // Network statistics
- LLStatView* net_statviewp = stat_viewp->addStatView("network stat view",
- "Network",
- "OpenDebugStatNet",
- rect);
- stat_barp = net_statviewp->addStat("Packets in",
- &gViewerStats.mPacketsInStat,
- "DebugStatModePacketsIn");
- stat_barp->setUnitLabel("/s");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 1000.f;
- stat_barp->mTickSpacing = 100.f;
- stat_barp->mLabelSpacing = 250.f;
- stat_barp = net_statviewp->addStat("Packets out",
- &gViewerStats.mPacketsOutStat,
- "DebugStatModePacketsOut");
- stat_barp->setUnitLabel("/s");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 100.f;
- stat_barp->mTickSpacing = 10.f;
- stat_barp->mLabelSpacing = 20.f;
- stat_barp = net_statviewp->addStat("Objects",
- &gViewerStats.mObjectKBitStat,
- "DebugStatModeObjects");
- stat_barp->setUnitLabel(" Kbps");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 100.f;
- stat_barp->mTickSpacing = 10.f;
- stat_barp->mLabelSpacing = 20.f;
- stat_barp = net_statviewp->addStat("Texture",
- &gViewerStats.mTextureKBitStat,
- "DebugStatModeTexture");
- stat_barp->setUnitLabel(" Kbps");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 100.f;
- stat_barp->mTickSpacing = 10.f;
- stat_barp->mLabelSpacing = 20.f;
- stat_barp = net_statviewp->addStat("Asset",
- &gViewerStats.mAssetKBitStat,
- "DebugStatModeAsset");
- stat_barp->setUnitLabel(" Kbps");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 100.f;
- stat_barp->mTickSpacing = 10.f;
- stat_barp->mLabelSpacing = 20.f;
- stat_barp = net_statviewp->addStat("Layers",
- &gViewerStats.mLayersKBitStat,
- "DebugStatModeLayers");
- stat_barp->setUnitLabel(" Kbps");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 100.f;
- stat_barp->mTickSpacing = 10.f;
- stat_barp->mLabelSpacing = 20.f;
- stat_barp = net_statviewp->addStat("Actual in",
- &gViewerStats.mActualInKBitStat,
- "DebugStatModeActualIn", true, false);
- stat_barp->setUnitLabel(" Kbps");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 2048.f;
- stat_barp->mTickSpacing = 128.f;
- stat_barp->mLabelSpacing = 256.f;
- stat_barp = net_statviewp->addStat("Actual out",
- &gViewerStats.mActualOutKBitStat,
- "DebugStatModeActualOut", true, false);
- stat_barp->setUnitLabel(" Kbps");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 512.f;
- stat_barp->mTickSpacing = 128.f;
- stat_barp->mLabelSpacing = 256.f;
- // Simulator stats
- LLStatView* sim_statviewp = new LLStatView("sim stat view", "Simulator",
- "OpenDebugStatSim", rect);
- addStatView(sim_statviewp);
- stat_barp = sim_statviewp->addStat("Time dilation",
- &gViewerStats.mSimTimeDilation,
- "DebugStatModeTimeDialation");
- stat_barp->mPrecision = 2;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 1.f;
- stat_barp->mTickSpacing = 0.25f;
- stat_barp->mLabelSpacing = 0.5f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_statviewp->addStat("Sim FPS",
- &gViewerStats.mSimFPS,
- "DebugStatModeSimFPS");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 60.f;
- stat_barp->mTickSpacing = 10.f;
- stat_barp->mLabelSpacing = 20.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_statviewp->addStat("Physics FPS",
- &gViewerStats.mSimPhysicsFPS,
- "DebugStatModePhysicsFPS");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 60.f;
- stat_barp->mTickSpacing = 10.0f;
- stat_barp->mLabelSpacing = 20.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- LLStatView* phys_details_viewp =
- sim_statviewp->addStatView("phys detail view", "Physics details",
- "OpenDebugStatPhysicsDetails", rect);
- stat_barp = phys_details_viewp->addStat("Pinned objects",
- &gViewerStats.mPhysicsPinnedTasks,
- "DebugStatModePinnedObjects");
- stat_barp->mPrecision = 0;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 500.f;
- stat_barp->mTickSpacing = 50.f;
- stat_barp->mLabelSpacing = 100.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = phys_details_viewp->addStat("Low LOD objects",
- &gViewerStats.mPhysicsLODTasks,
- "DebugStatModeLowLODObjects");
- stat_barp->mPrecision = 0;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 500.f;
- stat_barp->mTickSpacing = 50.f;
- stat_barp->mLabelSpacing = 100.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp =
- phys_details_viewp->addStat("Memory allocated",
- &gViewerStats.mPhysicsMemoryAllocated,
- "DebugStatModeMemoryAllocated");
- stat_barp->setUnitLabel(" MB");
- stat_barp->mPrecision = 0;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 1024.f;
- stat_barp->mTickSpacing = 128.f;
- stat_barp->mLabelSpacing = 256.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_statviewp->addStat("Agent updates/s",
- &gViewerStats.mSimAgentUPS,
- "DebugStatModeAgentUpdatesSec");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 60.f;
- stat_barp->mTickSpacing = 10.f;
- stat_barp->mLabelSpacing = 20.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_statviewp->addStat("Main agents",
- &gViewerStats.mSimMainAgents,
- "DebugStatModeMainAgents");
- stat_barp->mPrecision = 0;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 80.f;
- stat_barp->mTickSpacing = 10.f;
- stat_barp->mLabelSpacing = 40.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_statviewp->addStat("Child agents",
- &gViewerStats.mSimChildAgents,
- "DebugStatModeChildAgents");
- stat_barp->mPrecision = 0;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 40.f;
- stat_barp->mTickSpacing = 5.f;
- stat_barp->mLabelSpacing = 10.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_statviewp->addStat("Objects",
- &gViewerStats.mSimObjects,
- "DebugStatModeSimObjects");
- stat_barp->mPrecision = 0;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 30000.f;
- stat_barp->mTickSpacing = 5000.f;
- stat_barp->mLabelSpacing = 10000.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_statviewp->addStat("Active objects",
- &gViewerStats.mSimActiveObjects,
- "DebugStatModeSimActiveObjects");
- stat_barp->mPrecision = 0;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 2000.f;
- stat_barp->mTickSpacing = 250.f;
- stat_barp->mLabelSpacing = 500.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_statviewp->addStat("Active scripts",
- &gViewerStats.mSimActiveScripts,
- "DebugStatModeSimActiveScripts");
- stat_barp->mPrecision = 0;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 20000.f;
- stat_barp->mTickSpacing = 2500.f;
- stat_barp->mLabelSpacing = 5000.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_statviewp->addStat("Scripts run",
- &gViewerStats.mSimPctScriptsRun,
- "DebugStatModeSimPctScriptsRun");
- stat_barp->setUnitLabel(" %");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 100.f;
- stat_barp->mTickSpacing = 10.f;
- stat_barp->mLabelSpacing = 20.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = true;
- stat_barp->mPrecision = 1;
- stat_barp = sim_statviewp->addStat("Script events",
- &gViewerStats.mSimScriptEPS,
- "DebugStatModeSimScriptEvents");
- stat_barp->setUnitLabel(" e/s");
- stat_barp->mPrecision = 0;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 10000.f;
- stat_barp->mTickSpacing = 1000.f;
- stat_barp->mLabelSpacing = 2000.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- // Pathfinding stats in simulator stats
- LLStatView* path_finding_viewp =
- sim_statviewp->addStatView("pathfinding view", "Pathfinding",
- "OpenDebugStatSimPathFindingDetails", rect);
- stat_barp = path_finding_viewp->addStat("AI step time",
- &gViewerStats.mSimSimAIStepMsec,
- "DebugStatModeSimSimAIStepMsec");
- stat_barp->setUnitLabel(" ms");
- stat_barp->mPrecision = 3;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 45.f;
- stat_barp->mTickSpacing = 10.f;
- stat_barp->mLabelSpacing = 20.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp =
- path_finding_viewp->addStat("Skipped silhouette steps",
- &gViewerStats.mSimSimSkippedSilhouetteSteps,
- "DebugStatModeSimSimSkippedSilhouetteSteps");
- stat_barp->setUnitLabel("/s");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 45.f;
- stat_barp->mTickSpacing = 4.f;
- stat_barp->mLabelSpacing = 8.f;
- stat_barp =
- path_finding_viewp->addStat("Characters updated",
- &gViewerStats.mSimSimPctSteppedCharacters,
- "DebugStatModemSimSimPctSteppedCharacters");
- stat_barp->setUnitLabel(" %");
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 100.f;
- stat_barp->mTickSpacing = 10.f;
- stat_barp->mLabelSpacing = 20.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = true;
- stat_barp->mPrecision = 1;
- // Simulator stats (continued)
- stat_barp = sim_statviewp->addStat("Packets in",
- &gViewerStats.mSimInPPS,
- "DebugStatModeSimInPPS");
- stat_barp->setUnitLabel(" p/s");
- stat_barp->mPrecision = 0;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 20000.f;
- stat_barp->mTickSpacing = 2500.f;
- stat_barp->mLabelSpacing = 10000.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_statviewp->addStat("Packets out",
- &gViewerStats.mSimOutPPS,
- "DebugStatModeSimOutPPS");
- stat_barp->setUnitLabel(" p/s");
- stat_barp->mPrecision = 0;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 20000.f;
- stat_barp->mTickSpacing = 2500.f;
- stat_barp->mLabelSpacing = 10000.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_statviewp->addStat("Pending downloads",
- &gViewerStats.mSimPendingDownloads,
- "DebugStatModeSimPendingDownloads");
- stat_barp->mPrecision = 0;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 800.f;
- stat_barp->mTickSpacing = 100.f;
- stat_barp->mLabelSpacing = 200.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_statviewp->addStat("Pending uploads",
- &gViewerStats.mSimPendingUploads,
- "SimPendingUploads");
- stat_barp->mPrecision = 0;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 100.f;
- stat_barp->mTickSpacing = 25.f;
- stat_barp->mLabelSpacing = 50.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_statviewp->addStat("Total unacked bytes",
- &gViewerStats.mSimTotalUnackedBytes,
- "DebugStatModeSimTotalUnackedBytes");
- stat_barp->setUnitLabel(" Kb");
- stat_barp->mPrecision = 0;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 10000.f;
- stat_barp->mTickSpacing = 2500.f;
- stat_barp->mLabelSpacing = 5000.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- LLStatView* sim_time_viewp =
- sim_statviewp->addStatView("sim perf view", "Time (ms)",
- "OpenDebugStatSimTime", rect);
- stat_barp = sim_time_viewp->addStat("Total frame time",
- &gViewerStats.mSimFrameMsec,
- "DebugStatModeSimFrameMsec");
- stat_barp->setUnitLabel(" ms");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 50.f;
- stat_barp->mTickSpacing = 12.5f;
- stat_barp->mLabelSpacing = 25.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_time_viewp->addStat("Net time",
- &gViewerStats.mSimNetMsec,
- "DebugStatModeSimNetMsec");
- stat_barp->setUnitLabel(" ms");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 50.f;
- stat_barp->mTickSpacing = 12.5f;
- stat_barp->mLabelSpacing = 25.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_time_viewp->addStat("Physics time",
- &gViewerStats.mSimSimPhysicsMsec,
- "DebugStatModeSimSimPhysicsMsec");
- stat_barp->setUnitLabel(" ms");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 20.f;
- stat_barp->mTickSpacing = 5.f;
- stat_barp->mLabelSpacing = 10.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_time_viewp->addStat("Simulation time",
- &gViewerStats.mSimSimOtherMsec,
- "DebugStatModeSimSimOtherMsec");
- stat_barp->setUnitLabel(" ms");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 20.f;
- stat_barp->mTickSpacing = 5.f;
- stat_barp->mLabelSpacing = 10.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_time_viewp->addStat("Agent time",
- &gViewerStats.mSimAgentMsec,
- "DebugStatModeSimAgentMsec");
- stat_barp->setUnitLabel(" ms");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 20.f;
- stat_barp->mTickSpacing = 5.f;
- stat_barp->mLabelSpacing = 10.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_time_viewp->addStat("Images time",
- &gViewerStats.mSimImagesMsec,
- "DebugStatModeSimImagesMsec");
- stat_barp->setUnitLabel(" ms");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 20.f;
- stat_barp->mTickSpacing = 5.f;
- stat_barp->mLabelSpacing = 10.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_time_viewp->addStat("Script time",
- &gViewerStats.mSimScriptMsec,
- "DebugStatModeSimScriptMsec");
- stat_barp->setUnitLabel(" ms");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 40.f;
- stat_barp->mTickSpacing = 10.f;
- stat_barp->mLabelSpacing = 20.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = sim_time_viewp->addStat("Spare time",
- &gViewerStats.mSimSpareMsec,
- "DebugStatModeSimSpareMsec");
- stat_barp->setUnitLabel(" ms");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 20.f;
- stat_barp->mTickSpacing = 5.f;
- stat_barp->mLabelSpacing = 10.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- // 2nd level time blocks under 'Details' second
- LLStatView* detailed_time_viewp =
- sim_time_viewp->addStatView("sim perf view", "Time details (ms)",
- "OpenDebugStatSimTimeDetails", rect);
- {
- stat_barp =
- detailed_time_viewp->addStat("Physics step",
- &gViewerStats.mSimSimPhysicsStepMsec,
- "DebugStatModeSimSimPhysicsStepMsec");
- stat_barp->setUnitLabel(" ms");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 20.f;
- stat_barp->mTickSpacing = 5.f;
- stat_barp->mLabelSpacing = 10.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp =
- detailed_time_viewp->addStat("Update phys. shapes",
- &gViewerStats.mSimSimPhysicsShapeUpdateMsec,
- "DebugStatModeSimSimPhysicsShapeUpdateMsec");
- stat_barp->setUnitLabel(" ms");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 20.f;
- stat_barp->mTickSpacing = 5.f;
- stat_barp->mLabelSpacing = 10.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = detailed_time_viewp->addStat("Physics other",
- &gViewerStats.mSimSimPhysicsOtherMsec,
- "DebugStatModeSimSimPhysicsOtherMsec");
- stat_barp->setUnitLabel(" ms");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 20.f;
- stat_barp->mTickSpacing = 5.f;
- stat_barp->mLabelSpacing = 10.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = detailed_time_viewp->addStat("Sleep time",
- &gViewerStats.mSimSleepMsec,
- "DebugStatModeSimSleepMsec");
- stat_barp->setUnitLabel(" ms");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 20.f;
- stat_barp->mTickSpacing = 5.f;
- stat_barp->mLabelSpacing = 10.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- stat_barp = detailed_time_viewp->addStat("Pump IO",
- &gViewerStats.mSimPumpIOMsec,
- "DebugStatModeSimPumpIOMsec");
- stat_barp->setUnitLabel(" ms");
- stat_barp->mPrecision = 1;
- stat_barp->mMinBar = 0.f;
- stat_barp->mMaxBar = 20.f;
- stat_barp->mTickSpacing = 5.f;
- stat_barp->mLabelSpacing = 10.f;
- stat_barp->mPerSec = false;
- stat_barp->mDisplayMean = false;
- }
- LLRect r = getRect();
- // Reshape based on the parameters we set.
- reshape(r.getWidth(), r.getHeight());
- }
- //virtual
- void LLFloaterStats::reshape(S32 width, S32 height, bool called_from_parent)
- {
- if (mStatsContainer)
- {
- LLRect rect = mStatsContainer->getRect();
- mStatsContainer->reshape(rect.getWidth() - 2, rect.getHeight());
- }
- LLFloater::reshape(width, height, called_from_parent);
- }
- void LLFloaterStats::addStatView(LLStatView* stat)
- {
- mStatsContainer->addChildAtEnd(stat);
- }
- //virtual
- void LLFloaterStats::onOpen()
- {
- LLFloater::onOpen();
- gSavedSettings.setBool("ShowDebugStats", true);
- reshape(getRect().getWidth(), getRect().getHeight());
- }
- //virtual
- void LLFloaterStats::onClose(bool app_quitting)
- {
- setVisible(false);
- if (!app_quitting)
- {
- gSavedSettings.setBool("ShowDebugStats", false);
- }
- }
- //virtual
- void LLFloaterStats::draw()
- {
- F32 fps = gViewerStats.mFPSStat.getCurrentPerSec();
- if (fps > mCurrentMaxFPS)
- {
- mCurrentMaxFPS = fps;
- }
- F32 bw = gViewerStats.mKBitStat.getMeanPerSec() * 1.5f;
- if (bw > mCurrentMaxBW)
- {
- mCurrentMaxBW = bw;
- mLastStatRangeChange = 0.f; // Change immediately
- }
- if (gFrameTimeSeconds - mLastStatRangeChange > 2.f)
- {
- if (gLastFPSAverage && gLastFPSAverage != mLastFPSAverageCount)
- {
- mLastFPSAverageCount = gLastFPSAverage;
- setFPSStatBarRange(mLastFPSAverageCount);
- }
- if (mCurrentMaxFPS > mStatBarMaxFPS && mCurrentMaxFPS > 50.f)
- {
- setFPSStatBarRange((U32)mCurrentMaxFPS - 49);
- }
- if (mCurrentMaxBW > mStatBarLastMaxBW)
- {
- setBWStatBarRange(mCurrentMaxBW);
- }
- }
- LLFloater::draw();
- }
|