From 4d39323a382c6f8e7770f87cfb728e19195618a2 Mon Sep 17 00:00:00 2001 From: Rye Date: Sun, 2 Nov 2025 13:19:38 -0500 Subject: [PATCH] Remove remaining LLTrace BlockTimerStat usage and replace with Tracy. Clean up all remaining parts of LLTrace BlockTimer Signed-off-by: Rye --- indra/cmake/Linking.cmake | 1 - indra/cmake/Tracy.cmake | 7 +- .../llimage_libtest/llimage_libtest.cpp | 105 -- indra/llappearance/llavatarappearance.cpp | 2 +- indra/llappearance/llavatarjointmesh.cpp | 1 - indra/llappearance/llpolymesh.cpp | 1 - indra/llappearance/llpolymorph.cpp | 1 - .../llappearance/llpolyskeletaldistortion.cpp | 1 - indra/llappearance/lltexlayer.cpp | 1 - indra/llappearance/lltexlayerparams.cpp | 1 - .../llappappearanceutility.cpp | 159 -- .../llappappearanceutility.h | 3 - .../llappearanceutility/llbakingtexlayer.cpp | 6 +- indra/llappearanceutility/llbakingtexture.cpp | 6 - indra/llappearanceutility/llbakingtexture.h | 1 - .../llappearanceutility/llprocesstexture.cpp | 3 +- indra/llcharacter/llcharacter.cpp | 1 - indra/llcharacter/llmotioncontroller.cpp | 1 - indra/llcommon/CMakeLists.txt | 6 - indra/llcommon/llcommon.cpp | 2 +- indra/llcommon/lldate.cpp | 1 - indra/llcommon/llfasttimer.cpp | 420 +---- indra/llcommon/llfasttimer.h | 183 +- indra/llcommon/llfixedbuffer.h | 2 +- indra/llcommon/llmetricperformancetester.cpp | 333 ---- indra/llcommon/llmetricperformancetester.h | 215 --- indra/llcommon/llprofiler.h | 90 +- indra/llcommon/llprofilercategories.h | 8 + indra/llcommon/llsdparam.h | 1 - indra/llcommon/llstreamqueue.cpp | 24 - indra/llcommon/llstreamqueue.h | 240 --- indra/llcommon/llstring.cpp | 1 - indra/llcommon/llsys.cpp | 1 - indra/llcommon/lltimer.cpp | 1 + indra/llcommon/lltrace.cpp | 33 - indra/llcommon/lltrace.h | 109 -- indra/llcommon/lltraceaccumulators.cpp | 20 +- indra/llcommon/lltraceaccumulators.h | 74 - indra/llcommon/lltracerecording.cpp | 62 - indra/llcommon/lltracerecording.h | 10 - indra/llcommon/lltracethreadrecorder.cpp | 59 +- indra/llcommon/lltracethreadrecorder.h | 9 +- indra/llcommon/tests/llstreamqueue_test.cpp | 194 -- indra/llcommon/timer.h | 26 - indra/llfilesystem/llfilesystem.cpp | 3 - indra/llimage/llimagej2c.cpp | 175 -- indra/llimage/llimagej2c.h | 43 - indra/llinventory/llinventory.cpp | 1 - indra/llinventory/llsettingsdaycycle.cpp | 2 - indra/llinventory/llsettingssky.cpp | 2 - indra/llinventory/llsettingswater.cpp | 2 - indra/llmessage/lliohttpserver.cpp | 1 - indra/llmessage/lliosocket.cpp | 1 - indra/llmessage/llioutil.cpp | 1 - indra/llmessage/llpumpio.cpp | 1 - indra/llmessage/lltemplatemessagereader.cpp | 5 +- indra/llmessage/message.cpp | 1 - indra/llrender/llatmosphere.cpp | 1 - indra/llrender/llfontgl.cpp | 1 - indra/llrender/llimagegl.cpp | 1 - indra/llrender/llrender.cpp | 1 - indra/llrender/llrender2dutils.cpp | 1 - indra/llrender/lltexture.cpp | 1 - indra/llrender/lltexture.h | 3 - indra/llrender/llvertexbuffer.cpp | 1 - indra/llui/llfolderview.cpp | 4 +- indra/llui/llfolderviewitem.cpp | 8 +- indra/llui/llkeywords.cpp | 4 +- indra/llui/llpanel.cpp | 17 +- indra/llui/lluictrlfactory.h | 1 - indra/llui/lluistring.cpp | 10 +- indra/llui/llxuiparser.cpp | 6 +- indra/llwindow/llwindowwin32.cpp | 14 - indra/newview/CMakeLists.txt | 2 - indra/newview/llagentcamera.cpp | 4 +- indra/newview/llappviewer.cpp | 149 +- indra/newview/llappviewer.h | 5 - indra/newview/llchathistory.cpp | 4 +- indra/newview/lldebugview.cpp | 4 - indra/newview/lldebugview.h | 2 - .../lldonotdisturbnotificationstorage.cpp | 4 +- indra/newview/lldrawpool.cpp | 1 - indra/newview/lldrawpoolalpha.cpp | 1 - indra/newview/lldrawpoolavatar.cpp | 4 +- indra/newview/lldrawpoolbump.cpp | 12 +- indra/newview/lldrawpoolsimple.cpp | 17 +- indra/newview/lldrawpoolterrain.cpp | 16 +- indra/newview/lldrawpooltree.cpp | 4 +- indra/newview/lldrawpoolwater.cpp | 2 +- indra/newview/lldrawpoolwaterexclusion.cpp | 2 +- indra/newview/lldrawpoolwlsky.cpp | 2 +- indra/newview/lldynamictexture.cpp | 1 + indra/newview/llenvironment.cpp | 6 +- indra/newview/llfasttimerview.cpp | 1665 ----------------- indra/newview/llfasttimerview.h | 151 -- indra/newview/llfilteredwearablelist.cpp | 4 +- indra/newview/llfloaterimsessiontab.cpp | 3 +- indra/newview/llfloaterlagmeter.cpp | 4 +- indra/newview/llfolderviewmodelinventory.cpp | 4 +- indra/newview/llgltfmateriallist.cpp | 2 +- indra/newview/llheroprobemanager.cpp | 2 +- indra/newview/llhudmanager.cpp | 4 +- indra/newview/llhudobject.cpp | 4 +- .../llinventorymodelbackgroundfetch.cpp | 6 +- indra/newview/llmeshrepository.cpp | 13 +- indra/newview/llparticipantlist.cpp | 2 - indra/newview/llperfstats.cpp | 2 +- indra/newview/llperfstats.h | 4 +- .../llpersistentnotificationstorage.cpp | 2 +- indra/newview/llreflectionmapmanager.cpp | 2 +- indra/newview/llsceneview.cpp | 5 - indra/newview/llsettingsvo.cpp | 2 - indra/newview/llstartup.cpp | 11 +- indra/newview/lltexturefetch.cpp | 58 - indra/newview/lltexturefetch.h | 25 - indra/newview/llviewerdisplay.cpp | 38 +- indra/newview/llviewerfloaterreg.cpp | 3 - indra/newview/llviewerjointmesh.cpp | 1 - indra/newview/llviewermedia.cpp | 34 +- indra/newview/llviewermenu.cpp | 14 - indra/newview/llviewerobject.cpp | 1 - indra/newview/llviewerobjectlist.cpp | 5 +- indra/newview/llviewerpartsim.cpp | 5 +- indra/newview/llviewerprecompiledheaders.h | 1 - indra/newview/llviewerregion.cpp | 7 +- indra/newview/llviewerstats.cpp | 6 - indra/newview/llviewerstats.h | 15 +- indra/newview/llviewertexture.cpp | 434 ----- indra/newview/llviewertexture.h | 102 - indra/newview/llviewerwindow.cpp | 19 +- indra/newview/llvograss.cpp | 4 +- indra/newview/llvoicevivox.cpp | 4 +- indra/newview/llvoicewebrtc.cpp | 4 +- indra/newview/llvopartgroup.cpp | 1 - indra/newview/llvosky.cpp | 3 - indra/newview/llvovolume.cpp | 10 - indra/newview/pipeline.cpp | 84 +- indra/newview/pipeline.h | 25 - .../default/xui/de/floater_fast_timers.xml | 21 - .../default/xui/en/floater_fast_timers.xml | 109 -- .../skins/default/xui/en/floater_stats.xml | 48 - .../skins/default/xui/en/menu_viewer.xml | 18 - .../default/xui/es/floater_fast_timers.xml | 21 - .../default/xui/fr/floater_fast_timers.xml | 21 - .../default/xui/it/floater_fast_timers.xml | 21 - .../default/xui/ja/floater_fast_timers.xml | 21 - .../default/xui/pl/floater_fast_timers.xml | 19 - .../default/xui/pt/floater_fast_timers.xml | 21 - .../default/xui/ru/floater_fast_timers.xml | 21 - .../default/xui/tr/floater_fast_timers.xml | 21 - .../default/xui/zh/floater_fast_timers.xml | 21 - scripts/metrics/slp_conv.py | 73 - 152 files changed, 223 insertions(+), 6007 deletions(-) delete mode 100644 indra/llcommon/llmetricperformancetester.cpp delete mode 100644 indra/llcommon/llmetricperformancetester.h delete mode 100644 indra/llcommon/llstreamqueue.cpp delete mode 100644 indra/llcommon/llstreamqueue.h delete mode 100644 indra/llcommon/tests/llstreamqueue_test.cpp delete mode 100644 indra/llcommon/timer.h delete mode 100644 indra/newview/llfasttimerview.cpp delete mode 100644 indra/newview/llfasttimerview.h delete mode 100644 indra/newview/skins/default/xui/de/floater_fast_timers.xml delete mode 100644 indra/newview/skins/default/xui/en/floater_fast_timers.xml delete mode 100644 indra/newview/skins/default/xui/es/floater_fast_timers.xml delete mode 100644 indra/newview/skins/default/xui/fr/floater_fast_timers.xml delete mode 100644 indra/newview/skins/default/xui/it/floater_fast_timers.xml delete mode 100644 indra/newview/skins/default/xui/ja/floater_fast_timers.xml delete mode 100644 indra/newview/skins/default/xui/pl/floater_fast_timers.xml delete mode 100644 indra/newview/skins/default/xui/pt/floater_fast_timers.xml delete mode 100644 indra/newview/skins/default/xui/ru/floater_fast_timers.xml delete mode 100644 indra/newview/skins/default/xui/tr/floater_fast_timers.xml delete mode 100644 indra/newview/skins/default/xui/zh/floater_fast_timers.xml delete mode 100644 scripts/metrics/slp_conv.py diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index 900a64e2dd4..4fa21489e4f 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -65,7 +65,6 @@ elseif (WINDOWS) ole32 dbghelp rpcrt4.lib - legacy_stdio_definitions ) else() find_library(COREFOUNDATION_LIBRARY CoreFoundation) diff --git a/indra/cmake/Tracy.cmake b/indra/cmake/Tracy.cmake index cb09337d15e..b24c69aefb8 100644 --- a/indra/cmake/Tracy.cmake +++ b/indra/cmake/Tracy.cmake @@ -1,7 +1,8 @@ # -*- cmake -*- +include_guard() include(Prebuilt) +include(Variables) -include_guard() add_library( ll::tracy INTERFACE IMPORTED ) # default Tracy profiling on for test builds, but off for all others @@ -9,7 +10,7 @@ string(TOLOWER ${VIEWER_CHANNEL} channel_lower) if(channel_lower MATCHES "^second life test") option(USE_TRACY "Use Tracy profiler." ON) else() - option(USE_TRACY "Use Tracy profiler." OFF) + option(USE_TRACY "Use Tracy profiler." OFF) endif() if (USE_TRACY) @@ -37,6 +38,6 @@ if (USE_TRACY) endif () # See: indra/llcommon/llprofiler.h - add_compile_definitions(LL_PROFILER_CONFIGURATION=3) + add_compile_definitions(LL_PROFILER_CONFIGURATION=1) endif (USE_TRACY) diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp index b82ced2f8df..219ec6211b5 100644 --- a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp @@ -43,8 +43,6 @@ #include "v4coloru.h" #include "llsdserialize.h" #include "llcleanup.h" -#include "lltrace.h" -#include "llfasttimer.h" // system libraries #include @@ -91,19 +89,10 @@ static const char USAGE[] = "\n" " Only valid for output j2c images.\n" " -f, --filter \n" " Apply the filter to the input images.\n" -" -log, --logmetrics \n" -" Log performance data for . Results in .slp\n" -" Note: so far, only ImageCompressionTester has been tested.\n" -" -a, --analyzeperformance\n" -" Create a report comparing _baseline.slp with current .slp\n" -" Results in _report.csv\n" " -s, --image-stats\n" " Output stats for each input and output image.\n" "\n"; -// true when all image loading is done. Used by metric logging thread to know when to stop the thread. -static bool sAllDone = false; - // Create an empty formatted image instance of the correct type from the filename LLPointer create_image(const std::string &filename) { @@ -315,34 +304,6 @@ void store_output_file(std::list &output_filenames, std::list input_filenames; std::list output_filenames; // Other optional parsed arguments - bool analyze_performance = false; bool image_stats = false; int* region = NULL; int discard_level = -1; @@ -368,7 +328,6 @@ int main(int argc, char** argv) // Init whatever is necessary ll_init_apr(); LLImage::initClass(); - LogThread* fast_timer_log_thread = NULL; // For performance and metric gathering // Analyze command line arguments for (int arg = 1; arg < argc; ++arg) @@ -514,29 +473,6 @@ int main(int argc, char** argv) { reversible = true; } - else if (!strcmp(argv[arg], "--logmetrics") || !strcmp(argv[arg], "-log")) - { - // '--logmetrics' needs to be specified with a named test metric argument - // Note: for the moment, only ImageCompressionTester has been tested - std::string test_name; - if ((arg + 1) < argc) - { - test_name = argv[arg+1]; - } - if (((arg + 1) >= argc) || (test_name[0] == '-')) - { - // We don't have an argument left in the arg list or the next argument is another option - std::cout << "No --logmetrics argument given, no perf data will be gathered" << std::endl; - } - else - { - LLFastTimer::sMetricLog = TRUE; - LLFastTimer::sLogName = test_name; - arg += 1; // Skip that arg now we know it's a valid test name - if ((arg + 1) == argc) // Break out of the loop if we reach the end of the arg list - break; - } - } else if (!strcmp(argv[arg], "--filter") || !strcmp(argv[arg], "-f")) { // '--filter' needs to be specified with a named filter argument @@ -556,10 +492,6 @@ int main(int argc, char** argv) break; } } - else if (!strcmp(argv[arg], "--analyzeperformance") || !strcmp(argv[arg], "-a")) - { - analyze_performance = true; - } else if (!strcmp(argv[arg], "--image-stats") || !strcmp(argv[arg], "-s")) { image_stats = true; @@ -572,20 +504,6 @@ int main(int argc, char** argv) std::cout << "No input file, nothing to do -> exit" << std::endl; return 0; } - if (analyze_performance && !LLFastTimer::sMetricLog) - { - std::cout << "Cannot create perf report if no perf gathered (i.e. use argument -log with -a) -> exit" << std::endl; - return 0; - } - - - // Create the logging thread if required - if (LLTrace::BlockTimer::sMetricLog) - { - LLTrace::BlockTimer::setLogLock(new LLMutex()); - fast_timer_log_thread = new LogThread(LLTrace::BlockTimer::sLogName); - fast_timer_log_thread->start(); - } // Load the filter once and for all LLImageFilter filter(filter_name); @@ -622,31 +540,8 @@ int main(int argc, char** argv) } } - // Output perf data if requested by user - if (analyze_performance) - { - std::string baseline_name = LLTrace::BlockTimer::sLogName + "_baseline.slp"; - std::string current_name = LLTrace::BlockTimer::sLogName + ".slp"; - std::string report_name = LLTrace::BlockTimer::sLogName + "_report.csv"; - - std::cout << "Analyzing performance, check report in : " << report_name << std::endl; - - LLMetricPerformanceTesterBasic::doAnalysisMetrics(baseline_name, current_name, report_name); - } - - // Stop the perf gathering system if needed - if (LLTrace::BlockTimer::sMetricLog) - { - LLMetricPerformanceTesterBasic::deleteTester(LLTrace::BlockTimer::sLogName); - sAllDone = true; - } - // Cleanup and exit SUBSYSTEM_CLEANUP(LLImage); - if (fast_timer_log_thread) - { - fast_timer_log_thread->shutdown(); - } return 0; } diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index dab18c240d5..01d247db9de 100644 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -884,7 +884,7 @@ void LLAvatarAppearance::buildCharacter() bool LLAvatarAppearance::loadAvatar() { -// LL_RECORD_BLOCK_TIME(FTM_LOAD_AVATAR); + LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; // avatar_skeleton.xml if( !buildSkeleton(sAvatarSkeletonInfo) ) diff --git a/indra/llappearance/llavatarjointmesh.cpp b/indra/llappearance/llavatarjointmesh.cpp index 69a90239946..b2ab781d3e3 100644 --- a/indra/llappearance/llavatarjointmesh.cpp +++ b/indra/llappearance/llavatarjointmesh.cpp @@ -28,7 +28,6 @@ // Header Files //----------------------------------------------------------------------------- #include "linden_common.h" -#include "llfasttimer.h" #include "llrender.h" #include "llavatarjointmesh.h" diff --git a/indra/llappearance/llpolymesh.cpp b/indra/llappearance/llpolymesh.cpp index d5323e0b846..6251ae9b5cc 100644 --- a/indra/llappearance/llpolymesh.cpp +++ b/indra/llappearance/llpolymesh.cpp @@ -29,7 +29,6 @@ //----------------------------------------------------------------------------- #include "linden_common.h" #include "llpolymesh.h" -#include "llfasttimer.h" #include "llmemory.h" //#include "llviewercontrol.h" diff --git a/indra/llappearance/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp index 5ee66491641..386b6ec5713 100644 --- a/indra/llappearance/llpolymorph.cpp +++ b/indra/llappearance/llpolymorph.cpp @@ -35,7 +35,6 @@ #include "llxmltree.h" #include "llendianswizzle.h" #include "llpolymesh.h" -#include "llfasttimer.h" //#include "../tools/imdebug/imdebug.h" diff --git a/indra/llappearance/llpolyskeletaldistortion.cpp b/indra/llappearance/llpolyskeletaldistortion.cpp index 7d62bb3a040..a139c4322f9 100644 --- a/indra/llappearance/llpolyskeletaldistortion.cpp +++ b/indra/llappearance/llpolyskeletaldistortion.cpp @@ -33,7 +33,6 @@ #include "llavatarjoint.h" #include "llpolymorph.h" #include "llwearable.h" -#include "llfasttimer.h" #include "llpolyskeletaldistortion.h" diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index 389efe47a9a..84aa784f8d8 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -41,7 +41,6 @@ #include "llwearabledata.h" #include "llvertexbuffer.h" #include "llviewervisualparam.h" -#include "llfasttimer.h" //#include "../tools/imdebug/imdebug.h" diff --git a/indra/llappearance/lltexlayerparams.cpp b/indra/llappearance/lltexlayerparams.cpp index 30551c115d9..7cd3c08f650 100644 --- a/indra/llappearance/lltexlayerparams.cpp +++ b/indra/llappearance/lltexlayerparams.cpp @@ -35,7 +35,6 @@ #include "lltexturemanagerbridge.h" #include "../llui/llui.h" #include "llwearable.h" -#include "llfasttimer.h" //----------------------------------------------------------------------------- // LLTexLayerParam diff --git a/indra/llappearanceutility/llappappearanceutility.cpp b/indra/llappearanceutility/llappappearanceutility.cpp index d223c859abc..4b554f6c617 100644 --- a/indra/llappearanceutility/llappappearanceutility.cpp +++ b/indra/llappearanceutility/llappappearanceutility.cpp @@ -206,7 +206,6 @@ LLAppAppearanceUtility::LLAppAppearanceUtility(int argc, char** argv) : mOutput(nullptr), mAppName(argv[0]), mDebugMode(false), - mTreeMapThreshold(1), mBakeTextureSize(512) { } @@ -299,12 +298,6 @@ void LLAppAppearanceUtility::parseArguments() case 'd': mDebugMode = true; break; - case 'm': - mTreeMapFilename.assign(opt_arg); - break; - case 's': - mTreeMapThreshold = atoi(opt_arg); - break; default: usage(std::cerr); throw LLAppException(RV_BAD_ARGUMENTS, "Unknown option."); @@ -457,7 +450,6 @@ bool LLAppAppearanceUtility::init() LLError::initForApplication(".", ".", true); if (mDebugMode) { - mRecording.start(); LLError::setDefaultLevel(LLError::LEVEL_DEBUG); } else @@ -490,91 +482,6 @@ bool LLAppAppearanceUtility::init() return true; } - -void add_cluster(LLTrace::Recording& recording, std::ostream& tree, LLTrace::BlockTimerStatHandle& node, std::vector < S32 > & clusters, F64Milliseconds threshold) -{ - LLMD5 hash; - hash.update((const unsigned char*)node.getName().c_str(), node.getName().size()); - hash.finalize(); - char buf[33]; - hash.hex_digest(buf); - buf[6] = 0; - LLColor3 color(buf); - if (color.brightness() < 0.25f) - { - color.normalize(); - } - std::ostringstream color_str; - color_str << "#" << std::hex << std::setfill('0') << std::setw(2) - << (S32) F32_to_U8(color.mV[0], 0.0f, 1.0f) - << (S32) F32_to_U8(color.mV[1], 0.0f, 1.0f) - << (S32) F32_to_U8(color.mV[2], 0.0f, 1.0f); - - std::vector::iterator iter = clusters.begin(); - std::vector::iterator end = clusters.end(); - std::ostringstream padding; - for(; iter != end; ++iter) - { - padding << " "; - } - - std::ostringstream node_id; - bool first = true; - iter = clusters.begin(); - for(; iter != end; ++iter) - { - if (!first) - { - node_id << "_"; - } - first = false; - node_id << (*iter); - } - - if (node.getChildren().size() == 0) - { - F64Milliseconds leaf_time_ms(recording.getSum(node)); - if (leaf_time_ms > threshold) - { - tree << padding.str() << "n" << node_id.str() << " [" - << "label=\"" << node.getName() << " (" << leaf_time_ms.value() << ")\" " - << "fillcolor=\"" << color_str.str() << "\" " - << "area=" << leaf_time_ms.value() / 10 << "]" << std::endl; - } - } - else - { - if (clusters.size()) - { - tree << padding.str() << "subgraph cluster" << node_id.str(); - tree << " {" << std::endl; - } - - S32Milliseconds node_area(recording.getSum(node)); - std::vector::iterator child_iter = node.getChildren().begin(); - for (S32 num=0; child_iter != node.getChildren().end(); ++child_iter, ++num) - { - clusters.push_back(num); - add_cluster(recording, tree, *(*child_iter), clusters, threshold); - clusters.pop_back(); - node_area -= recording.getSum(*(*child_iter)); - } - - S32Milliseconds node_time_ms(node_area); - if (node_time_ms > threshold) - { - tree << padding.str() << "n" << node_id.str() << " [" - << "label=\"" << node.getName() << " (" << node_time_ms.value() << ")\" " - << "fillcolor=\"" << color_str.str() << "\" " - << "area=" << node_time_ms.value() / 10 << "]" << std::endl; - } - if (clusters.size()) - { - tree << padding.str() << "}" << std::endl;; - } - } -} - bool LLAppAppearanceUtility::cleanup() { if (mProcess) @@ -582,72 +489,6 @@ bool LLAppAppearanceUtility::cleanup() mProcess->cleanup(); } - // Spam fast timer information in debug mode. - if (mDebugMode) - { - mRecording.stop(); - LLTrace::BlockTimer::processTimes(); - - S32Milliseconds max_time_ms(0); - for (LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(LLTrace::BlockTimer::getRootTimeBlock()); - it != LLTrace::end_block_timer_tree_df(); - ++it) - { - LLTrace::BlockTimerStatHandle* idp = (*it); - // Skip near-zero time leafs. - S32Milliseconds leaf_time_ms(mRecording.getSum(*idp)); - if (leaf_time_ms > max_time_ms) max_time_ms = leaf_time_ms; - if ((S32Milliseconds)0 == leaf_time_ms) continue; - - std::vector< LLTrace::BlockTimerStatHandle* > parents; - LLTrace::BlockTimerStatHandle* parentp = idp->getParent(); - while (parentp) - { - parents.push_back(parentp); - if (parentp->getParent() == parentp) break; - parentp = parentp->getParent(); - } - - std::ostringstream fullname; - bool is_first = true; - for ( std::vector< LLTrace::BlockTimerStatHandle* >::reverse_iterator iter = parents.rbegin(); - iter != parents.rend(); ++iter) - { - // Skip root - if (is_first) - { - is_first = false; - continue; - } - LLTrace::BlockTimerStatHandle* parent_idp = (*iter); - U32Milliseconds time_ms(mRecording.getSum(parent_idp->selfTime())); - fullname << parent_idp->getName() << " "; - fullname << "("; - if (time_ms > (U32Milliseconds)0) - { - fullname << time_ms.value() << " ms, "; - } - fullname << mRecording.getSum(parent_idp->callCount()) << " call)-> "; - } - LL_DEBUGS() << fullname.str() << LL_ENDL; - } - if (!mTreeMapFilename.empty()) - { - std::ofstream tree(mTreeMapFilename.c_str()); - tree << "graph G {" << std::endl; - tree << " node[style=filled]" << std::endl; - - LLTrace::BlockTimerStatHandle& root = LLTrace::BlockTimer::getRootTimeBlock(); - std::vector clusters; - add_cluster(mRecording, tree, root, clusters, (((F32) mTreeMapThreshold / 100.f) * max_time_ms) ); - - tree << "}" << std::endl; - - LL_DEBUGS() << "To generate a treemap of LLFrameTimer results, run:" << LL_ENDL; - LL_DEBUGS() << "patchwork " << mTreeMapFilename << " -Tpng > rendered.png" << LL_ENDL; - } - } - LLAvatarAppearance::cleanupClass(); LLImageGL::cleanupClass(); LLImage::cleanupClass(); diff --git a/indra/llappearanceutility/llappappearanceutility.h b/indra/llappearanceutility/llappappearanceutility.h index 80d1e8b1bf6..de67f100774 100644 --- a/indra/llappearanceutility/llappappearanceutility.h +++ b/indra/llappearanceutility/llappappearanceutility.h @@ -98,9 +98,6 @@ class LLAppAppearanceUtility : public LLApp LLUUID mAgentID; S32 mBakeTextureSize; bool mDebugMode; - LLTrace::Recording mRecording; - S32 mTreeMapThreshold; - std::string mTreeMapFilename; }; diff --git a/indra/llappearanceutility/llbakingtexlayer.cpp b/indra/llappearanceutility/llbakingtexlayer.cpp index 3427331a964..483298286fb 100644 --- a/indra/llappearanceutility/llbakingtexlayer.cpp +++ b/indra/llappearanceutility/llbakingtexlayer.cpp @@ -66,11 +66,9 @@ bool LLBakingTexLayerSetBuffer::render() return result; } -static LLFastTimer::DeclareTimer FTM_MID_RENDER("midRenderTexLayerSet"); -static LLFastTimer::DeclareTimer FTM_CREATE_J2C("Encode J2C image."); void LLBakingTexLayerSetBuffer::midRenderTexLayerSet(bool success) { - LL_RECORD_BLOCK_TIME(FTM_MID_RENDER); + LL_PROFILE_ZONE_SCOPED; if (!mTexLayerSet->isVisible()) { // Should have used IMG_INVISIBLE during hash id generation? @@ -124,7 +122,7 @@ void LLBakingTexLayerSetBuffer::midRenderTexLayerSet(bool success) } { - LL_RECORD_BLOCK_TIME(FTM_CREATE_J2C); + LL_PROFILE_ZONE_NAMED("Baking - Encode J2C"); LL_DEBUGS() << "Creating J2C..." << LL_ENDL; mCompressedImage = new LLImageJ2C; const char* comment_text = LINDEN_J2C_COMMENT_PREFIX "RGBHM"; // writes into baked_color_data. 5 channels (rgb, heightfield/alpha, mask) diff --git a/indra/llappearanceutility/llbakingtexture.cpp b/indra/llappearanceutility/llbakingtexture.cpp index ae83081aefe..0bc5195251f 100644 --- a/indra/llappearanceutility/llbakingtexture.cpp +++ b/indra/llappearanceutility/llbakingtexture.cpp @@ -73,9 +73,3 @@ void LLBakingTexture::forceImmediateUpdate() { LL_ERRS() << "Not implemented." << LL_ENDL; } - -void LLBakingTexture::updateBindStatsForTester() -{ - LL_ERRS() << "Not implemented." << LL_ENDL; -} - diff --git a/indra/llappearanceutility/llbakingtexture.h b/indra/llappearanceutility/llbakingtexture.h index 50b4193b2ee..f4198bd649b 100644 --- a/indra/llappearanceutility/llbakingtexture.h +++ b/indra/llappearanceutility/llbakingtexture.h @@ -51,7 +51,6 @@ class LLBakingTexture : public LLGLTexture void setKnownDrawSize(S32 width, S32 height) override; bool bindDefaultImage(const S32 stage = 0) override ; void forceImmediateUpdate() override; - void updateBindStatsForTester() override ; bool bindDebugImage(const S32 stage = 0) override { return false; } bool isActiveFetching() override { return false; } diff --git a/indra/llappearanceutility/llprocesstexture.cpp b/indra/llappearanceutility/llprocesstexture.cpp index 527a6822f2f..f12c49f35bc 100644 --- a/indra/llappearanceutility/llprocesstexture.cpp +++ b/indra/llappearanceutility/llprocesstexture.cpp @@ -68,12 +68,11 @@ void LLProcessTexture::cleanup() delete mWindow; } -static LLFastTimer::DeclareTimer FTM_CREATE_TEXTURE_FROM_STREAM("Create texture from stream."); static LLPointer create_texture_from_stream(std::istream& input, S32 texture_size, const LLUUID& id) { - LL_RECORD_BLOCK_TIME(FTM_CREATE_TEXTURE_FROM_STREAM); + LL_PROFILE_ZONE_SCOPED; // Read compressed j2c texture data from the input stream. U8* buffer = (U8*) ll_aligned_malloc_16(texture_size); input.read((char*) buffer, texture_size); diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 8efcd9dd297..4fa9760d597 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -32,7 +32,6 @@ #include "llcharacter.h" #include "llstring.h" -#include "llfasttimer.h" #define SKEL_HEADER "Linden Skeleton 1.0" diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index c204c96f6cc..be8a1233130 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -30,7 +30,6 @@ #include "linden_common.h" #include "llmotioncontroller.h" -#include "llfasttimer.h" #include "llkeyframemotion.h" #include "llmath.h" #include "lltimer.h" diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index c3b892b204d..2a080fca250 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -65,7 +65,6 @@ set(llcommon_SOURCE_FILES llmemory.cpp llmemorystream.cpp llmetrics.cpp - llmetricperformancetester.cpp llmortician.cpp llmutex.cpp llptrto.cpp @@ -85,7 +84,6 @@ set(llcommon_SOURCE_FILES llsdutil.cpp llsingleton.cpp llstacktrace.cpp - llstreamqueue.cpp llstreamtools.cpp llstring.cpp llstringtable.cpp @@ -185,7 +183,6 @@ set(llcommon_HEADER_FILES llmemory.h llmemorystream.h llmetrics.h - llmetricperformancetester.h llmortician.h llmutex.h llnametable.h @@ -217,7 +214,6 @@ set(llcommon_HEADER_FILES llsingleton.h llstacktrace.h llstl.h - llstreamqueue.h llstreamtools.h llstrider.h llstring.h @@ -249,7 +245,6 @@ set(llcommon_HEADER_FILES threadpool.h threadpool_fwd.h threadsafeschedule.h - timer.h tuple.h u64.h workqueue.h @@ -338,7 +333,6 @@ if (LL_TESTS) LL_ADD_INTEGRATION_TEST(llrand "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llsdserialize "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llsingleton "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(llstreamqueue "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llstring "" "${test_libs}") LL_ADD_INTEGRATION_TEST(lltrace "" "${test_libs}") LL_ADD_INTEGRATION_TEST(lltreeiterators "" "${test_libs}") diff --git a/indra/llcommon/llcommon.cpp b/indra/llcommon/llcommon.cpp index bf8801c46b4..4dd311f2737 100644 --- a/indra/llcommon/llcommon.cpp +++ b/indra/llcommon/llcommon.cpp @@ -112,7 +112,7 @@ void operator delete[](void* ptr, std::align_val_t align) noexcept #endif -#endif // TRACY_ENABLE && !LL_PROFILER_ENABLE_TRACY_OPENGL +#endif // TRACY_ENABLE //static bool LLCommon::sAprInitialized = false; diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp index b4cdf3cbda2..0489a2dde8c 100644 --- a/indra/llcommon/lldate.cpp +++ b/indra/llcommon/lldate.cpp @@ -39,7 +39,6 @@ #include "lltimer.h" #include "llstring.h" -#include "llfasttimer.h" static const F64 LL_APR_USEC_PER_SEC = 1000000.0; // should be APR_USEC_PER_SEC, but that relies on INT64_C which diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index c5a7a0e56b5..4925de9e5fc 100644 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -30,17 +30,13 @@ #include "llmemory.h" #include "llprocessor.h" #include "llsingleton.h" -#include "lltreeiterators.h" #include "llsdserialize.h" #include "llunits.h" #include "llsd.h" -#include "lltracerecording.h" -#include "lltracethreadrecorder.h" #include #include - #if LL_WINDOWS #include "lltimer.h" #elif LL_LINUX @@ -54,112 +50,24 @@ #error "architecture not supported" #endif -namespace LLTrace -{ - ////////////////////////////////////////////////////////////////////////////// // statics - -bool BlockTimer::sLog = false; -std::string BlockTimer::sLogName = ""; -bool BlockTimer::sMetricLog = false; - #if LL_LINUX || (LL_DARWIN && LL_ARM64) -U64 BlockTimer::sClockResolution = 1000000000; // Nanosecond resolution +U64 LLFastTimer::sClockResolution = 1000000000; // Nanosecond resolution #else -U64 BlockTimer::sClockResolution = 1000000; // Microsecond resolution +U64 LLFastTimer::sClockResolution = 1000000; // Microsecond resolution #endif -static LLMutex* sLogLock = NULL; -static std::queue sLogQueue; - -block_timer_tree_df_iterator_t begin_block_timer_tree_df(BlockTimerStatHandle& id) -{ - return block_timer_tree_df_iterator_t(&id, - boost::bind(boost::mem_fn(&BlockTimerStatHandle::beginChildren), _1), - boost::bind(boost::mem_fn(&BlockTimerStatHandle::endChildren), _1)); -} - -block_timer_tree_df_iterator_t end_block_timer_tree_df() -{ - return block_timer_tree_df_iterator_t(); -} - -block_timer_tree_df_post_iterator_t begin_block_timer_tree_df_post(BlockTimerStatHandle& id) -{ - return block_timer_tree_df_post_iterator_t(&id, - boost::bind(boost::mem_fn(&BlockTimerStatHandle::beginChildren), _1), - boost::bind(boost::mem_fn(&BlockTimerStatHandle::endChildren), _1)); -} - -block_timer_tree_df_post_iterator_t end_block_timer_tree_df_post() -{ - return block_timer_tree_df_post_iterator_t(); -} - -block_timer_tree_bf_iterator_t begin_block_timer_tree_bf(BlockTimerStatHandle& id) -{ - return block_timer_tree_bf_iterator_t(&id, - boost::bind(boost::mem_fn(&BlockTimerStatHandle::beginChildren), _1), - boost::bind(boost::mem_fn(&BlockTimerStatHandle::endChildren), _1)); -} - -block_timer_tree_bf_iterator_t end_block_timer_tree_bf() - { - return block_timer_tree_bf_iterator_t(); - } - -block_timer_tree_df_iterator_t begin_timer_tree(BlockTimerStatHandle& id) - { - return block_timer_tree_df_iterator_t(&id, - boost::bind(boost::mem_fn(&BlockTimerStatHandle::beginChildren), _1), - boost::bind(boost::mem_fn(&BlockTimerStatHandle::endChildren), _1)); - } - -block_timer_tree_df_iterator_t end_timer_tree() - { - return block_timer_tree_df_iterator_t(); -} - - -// sort child timers by name -struct SortTimerByName - { - bool operator()(const BlockTimerStatHandle* i1, const BlockTimerStatHandle* i2) - { - return i1->getName() < i2->getName(); - } -}; - -static BlockTimerStatHandle sRootTimer("root", NULL); -BlockTimerStatHandle& BlockTimer::getRootTimeBlock() -{ - return sRootTimer; - } - -void BlockTimer::pushLog(LLSD log) -{ - LLMutexLock lock(sLogLock); - - sLogQueue.push(log); -} - -void BlockTimer::setLogLock(LLMutex* lock) -{ - sLogLock = lock; -} - - //static #if (LL_DARWIN || LL_LINUX) && !(defined(__i386__) || defined(__amd64__)) -U64 BlockTimer::countsPerSecond() +U64 LLFastTimer::countsPerSecond() { return sClockResolution; } #else // windows or x86-mac or x86-linux -U64 BlockTimer::countsPerSecond() +U64 LLFastTimer::countsPerSecond() { -#if LL_FASTTIMER_USE_RDTSC || !LL_WINDOWS +#if !LL_WINDOWS || LL_FASTTIMER_USE_RDTSC //getCPUFrequency returns MHz and sCPUClockFrequency wants to be in Hz static LLUnit sCPUClockFrequency = LLProcessorInfo().getCPUFrequency(); return sCPUClockFrequency.value(); @@ -178,321 +86,3 @@ U64 BlockTimer::countsPerSecond() #endif } #endif - -BlockTimerStatHandle::BlockTimerStatHandle(const char* name, const char* description) -: StatType(name, description) -{} - -TimeBlockTreeNode& BlockTimerStatHandle::getTreeNode() const -{ - TimeBlockTreeNode* nodep = LLTrace::get_thread_recorder()->getTimeBlockTreeNode(getIndex()); - llassert(nodep); - return *nodep; -} - - - -void BlockTimer::bootstrapTimerTree() -{ - for (auto& base : BlockTimerStatHandle::instance_snapshot()) - { - // because of indirect derivation from LLInstanceTracker, have to downcast - BlockTimerStatHandle& timer = static_cast(base); - if (&timer == &BlockTimer::getRootTimeBlock()) continue; - - // bootstrap tree construction by attaching to last timer to be on stack - // when this timer was called - if (timer.getParent() == &BlockTimer::getRootTimeBlock()) - { - TimeBlockAccumulator& accumulator = timer.getCurrentAccumulator(); - - if (accumulator.mLastCaller) - { - timer.setParent(accumulator.mLastCaller); - accumulator.mParent = accumulator.mLastCaller; - } - // no need to push up tree on first use, flag can be set spuriously - accumulator.mMoveUpTree = false; - } - } -} - -// bump timers up tree if they have been flagged as being in the wrong place -// do this in a bottom up order to promote descendants first before promoting ancestors -// this preserves partial order derived from current frame's observations -void BlockTimer::incrementalUpdateTimerTree() -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; - for(block_timer_tree_df_post_iterator_t it = begin_block_timer_tree_df_post(BlockTimer::getRootTimeBlock()); - it != end_block_timer_tree_df_post(); - ++it) - { - BlockTimerStatHandle* timerp = *it; - - // sort timers by time last called, so call graph makes sense - TimeBlockTreeNode& tree_node = timerp->getTreeNode(); - if (tree_node.mNeedsSorting) -{ - std::sort(tree_node.mChildren.begin(), tree_node.mChildren.end(), SortTimerByName()); -} - - // skip root timer - if (timerp != &BlockTimer::getRootTimeBlock()) -{ - TimeBlockAccumulator& accumulator = timerp->getCurrentAccumulator(); - - if (accumulator.mMoveUpTree) -{ - // since ancestors have already been visited, re-parenting won't affect tree traversal - //step up tree, bringing our descendants with us - LL_DEBUGS("FastTimers") << "Moving " << timerp->getName() << " from child of " << timerp->getParent()->getName() << - " to child of " << timerp->getParent()->getParent()->getName() << LL_ENDL; - timerp->setParent(timerp->getParent()->getParent()); - accumulator.mParent = timerp->getParent(); - accumulator.mMoveUpTree = false; - - // don't bubble up any ancestors until descendants are done bubbling up - // as ancestors may call this timer only on certain paths, so we want to resolve - // child-most block locations before their parents - it.skipAncestors(); - } - } - } -} - - -void BlockTimer::updateTimes() -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; - // walk up stack of active timers and accumulate current time while leaving timing structures active - BlockTimerStackRecord* stack_record = LLThreadLocalSingletonPointer::getInstance(); - if (!stack_record) return; - - U64 cur_time = getCPUClockCount64(); - BlockTimer* cur_timer = stack_record->mActiveTimer; - TimeBlockAccumulator* accumulator = &stack_record->mTimeBlock->getCurrentAccumulator(); - - while(cur_timer - && cur_timer->mParentTimerData.mActiveTimer != cur_timer) // root defined by parent pointing to self - { - U64 cumulative_time_delta = cur_time - cur_timer->mStartTime; - cur_timer->mStartTime = cur_time; - - accumulator->mTotalTimeCounter += cumulative_time_delta; - accumulator->mSelfTimeCounter += cumulative_time_delta - stack_record->mChildTime; - stack_record->mChildTime = 0; - - stack_record = &cur_timer->mParentTimerData; - accumulator = &stack_record->mTimeBlock->getCurrentAccumulator(); - cur_timer = stack_record->mActiveTimer; - - stack_record->mChildTime += cumulative_time_delta; - } -} - -static LLTrace::BlockTimerStatHandle FTM_PROCESS_TIMES("Process FastTimer Times"); - -// not thread safe, so only call on main thread -//static -void BlockTimer::processTimes() -{ -#if LL_TRACE_ENABLED - LL_RECORD_BLOCK_TIME(FTM_PROCESS_TIMES); - get_clock_count(); // good place to calculate clock frequency - - // set up initial tree - bootstrapTimerTree(); - - incrementalUpdateTimerTree(); - - updateTimes(); - - // reset for next frame - for (auto& base : BlockTimerStatHandle::instance_snapshot()) - { - // because of indirect derivation from LLInstanceTracker, have to downcast - BlockTimerStatHandle& timer = static_cast(base); - TimeBlockAccumulator& accumulator = timer.getCurrentAccumulator(); - - accumulator.mLastCaller = NULL; - accumulator.mMoveUpTree = false; - } -#endif -} - -std::vector::iterator BlockTimerStatHandle::beginChildren() - { - return getTreeNode().mChildren.begin(); - } - -std::vector::iterator BlockTimerStatHandle::endChildren() - { - return getTreeNode().mChildren.end(); -} - -std::vector& BlockTimerStatHandle::getChildren() -{ - return getTreeNode().mChildren; - } - -bool BlockTimerStatHandle::hasChildren() -{ - return ! getTreeNode().mChildren.empty(); -} - -// static -void BlockTimer::logStats() -{ - // get ready for next frame - if (sLog) - { //output current frame counts to performance log - - static S32 call_count = 0; - if (call_count % 100 == 0) - { - LL_DEBUGS("FastTimers") << "countsPerSecond: " << countsPerSecond() << LL_ENDL; - LL_DEBUGS("FastTimers") << "LLProcessorInfo().getCPUFrequency() " << LLProcessorInfo().getCPUFrequency() << LL_ENDL; - LL_DEBUGS("FastTimers") << "getCPUClockCount32() " << getCPUClockCount32() << LL_ENDL; - LL_DEBUGS("FastTimers") << "getCPUClockCount64() " << getCPUClockCount64() << LL_ENDL; - LL_DEBUGS("FastTimers") << "elapsed sec " << ((F64)getCPUClockCount64() / (F64HertzImplicit)LLProcessorInfo().getCPUFrequency()) << LL_ENDL; - } - call_count++; - - F64Seconds total_time(0); - LLSD sd; - - { - for (auto& base : BlockTimerStatHandle::instance_snapshot()) - { - // because of indirect derivation from LLInstanceTracker, have to downcast - BlockTimerStatHandle& timer = static_cast(base); - LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording(); - sd[timer.getName()]["Time"] = (LLSD::Real) (frame_recording.getLastRecording().getSum(timer).value()); - sd[timer.getName()]["Calls"] = (LLSD::Integer) (frame_recording.getLastRecording().getSum(timer.callCount())); - - // computing total time here because getting the root timer's getCountHistory - // doesn't work correctly on the first frame - total_time += frame_recording.getLastRecording().getSum(timer); - } - } - - sd["Total"]["Time"] = (LLSD::Real) total_time.value(); - sd["Total"]["Calls"] = (LLSD::Integer) 1; - - { - LLMutexLock lock(sLogLock); - sLogQueue.push(sd); - } - } - -} - -#if defined(LL_GNUC) && GCC_VERSION >= 130000 -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wnonnull" -#endif - -//static -void BlockTimer::dumpCurTimes() -{ - LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording(); - LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording(); - - // walk over timers in depth order and output timings - for(block_timer_tree_df_iterator_t it = begin_timer_tree(BlockTimer::getRootTimeBlock()); - it != end_timer_tree(); - ++it) - { - BlockTimerStatHandle* timerp = (*it); - F64Seconds total_time = last_frame_recording.getSum(*timerp); - U32 num_calls = last_frame_recording.getSum(timerp->callCount()); - - // Don't bother with really brief times, keep output concise - if (total_time < F32Milliseconds(0.1f)) continue; - - std::ostringstream out_str; - BlockTimerStatHandle* parent_timerp = timerp; - while(parent_timerp && parent_timerp != parent_timerp->getParent()) - { - out_str << "\t"; - parent_timerp = parent_timerp->getParent(); - } - - out_str << timerp->getName() << " " - << std::setprecision(3) << total_time.valueInUnits() << " ms, " - << num_calls << " calls"; - - LL_INFOS() << out_str.str() << LL_ENDL; - } -} - -#if defined(LL_GNUC) && GCC_VERSION >= 130000 -# pragma GCC diagnostic push -#endif - -//static -void BlockTimer::writeLog(std::ostream& os) -{ - while (!sLogQueue.empty()) - { - LLSD& sd = sLogQueue.front(); - LLSDSerialize::toXML(sd, os); - LLMutexLock lock(sLogLock); - sLogQueue.pop(); - } -} - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// TimeBlockAccumulator -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -TimeBlockAccumulator::TimeBlockAccumulator() -: mTotalTimeCounter(0), - mSelfTimeCounter(0), - mCalls(0), - mLastCaller(NULL), - mActiveCount(0), - mMoveUpTree(false), - mParent(NULL) -{} - -void TimeBlockAccumulator::addSamples( const TimeBlockAccumulator& other, EBufferAppendType append_type ) -{ -#if LL_TRACE_ENABLED - // we can't merge two unrelated time block samples, as that will screw with the nested timings - // due to the call hierarchy of each thread - llassert(append_type == SEQUENTIAL); - mTotalTimeCounter += other.mTotalTimeCounter; - mSelfTimeCounter += other.mSelfTimeCounter; - mCalls += other.mCalls; - mLastCaller = other.mLastCaller; - mActiveCount = other.mActiveCount; - mMoveUpTree = other.mMoveUpTree; - mParent = other.mParent; -#endif -} - -void TimeBlockAccumulator::reset( const TimeBlockAccumulator* other ) -{ - mCalls = 0; - mSelfTimeCounter = 0; - mTotalTimeCounter = 0; - - if (other) -{ - mLastCaller = other->mLastCaller; - mActiveCount = other->mActiveCount; - mMoveUpTree = other->mMoveUpTree; - mParent = other->mParent; - } -} - -F64Seconds BlockTimer::getElapsedTime() -{ - U64 total_time = getCPUClockCount64() - mStartTime; - - return F64Seconds((F64)total_time / (F64)BlockTimer::countsPerSecond()); -} - - -} // namespace LLTrace diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 271dade0979..d35e162be6e 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -27,9 +27,6 @@ #ifndef LL_FASTTIMER_H #define LL_FASTTIMER_H -#include "llinstancetracker.h" -#include "lltrace.h" -#include "lltreeiterators.h" #include "llprocessor.h" #if LL_X86 || LL_X86_64 @@ -40,35 +37,19 @@ #endif #endif -#define LL_FAST_TIMER_ON 1 #define LL_FASTTIMER_USE_RDTSC 1 -// NOTE: Also see llprofiler.h -#if !defined(LL_PROFILER_CONFIGURATION) -#define LL_RECORD_BLOCK_TIME(timer_stat) const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(timer_stat)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); -#endif // LL_PROFILER_CONFIGURATION - -namespace LLTrace -{ -// use to create blocktimer rvalue to be captured in a reference so that the BlockTimer lives to the end of the block. -class BlockTimer timeThisBlock(class BlockTimerStatHandle& timer); - -class BlockTimer +class LLFastTimer { public: - typedef BlockTimer self_t; - typedef class BlockTimerStatHandle DeclareTimer; - - ~BlockTimer(); + LLFastTimer() = delete; + LLFastTimer(const LLFastTimer& other) = delete; + LLFastTimer& operator=(const LLFastTimer& other) = delete; - F64Seconds getElapsedTime(); - - ////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////// // // Important note: These implementations must be FAST! // - - #if LL_WINDOWS // // Windows implementation of CPU clock @@ -172,165 +153,11 @@ class BlockTimer #endif #endif - static BlockTimerStatHandle& getRootTimeBlock(); - static void pushLog(LLSD sd); - static void setLogLock(class LLMutex* mutex); - static void writeLog(std::ostream& os); - static void updateTimes(); - static U64 countsPerSecond(); - // updates cumulative times and hierarchy, - // can be called multiple times in a frame, at any point - static void processTimes(); - - static void bootstrapTimerTree(); - static void incrementalUpdateTimerTree(); - - // call this once a frame to periodically log timers - static void logStats(); - - // dumps current cumulative frame stats to log - // call nextFrame() to reset timers - static void dumpCurTimes(); - -private: - friend class BlockTimerStatHandle; - // FIXME: this friendship exists so that each thread can instantiate a root timer, - // which could be a derived class with a public constructor instead, possibly - friend class ThreadRecorder; - friend BlockTimer timeThisBlock(BlockTimerStatHandle&); - - BlockTimer(BlockTimerStatHandle& timer); - - // no-copy - BlockTimer(const BlockTimer& other); - BlockTimer& operator=(const BlockTimer& other); - -private: - U64 mStartTime; - BlockTimerStackRecord mParentTimerData{}; - public: // statics - static std::string sLogName; - static bool sMetricLog, - sLog; static U64 sClockResolution; - }; -// this dummy function assists in allocating a block timer with stack-based lifetime. -// this is done by capturing the return value in a stack-allocated const reference variable. -// (This is most easily done using the macro LL_RECORD_BLOCK_TIME) -// Otherwise, it would be possible to store a BlockTimer on the heap, resulting in non-nested lifetimes, -// which would break the invariants of the timing hierarchy logic -LL_FORCE_INLINE class BlockTimer timeThisBlock(class BlockTimerStatHandle& timer) -{ - return BlockTimer(timer); -} - -// stores a "named" timer instance to be reused via multiple BlockTimer stack instances -class BlockTimerStatHandle -: public StatType -{ -public: - BlockTimerStatHandle(const char* name, const char* description = ""); - - TimeBlockTreeNode& getTreeNode() const; - BlockTimerStatHandle* getParent() const { return getTreeNode().getParent(); } - void setParent(BlockTimerStatHandle* parent) { getTreeNode().setParent(parent); } - - typedef std::vector::iterator child_iter; - typedef std::vector::const_iterator child_const_iter; - child_iter beginChildren(); - child_iter endChildren(); - bool hasChildren(); - std::vector& getChildren(); - - StatType& callCount() - { - return static_cast&>(*(StatType*)this); - } - - StatType& selfTime() - { - return static_cast&>(*(StatType*)this); - } - - bool mCollapsed; // don't show children -}; - -// iterators and helper functions for walking the call hierarchy of block timers in different ways -typedef LLTreeDFSIter block_timer_tree_df_iterator_t; -typedef LLTreeDFSPostIter block_timer_tree_df_post_iterator_t; -typedef LLTreeBFSIter block_timer_tree_bf_iterator_t; - -block_timer_tree_df_iterator_t begin_block_timer_tree_df(BlockTimerStatHandle& id); -block_timer_tree_df_iterator_t end_block_timer_tree_df(); -block_timer_tree_df_post_iterator_t begin_block_timer_tree_df_post(BlockTimerStatHandle& id); -block_timer_tree_df_post_iterator_t end_block_timer_tree_df_post(); -block_timer_tree_bf_iterator_t begin_block_timer_tree_bf(BlockTimerStatHandle& id); -block_timer_tree_bf_iterator_t end_block_timer_tree_bf(); - -LL_FORCE_INLINE BlockTimer::BlockTimer(BlockTimerStatHandle& timer) -{ -#if LL_FAST_TIMER_ON - BlockTimerStackRecord* cur_timer_data = LLThreadLocalSingletonPointer::getInstance(); - if (!cur_timer_data) - { - // How likely is it that - // LLThreadLocalSingletonPointer::getInstance() will return NULL? - // Even without researching, what we can say is that if we exit - // without setting mStartTime at all, gcc 4.7 produces (fatal) - // warnings about a possibly-uninitialized data member. - mStartTime = 0; - return; - } - TimeBlockAccumulator& accumulator = timer.getCurrentAccumulator(); - accumulator.mActiveCount++; - // keep current parent as long as it is active when we are - accumulator.mMoveUpTree |= (accumulator.mParent->getCurrentAccumulator().mActiveCount == 0); - - // store top of stack - mParentTimerData = *cur_timer_data; - // push new information - cur_timer_data->mActiveTimer = this; - cur_timer_data->mTimeBlock = &timer; - cur_timer_data->mChildTime = 0; - - mStartTime = getCPUClockCount64(); -#endif -} - -LL_FORCE_INLINE BlockTimer::~BlockTimer() -{ -#if LL_FAST_TIMER_ON - U64 total_time = getCPUClockCount64() - mStartTime; - BlockTimerStackRecord* cur_timer_data = LLThreadLocalSingletonPointer::getInstance(); - if (!cur_timer_data) return; - - TimeBlockAccumulator& accumulator = cur_timer_data->mTimeBlock->getCurrentAccumulator(); - - accumulator.mCalls++; - accumulator.mTotalTimeCounter += total_time; - accumulator.mSelfTimeCounter += total_time - cur_timer_data->mChildTime; - accumulator.mActiveCount--; - - // store last caller to bootstrap tree creation - // do this in the destructor in case of recursion to get topmost caller - accumulator.mLastCaller = mParentTimerData.mTimeBlock; - - // we are only tracking self time, so subtract our total time delta from parents - mParentTimerData.mChildTime += total_time; - - //pop stack - *cur_timer_data = mParentTimerData; -#endif -} - -} - -typedef LLTrace::BlockTimer LLFastTimer; - #endif // LL_LLFASTTIMER_H diff --git a/indra/llcommon/llfixedbuffer.h b/indra/llcommon/llfixedbuffer.h index 1234d2014f3..d2cd660c18c 100644 --- a/indra/llcommon/llfixedbuffer.h +++ b/indra/llcommon/llfixedbuffer.h @@ -27,7 +27,7 @@ #ifndef LL_LLFIXEDBUFFER_H #define LL_LLFIXEDBUFFER_H -#include "timer.h" +#include "lltimer.h" #include #include #include "llstring.h" diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp deleted file mode 100644 index cc258e4609a..00000000000 --- a/indra/llcommon/llmetricperformancetester.cpp +++ /dev/null @@ -1,333 +0,0 @@ -/** - * @file llmetricperformancetester.cpp - * @brief LLMetricPerformanceTesterBasic and LLMetricPerformanceTesterWithSession classes implementation - * - * $LicenseInfo:firstyear=2004&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "indra_constants.h" -#include "llerror.h" -#include "llsdserialize.h" -#include "lltreeiterators.h" -#include "llmetricperformancetester.h" -#include "llfasttimer.h" - -//---------------------------------------------------------------------------------------------- -// LLMetricPerformanceTesterBasic : static methods and testers management -//---------------------------------------------------------------------------------------------- - -LLMetricPerformanceTesterBasic::name_tester_map_t LLMetricPerformanceTesterBasic::sTesterMap ; - -/*static*/ -void LLMetricPerformanceTesterBasic::cleanupClass() -{ - for (name_tester_map_t::value_type& pair : sTesterMap) - { - delete pair.second; - } - sTesterMap.clear() ; -} - -/*static*/ -bool LLMetricPerformanceTesterBasic::addTester(LLMetricPerformanceTesterBasic* tester) -{ - llassert_always(tester != NULL); - std::string name = tester->getTesterName() ; - if (getTester(name)) - { - LL_ERRS() << "Tester name is already used by some other tester : " << name << LL_ENDL ; - return false; - } - - sTesterMap.insert(std::make_pair(name, tester)); - return true; -} - -/*static*/ -void LLMetricPerformanceTesterBasic::deleteTester(std::string name) -{ - name_tester_map_t::iterator tester = sTesterMap.find(name); - if (tester != sTesterMap.end()) - { - delete tester->second; - sTesterMap.erase(tester); - } -} - -/*static*/ -LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::string name) -{ - // Check for the requested metric name - name_tester_map_t::iterator found_it = sTesterMap.find(name) ; - if (found_it != sTesterMap.end()) - { - return found_it->second ; - } - return NULL ; -} - -/*static*/ -// Return true if this metric is requested or if the general default "catch all" metric is requested -bool LLMetricPerformanceTesterBasic::isMetricLogRequested(std::string name) -{ - return (LLTrace::BlockTimer::sMetricLog && ((LLTrace::BlockTimer::sLogName == name) || (LLTrace::BlockTimer::sLogName == DEFAULT_METRIC_NAME))); -} - -/*static*/ -LLSD LLMetricPerformanceTesterBasic::analyzeMetricPerformanceLog(std::istream& is) -{ - LLSD ret; - LLSD cur; - - while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is)) - { - for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter) - { - std::string label = iter->first; - - LLMetricPerformanceTesterBasic* tester = LLMetricPerformanceTesterBasic::getTester(iter->second["Name"].asString()) ; - if(tester) - { - ret[label]["Name"] = iter->second["Name"] ; - - auto num_of_metrics = tester->getNumberOfMetrics() ; - for(size_t index = 0 ; index < num_of_metrics ; index++) - { - ret[label][ tester->getMetricName(index) ] = iter->second[ tester->getMetricName(index) ] ; - } - } - } - } - - return ret; -} - -/*static*/ -void LLMetricPerformanceTesterBasic::doAnalysisMetrics(std::string baseline, std::string target, std::string output) -{ - if(!LLMetricPerformanceTesterBasic::hasMetricPerformanceTesters()) - { - return ; - } - - // Open baseline and current target, exit if one is inexistent - llifstream base_is(baseline.c_str()); - llifstream target_is(target.c_str()); - if (!base_is.is_open() || !target_is.is_open()) - { - LL_WARNS() << "'-analyzeperformance' error : baseline or current target file inexistent" << LL_ENDL; - base_is.close(); - target_is.close(); - return; - } - - //analyze baseline - LLSD base = analyzeMetricPerformanceLog(base_is); - base_is.close(); - - //analyze current - LLSD current = analyzeMetricPerformanceLog(target_is); - target_is.close(); - - //output comparision - llofstream os(output.c_str()); - - os << "Label, Metric, Base(B), Target(T), Diff(T-B), Percentage(100*T/B)\n"; - for (LLMetricPerformanceTesterBasic::name_tester_map_t::value_type& pair : LLMetricPerformanceTesterBasic::sTesterMap) - { - LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)pair.second); - tester->analyzePerformance(&os, &base, ¤t) ; - } - - os.flush(); - os.close(); -} - - -//---------------------------------------------------------------------------------------------- -// LLMetricPerformanceTesterBasic : Tester instance methods -//---------------------------------------------------------------------------------------------- - -LLMetricPerformanceTesterBasic::LLMetricPerformanceTesterBasic(std::string name) : - mName(name), - mCount(0) -{ - if (mName == std::string()) - { - LL_ERRS() << "LLMetricPerformanceTesterBasic construction invalid : Empty name passed to constructor" << LL_ENDL ; - } - - mValidInstance = LLMetricPerformanceTesterBasic::addTester(this) ; -} - -LLMetricPerformanceTesterBasic::~LLMetricPerformanceTesterBasic() -{ -} - -void LLMetricPerformanceTesterBasic::preOutputTestResults(LLSD* sd) -{ - incrementCurrentCount() ; -} - -void LLMetricPerformanceTesterBasic::postOutputTestResults(LLSD* sd) -{ - LLTrace::BlockTimer::pushLog(*sd); -} - -void LLMetricPerformanceTesterBasic::outputTestResults() -{ - LLSD sd; - - preOutputTestResults(&sd) ; - outputTestRecord(&sd) ; - postOutputTestResults(&sd) ; -} - -void LLMetricPerformanceTesterBasic::addMetric(std::string str) -{ - mMetricStrings.push_back(str) ; -} - -/*virtual*/ -void LLMetricPerformanceTesterBasic::analyzePerformance(llofstream* os, LLSD* base, LLSD* current) -{ - resetCurrentCount() ; - - std::string current_label = getCurrentLabelName(); - bool in_base = (*base).has(current_label) ; - bool in_current = (*current).has(current_label) ; - - while(in_base || in_current) - { - LLSD::String label = current_label ; - - if(in_base && in_current) - { - *os << llformat("%s\n", label.c_str()) ; - - for(U32 index = 0 ; index < mMetricStrings.size() ; index++) - { - switch((*current)[label][ mMetricStrings[index] ].type()) - { - case LLSD::TypeInteger: - compareTestResults(os, mMetricStrings[index], - (S32)((*base)[label][ mMetricStrings[index] ].asInteger()), (S32)((*current)[label][ mMetricStrings[index] ].asInteger())) ; - break ; - case LLSD::TypeReal: - compareTestResults(os, mMetricStrings[index], - (F32)((*base)[label][ mMetricStrings[index] ].asReal()), (F32)((*current)[label][ mMetricStrings[index] ].asReal())) ; - break; - default: - LL_ERRS() << "unsupported metric " << mMetricStrings[index] << " LLSD type: " << (S32)(*current)[label][ mMetricStrings[index] ].type() << LL_ENDL ; - } - } - } - - incrementCurrentCount(); - current_label = getCurrentLabelName(); - in_base = (*base).has(current_label) ; - in_current = (*current).has(current_label) ; - } -} - -/*virtual*/ -void LLMetricPerformanceTesterBasic::compareTestResults(llofstream* os, std::string metric_string, S32 v_base, S32 v_current) -{ - *os << llformat(" ,%s, %d, %d, %d, %.4f\n", metric_string.c_str(), v_base, v_current, - v_current - v_base, (v_base != 0) ? 100.f * v_current / v_base : 0) ; -} - -/*virtual*/ -void LLMetricPerformanceTesterBasic::compareTestResults(llofstream* os, std::string metric_string, F32 v_base, F32 v_current) -{ - *os << llformat(" ,%s, %.4f, %.4f, %.4f, %.4f\n", metric_string.c_str(), v_base, v_current, - v_current - v_base, (fabs(v_base) > 0.0001f) ? 100.f * v_current / v_base : 0.f ) ; -} - -//---------------------------------------------------------------------------------------------- -// LLMetricPerformanceTesterWithSession -//---------------------------------------------------------------------------------------------- - -LLMetricPerformanceTesterWithSession::LLMetricPerformanceTesterWithSession(std::string name) : - LLMetricPerformanceTesterBasic(name), - mBaseSessionp(NULL), - mCurrentSessionp(NULL) -{ -} - -LLMetricPerformanceTesterWithSession::~LLMetricPerformanceTesterWithSession() -{ - if (mBaseSessionp) - { - delete mBaseSessionp ; - mBaseSessionp = NULL ; - } - if (mCurrentSessionp) - { - delete mCurrentSessionp ; - mCurrentSessionp = NULL ; - } -} - -/*virtual*/ -void LLMetricPerformanceTesterWithSession::analyzePerformance(llofstream* os, LLSD* base, LLSD* current) -{ - // Load the base session - resetCurrentCount() ; - mBaseSessionp = loadTestSession(base) ; - - // Load the current session - resetCurrentCount() ; - mCurrentSessionp = loadTestSession(current) ; - - if (!mBaseSessionp || !mCurrentSessionp) - { - LL_ERRS() << "Error loading test sessions." << LL_ENDL ; - } - - // Compare - compareTestSessions(os) ; - - // Release memory - if (mBaseSessionp) - { - delete mBaseSessionp ; - mBaseSessionp = NULL ; - } - if (mCurrentSessionp) - { - delete mCurrentSessionp ; - mCurrentSessionp = NULL ; - } -} - - -//---------------------------------------------------------------------------------------------- -// LLTestSession -//---------------------------------------------------------------------------------------------- - -LLMetricPerformanceTesterWithSession::LLTestSession::~LLTestSession() -{ -} - diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h deleted file mode 100644 index 78abd536022..00000000000 --- a/indra/llcommon/llmetricperformancetester.h +++ /dev/null @@ -1,215 +0,0 @@ -/** - * @file llmetricperformancetester.h - * @brief LLMetricPerformanceTesterBasic and LLMetricPerformanceTesterWithSession classes definition - * - * $LicenseInfo:firstyear=2004&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_METRICPERFORMANCETESTER_H -#define LL_METRICPERFORMANCETESTER_H - -char const* const DEFAULT_METRIC_NAME = "metric"; - -/** - * @class LLMetricPerformanceTesterBasic - * @brief Performance Metric Base Class - */ -class LL_COMMON_API LLMetricPerformanceTesterBasic -{ -public: - /** - * @brief Creates a basic tester instance. - * @param[in] name - Unique string identifying this tester instance. - */ - LLMetricPerformanceTesterBasic(std::string name); - virtual ~LLMetricPerformanceTesterBasic(); - - /** - * @return Returns true if the instance has been added to the tester map. - * Need to be tested after creation of a tester instance so to know if the tester is correctly handled. - * A tester might not be added to the map if another tester with the same name already exists. - */ - bool isValid() const { return mValidInstance; } - - /** - * @brief Write a set of test results to the log LLSD. - */ - void outputTestResults() ; - - /** - * @brief Compare the test results. - * By default, compares the test results against the baseline one by one, item by item, - * in the increasing order of the LLSD record counter, starting from the first one. - */ - virtual void analyzePerformance(llofstream* os, LLSD* base, LLSD* current) ; - - static void doAnalysisMetrics(std::string baseline, std::string target, std::string output) ; - - /** - * @return Returns the number of the test metrics in this tester instance. - */ - auto getNumberOfMetrics() const { return mMetricStrings.size() ;} - /** - * @return Returns the metric name at index - * @param[in] index - Index on the list of metrics managed by this tester instance. - */ - std::string getMetricName(size_t index) const { return mMetricStrings[index] ;} - -protected: - /** - * @return Returns the name of this tester instance. - */ - std::string getTesterName() const { return mName ;} - - /** - * @brief Insert a new metric to be managed by this tester instance. - * @param[in] str - Unique string identifying the new metric. - */ - void addMetric(std::string str) ; - - /** - * @brief Compare test results, provided in 2 flavors: compare integers and compare floats. - * @param[out] os - Formatted output string holding the compared values. - * @param[in] metric_string - Name of the metric. - * @param[in] v_base - Base value of the metric. - * @param[in] v_current - Current value of the metric. - */ - virtual void compareTestResults(llofstream* os, std::string metric_string, S32 v_base, S32 v_current) ; - virtual void compareTestResults(llofstream* os, std::string metric_string, F32 v_base, F32 v_current) ; - - /** - * @brief Reset internal record count. Count starts with 1. - */ - void resetCurrentCount() { mCount = 1; } - /** - * @brief Increment internal record count. - */ - void incrementCurrentCount() { mCount++; } - /** - * @return Returns the label to be used for the current count. It's "TesterName"-"Count". - */ - std::string getCurrentLabelName() const { return llformat("%s-%d", mName.c_str(), mCount) ;} - - /** - * @brief Write a test record to the LLSD. Implementers need to overload this method. - * @param[out] sd - The LLSD record to store metric data into. - */ - virtual void outputTestRecord(LLSD* sd) = 0 ; - -private: - void preOutputTestResults(LLSD* sd) ; - void postOutputTestResults(LLSD* sd) ; - static LLSD analyzeMetricPerformanceLog(std::istream& is) ; - - std::string mName ; // Name of this tester instance - S32 mCount ; // Current record count - bool mValidInstance; // true if the instance is managed by the map - std::vector< std::string > mMetricStrings ; // Metrics strings - -// Static members managing the collection of testers -public: - // Map of all the tester instances in use - typedef std::map< std::string, LLMetricPerformanceTesterBasic* > name_tester_map_t; - static name_tester_map_t sTesterMap ; - - /** - * @return Returns a pointer to the tester - * @param[in] name - Name of the tester instance queried. - */ - static LLMetricPerformanceTesterBasic* getTester(std::string name) ; - - /** - * @return Delete the named tester from the list - * @param[in] name - Name of the tester instance to delete. - */ - static void deleteTester(std::string name); - - /** - * @return Returns true if that metric *or* the default catch all metric has been requested to be logged - * @param[in] name - Name of the tester queried. - */ - static bool isMetricLogRequested(std::string name); - - /** - * @return Returns true if there's a tester defined, false otherwise. - */ - static bool hasMetricPerformanceTesters() { return !sTesterMap.empty() ;} - /** - * @brief Delete all testers and reset the tester map - */ - static void cleanupClass() ; - -private: - // Add a tester to the map. Returns false if adding fails. - static bool addTester(LLMetricPerformanceTesterBasic* tester) ; -}; - -/** - * @class LLMetricPerformanceTesterWithSession - * @brief Performance Metric Class with custom session - */ -class LL_COMMON_API LLMetricPerformanceTesterWithSession : public LLMetricPerformanceTesterBasic -{ -public: - /** - * @param[in] name - Unique string identifying this tester instance. - */ - LLMetricPerformanceTesterWithSession(std::string name); - virtual ~LLMetricPerformanceTesterWithSession(); - - /** - * @brief Compare the test results. - * This will be loading the base and current sessions and compare them using the virtual - * abstract methods loadTestSession() and compareTestSessions() - */ - virtual void analyzePerformance(llofstream* os, LLSD* base, LLSD* current) ; - -protected: - /** - * @class LLMetricPerformanceTesterWithSession::LLTestSession - * @brief Defines an interface for the two abstract virtual functions loadTestSession() and compareTestSessions() - */ - class LL_COMMON_API LLTestSession - { - public: - virtual ~LLTestSession() ; - }; - - /** - * @brief Convert an LLSD log into a test session. - * @param[in] log - The LLSD record - * @return Returns the record as a test session - */ - virtual LLMetricPerformanceTesterWithSession::LLTestSession* loadTestSession(LLSD* log) = 0; - - /** - * @brief Compare the base session and the target session. Assumes base and current sessions have been loaded. - * @param[out] os - The comparison result as a standard stream - */ - virtual void compareTestSessions(llofstream* os) = 0; - - LLTestSession* mBaseSessionp; - LLTestSession* mCurrentSessionp; -}; - -#endif - diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index 7c77d94475b..1b03ac66352 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -66,17 +66,15 @@ // See llprofiler_categories.h for more details on profiling categories. #define LL_PROFILER_CONFIG_NONE 0 // No profiling -#define LL_PROFILER_CONFIG_FAST_TIMER 1 // Profiling on: Only Fast Timers -#define LL_PROFILER_CONFIG_TRACY 2 // Profiling on: Only Tracy -#define LL_PROFILER_CONFIG_TRACY_FAST_TIMER 3 // Profiling on: Fast Timers + Tracy +#define LL_PROFILER_CONFIG_TRACY 1 // Profiling on: Only Tracy #ifndef LL_PROFILER_CONFIGURATION -#define LL_PROFILER_CONFIGURATION LL_PROFILER_CONFIG_FAST_TIMER +#define LL_PROFILER_CONFIGURATION LL_PROFILER_CONFIG_NONE #endif #if defined(LL_PROFILER_CONFIGURATION) && (LL_PROFILER_CONFIGURATION > LL_PROFILER_CONFIG_NONE) - #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY || LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER - #include "llpreprocessor.h" + #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY + #include "llpreprocessor.h" #if defined(LL_GNUC) && GCC_VERSION >= 130000 # pragma GCC diagnostic push @@ -84,19 +82,13 @@ #endif #include "tracy/Tracy.hpp" #if defined(LL_GNUC) && GCC_VERSION >= 130000 -# pragma GCC diagnostic push +# pragma GCC diagnostic pop #endif - // Enable RenderDoc labeling - //#define LL_PROFILER_ENABLE_RENDER_DOC 0 - - #endif - - #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY #define LL_PROFILER_FRAME_END FrameMark - #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ); - #define LL_RECORD_BLOCK_TIME(name) ZoneScoped // Want descriptive names; was: ZoneNamedN( ___tracy_scoped_zone, #name, true ); - #define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, name, true ); + #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ) + #define LL_RECORD_BLOCK_TIME(name) ZoneNamedN(___tracy_scoped_zone, name, true) + #define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, name, true ) #define LL_PROFILE_ZONE_NAMED_COLOR(name,color) ZoneNamedNC( ___tracy_scopped_zone, name, color, true ) // RGB #define LL_PROFILE_ZONE_SCOPED ZoneScoped @@ -113,52 +105,26 @@ #define LL_PROFILE_MUTEX_SHARED_NAMED(type, varname, desc) TracySharedLockableN(type, varname, desc) #define LL_PROFILE_MUTEX_LOCK(varname) { auto& mutex = varname; LockMark(mutex); } #endif - #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_FAST_TIMER - #define LL_PROFILER_FRAME_END - #define LL_PROFILER_SET_THREAD_NAME( name ) (void)(name) - #define LL_RECORD_BLOCK_TIME(name) const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); - #define LL_PROFILE_ZONE_NAMED(name) // LL_PROFILE_ZONE_NAMED is a no-op when Tracy is disabled - #define LL_PROFILE_ZONE_NAMED_COLOR(name,color) // LL_PROFILE_ZONE_NAMED_COLOR is a no-op when Tracy is disabled - #define LL_PROFILE_ZONE_SCOPED // LL_PROFILE_ZONE_SCOPED is a no-op when Tracy is disabled - #define LL_PROFILE_ZONE_COLOR(name,color) // LL_RECORD_BLOCK_TIME(name) - - #define LL_PROFILE_ZONE_NUM( val ) (void)( val ); // Not supported - #define LL_PROFILE_ZONE_TEXT( text, size ) (void)( text ); void( size ); // Not supported - - #define LL_PROFILE_ZONE_ERR(name) (void)(name); // Not supported - #define LL_PROFILE_ZONE_INFO(name) (void)(name); // Not supported - #define LL_PROFILE_ZONE_WARN(name) (void)(name); // Not supported - - #define LL_PROFILE_MUTEX(type, varname) type varname - #define LL_PROFILE_MUTEX_NAMED(type, varname, desc) type varname - #define LL_PROFILE_MUTEX_SHARED(type, varname) type varname - #define LL_PROFILE_MUTEX_SHARED_NAMED(type, varname, desc) type varname - #define LL_PROFILE_MUTEX_LOCK(varname) // LL_PROFILE_MUTEX_LOCK is a no-op when Tracy is disabled - #endif - #if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER - #define LL_PROFILER_FRAME_END FrameMark - #define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name ); - #define LL_RECORD_BLOCK_TIME(name) ZoneNamedN(___tracy_scoped_zone, #name, true); const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); - #define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, #name, true ); - #define LL_PROFILE_ZONE_NAMED_COLOR(name,color) ZoneNamedNC( ___tracy_scopped_zone, name, color, true ) // RGB - #define LL_PROFILE_ZONE_SCOPED ZoneScoped - - #define LL_PROFILE_ZONE_NUM( val ) ZoneValue( val ) - #define LL_PROFILE_ZONE_TEXT( text, size ) ZoneText( text, size ) - - #define LL_PROFILE_ZONE_ERR(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0XFF0000 ) // RGB yellow - #define LL_PROFILE_ZONE_INFO(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0X00FFFF ) // RGB cyan - #define LL_PROFILE_ZONE_WARN(name) LL_PROFILE_ZONE_NAMED_COLOR( name, 0x0FFFF00 ) // RGB red - - #define LL_PROFILE_MUTEX(type, varname) TracyLockable(type, varname) - #define LL_PROFILE_MUTEX_NAMED(type, varname, desc) TracyLockableN(type, varname, desc) - #define LL_PROFILE_MUTEX_SHARED(type, varname) TracySharedLockable(type, varname) - #define LL_PROFILE_MUTEX_SHARED_NAMED(type, varname, desc) TracySharedLockableN(type, varname, desc) - #define LL_PROFILE_MUTEX_LOCK(varname) { auto& mutex = varname; LockMark(mutex); } // see https://github.com/wolfpld/tracy/issues/575 - #endif #else #define LL_PROFILER_FRAME_END #define LL_PROFILER_SET_THREAD_NAME( name ) (void)(name) + + #define LL_PROFILE_ZONE_NAMED(name) + #define LL_PROFILE_ZONE_NAMED_COLOR(name, color) + #define LL_PROFILE_ZONE_SCOPED + + #define LL_PROFILE_ZONE_NUM(val) + #define LL_PROFILE_ZONE_TEXT(text, size) + + #define LL_PROFILE_ZONE_ERR(name) LL_PROFILE_ZONE_NAMED_COLOR(name, 0XFF0000) // RGB yellow + #define LL_PROFILE_ZONE_INFO(name) LL_PROFILE_ZONE_NAMED_COLOR(name, 0X00FFFF) // RGB cyan + #define LL_PROFILE_ZONE_WARN(name) LL_PROFILE_ZONE_NAMED_COLOR(name, 0x0FFFF00) // RGB red + + #define LL_PROFILE_MUTEX(type, varname) type varname + #define LL_PROFILE_MUTEX_NAMED(type, varname, desc) type varname + #define LL_PROFILE_MUTEX_SHARED(type, varname) type varname + #define LL_PROFILE_MUTEX_SHARED_NAMED(type, varname, desc) type varname + #define LL_PROFILE_MUTEX_LOCK(varname) // LL_PROFILE_MUTEX_LOCK is a no-op when Tracy is disabled #endif // LL_PROFILER #if LL_PROFILER_ENABLE_TRACY_OPENGL @@ -168,11 +134,11 @@ #define LL_PROFILER_GPU_CONTEXT TracyGpuContext #define LL_PROFILER_GPU_CONTEXT_NAMED TracyGpuContextName #else -#define LL_PROFILE_GPU_ZONE(name) (void)name; -#define LL_PROFILE_GPU_ZONEC(name,color) (void)name;(void)color; +#define LL_PROFILE_GPU_ZONE(name) (void)name +#define LL_PROFILE_GPU_ZONEC(name,color) (void)name;(void)color #define LL_PROFILER_GPU_COLLECT #define LL_PROFILER_GPU_CONTEXT -#define LL_PROFILER_GPU_CONTEXT_NAMED(name) (void)name; +#define LL_PROFILER_GPU_CONTEXT_NAMED(name) (void)name #endif // LL_PROFILER_ENABLE_TRACY_OPENGL #if LL_PROFILER_CONFIGURATION >= LL_PROFILER_CONFIG_TRACY diff --git a/indra/llcommon/llprofilercategories.h b/indra/llcommon/llprofilercategories.h index 1c4f0f5624d..695839c9cd0 100644 --- a/indra/llcommon/llprofilercategories.h +++ b/indra/llcommon/llprofilercategories.h @@ -126,6 +126,14 @@ #define LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE #endif +#if LL_PROFILER_CATEGORY_ENABLE_INVENTORY +#define LL_PROFILE_ZONE_NAMED_CATEGORY_INVENTORY LL_PROFILE_ZONE_NAMED +#define LL_PROFILE_ZONE_SCOPED_CATEGORY_INVENTORY LL_PROFILE_ZONE_SCOPED +#else +#define LL_PROFILE_ZONE_NAMED_CATEGORY_INVENTORY(name) +#define LL_PROFILE_ZONE_SCOPED_CATEGORY_INVENTORY +#endif + #if LL_PROFILER_CATEGORY_ENABLE_LLSD #define LL_PROFILE_ZONE_NAMED_CATEGORY_LLSD LL_PROFILE_ZONE_NAMED #define LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD LL_PROFILE_ZONE_SCOPED diff --git a/indra/llcommon/llsdparam.h b/indra/llcommon/llsdparam.h index 21ebb9a2587..6eba853e41e 100644 --- a/indra/llcommon/llsdparam.h +++ b/indra/llcommon/llsdparam.h @@ -30,7 +30,6 @@ #include "llinitparam.h" #include "boost/function.hpp" -#include "llfasttimer.h" struct LL_COMMON_API LLParamSDParserUtilities { diff --git a/indra/llcommon/llstreamqueue.cpp b/indra/llcommon/llstreamqueue.cpp deleted file mode 100644 index 981d9137498..00000000000 --- a/indra/llcommon/llstreamqueue.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @file llstreamqueue.cpp - * @author Nat Goodspeed - * @date 2012-01-05 - * @brief Implementation for llstreamqueue. - * - * $LicenseInfo:firstyear=2012&license=viewerlgpl$ - * Copyright (c) 2012, Linden Research, Inc. - * $/LicenseInfo$ - */ - -// Precompiled header -#include "linden_common.h" -// associated header -#include "llstreamqueue.h" -// STL headers -// std headers -// external library headers -// other Linden headers - -// As of this writing, llstreamqueue.h is entirely template-based, therefore -// we don't strictly need a corresponding .cpp file. However, our CMake test -// macro assumes one. Here it is. -bool llstreamqueue_cpp_ignored = true; diff --git a/indra/llcommon/llstreamqueue.h b/indra/llcommon/llstreamqueue.h deleted file mode 100644 index 01689457dd3..00000000000 --- a/indra/llcommon/llstreamqueue.h +++ /dev/null @@ -1,240 +0,0 @@ -/** - * @file llstreamqueue.h - * @author Nat Goodspeed - * @date 2012-01-04 - * @brief Definition of LLStreamQueue - * - * $LicenseInfo:firstyear=2012&license=viewerlgpl$ - * Copyright (c) 2012, Linden Research, Inc. - * $/LicenseInfo$ - */ - -#if ! defined(LL_LLSTREAMQUEUE_H) -#define LL_LLSTREAMQUEUE_H - -#include -#include -#include // std::streamsize -#include - -/** - * This class is a growable buffer between a producer and consumer. It serves - * as a queue usable with Boost.Iostreams -- hence, a "stream queue." - * - * This is especially useful for buffering nonblocking I/O. For instance, we - * want application logic to be able to serialize LLSD to a std::ostream. We - * may write more data than the destination pipe can handle all at once, but - * it's imperative NOT to block the application-level serialization call. So - * we buffer it instead. Successive frames can try nonblocking writes to the - * destination pipe until all buffered data has been sent. - * - * Similarly, we want application logic be able to deserialize LLSD from a - * std::istream. Again, we must not block that deserialize call waiting for - * more data to arrive from the input pipe! Instead we build up a buffer over - * a number of frames, using successive nonblocking reads, until we have - * "enough" data to be able to present it through a std::istream. - * - * @note The use cases for this class overlap somewhat with those for the - * LLIOPipe/LLPumpIO hierarchies, and indeed we considered using those. This - * class has two virtues over the older machinery: - * - * # It's vastly simpler -- way fewer concepts. It's not clear to me whether - * there were ever LLIOPipe/etc. use cases that demanded all the fanciness - * rolled in, or whether they were simply overdesigned. In any case, no - * remaining Lindens will admit to familiarity with those classes -- and - * they're sufficiently obtuse that it would take considerable learning - * curve to figure out how to use them properly. The bottom line is that - * current management is not keen on any more engineers climbing that curve. - * # This class is designed around available components such as std::string, - * std::list, Boost.Iostreams. There's less proprietary code. - */ -template -class LLGenericStreamQueue -{ -public: - LLGenericStreamQueue(): - mSize(0), - mClosed(false) - {} - - /** - * Boost.Iostreams Source Device facade for use with other Boost.Iostreams - * functionality. LLGenericStreamQueue doesn't quite fit any of the Boost - * 1.48 Iostreams concepts; instead it behaves as both a Sink and a - * Source. This is its Source facade. - */ - struct Source - { - typedef Ch char_type; - typedef boost::iostreams::source_tag category; - - /// Bind the underlying LLGenericStreamQueue - Source(LLGenericStreamQueue& sq): - mStreamQueue(sq) - {} - - // Read up to n characters from the underlying data source into the - // buffer s, returning the number of characters read; return -1 to - // indicate EOF - std::streamsize read(Ch* s, std::streamsize n) - { - return mStreamQueue.read(s, n); - } - - LLGenericStreamQueue& mStreamQueue; - }; - - /** - * Boost.Iostreams Sink Device facade for use with other Boost.Iostreams - * functionality. LLGenericStreamQueue doesn't quite fit any of the Boost - * 1.48 Iostreams concepts; instead it behaves as both a Sink and a - * Source. This is its Sink facade. - */ - struct Sink - { - typedef Ch char_type; - typedef boost::iostreams::sink_tag category; - - /// Bind the underlying LLGenericStreamQueue - Sink(LLGenericStreamQueue& sq): - mStreamQueue(sq) - {} - - /// Write up to n characters from the buffer s to the output sequence, - /// returning the number of characters written - std::streamsize write(const Ch* s, std::streamsize n) - { - return mStreamQueue.write(s, n); - } - - /// Send EOF to consumer - void close() - { - mStreamQueue.close(); - } - - LLGenericStreamQueue& mStreamQueue; - }; - - /// Present Boost.Iostreams Source facade - Source asSource() { return Source(*this); } - /// Present Boost.Iostreams Sink facade - Sink asSink() { return Sink(*this); } - - /// append data to buffer - std::streamsize write(const Ch* s, std::streamsize n) - { - // Unclear how often we might be asked to write 0 bytes -- perhaps a - // naive caller responding to an unready nonblocking read. But if we - // do get such a call, don't add a completely empty BufferList entry. - if (n == 0) - return n; - // We could implement this using a single std::string object, a la - // ostringstream. But the trouble with appending to a string is that - // you might have to recopy all previous contents to grow its size. If - // we want this to scale to large data volumes, better to allocate - // individual pieces. - mBuffer.push_back(string(s, n)); - mSize += n; - return n; - } - - /** - * Inform this LLGenericStreamQueue that no further data are forthcoming. - * For our purposes, close() is strictly a producer-side operation; - * there's little point in closing the consumer side. - */ - void close() - { - mClosed = true; - } - - /// consume data from buffer - std::streamsize read(Ch* s, std::streamsize n) - { - // read() is actually a convenience method for peek() followed by - // skip(). - std::streamsize got(peek(s, n)); - // We can only skip() as many characters as we can peek(); ignore - // skip() return here. - skip(n); - return got; - } - - /// Retrieve data from buffer without consuming. Like read(), return -1 on - /// EOF. - std::streamsize peek(Ch* s, std::streamsize n) const; - - /// Consume data from buffer without retrieving. Unlike read() and peek(), - /// at EOF we simply skip 0 characters. - std::streamsize skip(std::streamsize n); - - /// How many characters do we currently have buffered? - std::streamsize size() const - { - return mSize; - } - -private: - typedef std::basic_string string; - typedef std::list BufferList; - BufferList mBuffer; - std::streamsize mSize; - bool mClosed; -}; - -template -std::streamsize LLGenericStreamQueue::peek(Ch* s, std::streamsize n) const -{ - // Here we may have to build up 'n' characters from an arbitrary - // number of individual BufferList entries. - typename BufferList::const_iterator bli(mBuffer.begin()), blend(mBuffer.end()); - // Indicate EOF if producer has closed the pipe AND we've exhausted - // all previously-buffered data. - if (mClosed && bli == blend) - { - return -1; - } - // Here either producer hasn't yet closed, or we haven't yet exhausted - // remaining data. - std::streamsize needed(n), got(0); - // Loop until either we run out of BufferList entries or we've - // completely satisfied the request. - for ( ; bli != blend && needed; ++bli) - { - std::streamsize chunk(std::min(needed, std::streamsize(bli->length()))); - std::copy(bli->begin(), bli->begin() + chunk, s); - needed -= chunk; - s += chunk; - got += chunk; - } - return got; -} - -template -std::streamsize LLGenericStreamQueue::skip(std::streamsize n) -{ - typename BufferList::iterator bli(mBuffer.begin()), blend(mBuffer.end()); - std::streamsize toskip(n), skipped(0); - while (bli != blend && (size_t)toskip >= bli->length()) - { - std::streamsize chunk(bli->length()); - typename BufferList::iterator zap(bli++); - mBuffer.erase(zap); - mSize -= chunk; - toskip -= chunk; - skipped += chunk; - } - if (bli != blend && toskip) - { - bli->erase(bli->begin(), bli->begin() + toskip); - mSize -= toskip; - skipped += toskip; - } - return skipped; -} - -typedef LLGenericStreamQueue LLStreamQueue; -typedef LLGenericStreamQueue LLWStreamQueue; - -#endif /* ! defined(LL_LLSTREAMQUEUE_H) */ diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 07adf71d18f..b698251cf27 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -28,7 +28,6 @@ #include "llstring.h" #include "llerror.h" -#include "llfasttimer.h" #include "llsd.h" #include diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index e3335ca4aaa..b4339dc5ebb 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -54,7 +54,6 @@ #include #include #include -#include "llfasttimer.h" using namespace llsd; diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index f36d2231005..06e5566863f 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -334,6 +334,7 @@ LLTimer::~LLTimer() // static void LLTimer::initClass() { + get_clock_count(); // good place to calculate clock frequency if (!sTimer) sTimer = new LLTimer; } diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp index 440529b8e88..ef1fb69c4d3 100644 --- a/indra/llcommon/lltrace.cpp +++ b/indra/llcommon/lltrace.cpp @@ -28,7 +28,6 @@ #include "lltrace.h" #include "lltracerecording.h" #include "lltracethreadrecorder.h" -#include "llfasttimer.h" namespace LLTrace { @@ -50,36 +49,4 @@ const char* StatBase::getUnitLabel() const return ""; } -TimeBlockTreeNode::TimeBlockTreeNode() -: mBlock(NULL), - mParent(NULL), - mNeedsSorting(false), - mCollapsed(true) -{} - -void TimeBlockTreeNode::setParent( BlockTimerStatHandle* parent ) -{ - LL_PROFILE_ZONE_SCOPED; - llassert_always(parent != mBlock); - llassert_always(parent != NULL); - - TimeBlockTreeNode* parent_tree_node = get_thread_recorder()->getTimeBlockTreeNode(narrow(parent->getIndex())); - if (!parent_tree_node) return; - - if (mParent) - { - std::vector& children = mParent->getChildren(); - std::vector::iterator found_it = std::find(children.begin(), children.end(), mBlock); - if (found_it != children.end()) - { - children.erase(found_it); - } - } - - mParent = parent; - mBlock->getCurrentAccumulator().mParent = parent; - parent_tree_node->mChildren.push_back(mBlock); - parent_tree_node->mNeedsSorting = true; -} - } diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index edb010b0a4d..a7b1c3c9669 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -94,29 +94,6 @@ class StatType const size_t mAccumulatorIndex; }; - -template<> -class StatType -: public StatType -{ -public: - - StatType(const char* name, const char* description = "") - : StatType(name, description) - {} -}; - -template<> -class StatType - : public StatType -{ -public: - - StatType(const char* name, const char* description = "") - : StatType(name, description) - {} -}; - template class EventStatHandle : public StatType @@ -193,92 +170,6 @@ void add(CountStatHandle& count, VALUE_T value) #endif } -// measures effective memory footprint of specified type -// specialize to cover different types -template -struct MeasureMem -{ - static size_t measureFootprint(const T& value) - { - return sizeof(T); - } -}; - -template -struct MeasureMem -{ - static size_t measureFootprint(const T& value) - { - LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; - return sizeof(T) + value.getMemFootprint(); - } -}; - -template -struct MeasureMem -{ - static size_t measureFootprint(const T& value) - { - LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; - return U32Bytes(value).value(); - } -}; - -template -struct MeasureMem -{ - static size_t measureFootprint(const T* value) - { - LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; - if (!value) - { - return 0; - } - return MeasureMem::measureFootprint(*value); - } -}; - -template -struct MeasureMem, IS_MEM_TRACKABLE, IS_BYTES> -{ - static size_t measureFootprint(const LLPointer value) - { - if (value.isNull()) - { - return 0; - } - return MeasureMem::measureFootprint(*value); - } -}; - -template -struct MeasureMem -{ - static size_t measureFootprint(S32 value) - { - return value; - } -}; - -template -struct MeasureMem -{ - static size_t measureFootprint(U32 value) - { - return value; - } -}; - -template -struct MeasureMem, IS_MEM_TRACKABLE, IS_BYTES> -{ - static size_t measureFootprint(const std::basic_string& value) - { - LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; - return value.capacity() * sizeof(T); - } -}; - } #endif // LL_LLTRACE_H diff --git a/indra/llcommon/lltraceaccumulators.cpp b/indra/llcommon/lltraceaccumulators.cpp index dc9a87eb805..5af7ba54330 100644 --- a/indra/llcommon/lltraceaccumulators.cpp +++ b/indra/llcommon/lltraceaccumulators.cpp @@ -44,8 +44,7 @@ AccumulatorBufferGroup::AccumulatorBufferGroup() AccumulatorBufferGroup::AccumulatorBufferGroup(const AccumulatorBufferGroup& other) : mCounts(other.mCounts), mSamples(other.mSamples), - mEvents(other.mEvents), - mStackTimers(other.mStackTimers) + mEvents(other.mEvents) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; } @@ -61,7 +60,6 @@ void AccumulatorBufferGroup::handOffTo(AccumulatorBufferGroup& other) other.mCounts.reset(&mCounts); other.mSamples.reset(&mSamples); other.mEvents.reset(&mEvents); - other.mStackTimers.reset(&mStackTimers); } void AccumulatorBufferGroup::makeCurrent() @@ -70,19 +68,6 @@ void AccumulatorBufferGroup::makeCurrent() mCounts.makeCurrent(); mSamples.makeCurrent(); mEvents.makeCurrent(); - mStackTimers.makeCurrent(); - - ThreadRecorder* thread_recorder = get_thread_recorder(); - AccumulatorBuffer& timer_accumulator_buffer = mStackTimers; - // update stacktimer parent pointers - for (size_t i = 0, end_i = mStackTimers.size(); i < end_i; i++) - { - TimeBlockTreeNode* tree_node = thread_recorder->getTimeBlockTreeNode(narrow(i)); - if (tree_node) - { - timer_accumulator_buffer[i].mParent = tree_node->mParent; - } - } } //static @@ -92,7 +77,6 @@ void AccumulatorBufferGroup::clearCurrent() AccumulatorBuffer::clearCurrent(); AccumulatorBuffer::clearCurrent(); AccumulatorBuffer::clearCurrent(); - AccumulatorBuffer::clearCurrent(); } bool AccumulatorBufferGroup::isCurrent() const @@ -106,7 +90,6 @@ void AccumulatorBufferGroup::append(const AccumulatorBufferGroup& other) mCounts.addSamples(other.mCounts, SEQUENTIAL); mSamples.addSamples(other.mSamples, SEQUENTIAL); mEvents.addSamples(other.mEvents, SEQUENTIAL); - mStackTimers.addSamples(other.mStackTimers, SEQUENTIAL); } void AccumulatorBufferGroup::merge(const AccumulatorBufferGroup& other) @@ -125,7 +108,6 @@ void AccumulatorBufferGroup::reset(AccumulatorBufferGroup* other) mCounts.reset(other ? &other->mCounts : NULL); mSamples.reset(other ? &other->mSamples : NULL); mEvents.reset(other ? &other->mEvents : NULL); - mStackTimers.reset(other ? &other->mStackTimers : NULL); } void AccumulatorBufferGroup::sync() diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 0a2e2bf997a..84b64c8d485 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -454,79 +454,6 @@ namespace LLTrace S32 mNumSamples; }; - class alignas(32) TimeBlockAccumulator - { - public: - typedef F64Seconds value_t; - static F64Seconds getDefaultValue() { return F64Seconds(0); } - - typedef TimeBlockAccumulator self_t; - - // fake classes that allows us to view different facets of underlying statistic - struct CallCountFacet - { - typedef S32 value_t; - }; - - struct SelfTimeFacet - { - typedef F64Seconds value_t; - }; - - // arrays are allocated with 32 byte alignment - void *operator new [](size_t size) - { - return ll_aligned_malloc<32>(size); - } - - void operator delete[](void* ptr, size_t size) - { - ll_aligned_free<32>(ptr); - } - - TimeBlockAccumulator(); - void addSamples(const self_t& other, EBufferAppendType append_type); - void reset(const self_t* other); - void sync(F64SecondsImplicit) {} - bool hasValue() const { return true; } - - // - // members - // - U64 mTotalTimeCounter, - mSelfTimeCounter; - S32 mCalls; - class BlockTimerStatHandle* mParent; // last acknowledged parent of this time block - class BlockTimerStatHandle* mLastCaller; // used to bootstrap tree construction - U16 mActiveCount; // number of timers with this ID active on stack - bool mMoveUpTree; // needs to be moved up the tree of timers at the end of frame - - }; - - class BlockTimerStatHandle; - - class TimeBlockTreeNode - { - public: - TimeBlockTreeNode(); - - void setParent(BlockTimerStatHandle* parent); - BlockTimerStatHandle* getParent() { return mParent; } - - BlockTimerStatHandle* mBlock; - BlockTimerStatHandle* mParent; - std::vector mChildren; - bool mCollapsed; - bool mNeedsSorting; - }; - - struct BlockTimerStackRecord - { - class BlockTimer* mActiveTimer{ nullptr }; - class BlockTimerStatHandle* mTimeBlock{ nullptr }; - U64 mChildTime{ 0 }; - }; - struct AccumulatorBufferGroup : public LLRefCount { AccumulatorBufferGroup(); @@ -546,7 +473,6 @@ namespace LLTrace AccumulatorBuffer mCounts; AccumulatorBuffer mSamples; AccumulatorBuffer mEvents; - AccumulatorBuffer mStackTimers; }; } diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index f010f0e9615..9047c96b303 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -28,7 +28,6 @@ #include "lltracerecording.h" #include "lltrace.h" -#include "llfasttimer.h" #include "lltracethreadrecorder.h" #include "llthread.h" @@ -166,67 +165,6 @@ void Recording::appendRecording( Recording& other ) #endif } -bool Recording::hasValue(const StatType& stat) -{ - update(); - const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; - return accumulator.hasValue() || (active_accumulator && active_accumulator->hasValue()); -} - -F64Seconds Recording::getSum(const StatType& stat) -{ - update(); - const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; - return F64Seconds((F64)(accumulator.mTotalTimeCounter) + (F64)(active_accumulator ? active_accumulator->mTotalTimeCounter : 0)) - / (F64)LLTrace::BlockTimer::countsPerSecond(); -} - -F64Seconds Recording::getSum(const StatType& stat) -{ - update(); - const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; - return F64Seconds(((F64)(accumulator.mSelfTimeCounter) + (F64)(active_accumulator ? active_accumulator->mSelfTimeCounter : 0)) / (F64)LLTrace::BlockTimer::countsPerSecond()); -} - -S32 Recording::getSum(const StatType& stat) -{ - update(); - const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; - return accumulator.mCalls + (active_accumulator ? active_accumulator->mCalls : 0); -} - -F64Seconds Recording::getPerSec(const StatType& stat) -{ - update(); - const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; - - return F64Seconds((F64)(accumulator.mTotalTimeCounter + (active_accumulator ? active_accumulator->mTotalTimeCounter : 0)) - / ((F64)LLTrace::BlockTimer::countsPerSecond() * mElapsedSeconds.value())); -} - -F64Seconds Recording::getPerSec(const StatType& stat) -{ - update(); - const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; - - return F64Seconds((F64)(accumulator.mSelfTimeCounter + (active_accumulator ? active_accumulator->mSelfTimeCounter : 0)) - / ((F64)LLTrace::BlockTimer::countsPerSecond() * mElapsedSeconds.value())); -} - -F32 Recording::getPerSec(const StatType& stat) -{ - update(); - const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; - return (F32)(accumulator.mCalls + (active_accumulator ? active_accumulator->mCalls : 0)) / (F32)mElapsedSeconds.value(); -} - bool Recording::hasValue(const StatType& stat) { update(); diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index ad4c91d85be..6f96b62a744 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -174,16 +174,6 @@ namespace LLTrace // ensure that buffers are exclusively owned by this recording void makeUnique() { mBuffers.makeUnique(); } - // Timer accessors - bool hasValue(const StatType& stat); - F64Seconds getSum(const StatType& stat); - F64Seconds getSum(const StatType& stat); - S32 getSum(const StatType& stat); - - F64Seconds getPerSec(const StatType& stat); - F64Seconds getPerSec(const StatType& stat); - F32 getPerSec(const StatType& stat); - // CountStatHandle accessors bool hasValue(const StatType& stat); F64 getSum(const StatType& stat); diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp index 375cb050cc7..8f05f4496d4 100644 --- a/indra/llcommon/lltracethreadrecorder.cpp +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -26,7 +26,6 @@ #include "linden_common.h" #include "lltracethreadrecorder.h" -#include "llfasttimer.h" #include "lltrace.h" #include "llstl.h" @@ -49,45 +48,12 @@ ThreadRecorder::ThreadRecorder() void ThreadRecorder::init() { #if LL_TRACE_ENABLED - LLThreadLocalSingletonPointer::setInstance(&mBlockTimerStackRecord); //NB: the ordering of initialization in this function is very fragile due to a large number of implicit dependencies set_thread_recorder(this); - BlockTimerStatHandle& root_time_block = BlockTimer::getRootTimeBlock(); - - BlockTimerStackRecord* timer_stack = LLThreadLocalSingletonPointer::getInstance(); - timer_stack->mTimeBlock = &root_time_block; - timer_stack->mActiveTimer = NULL; - - mNumTimeBlockTreeNodes = AccumulatorBuffer::getDefaultBuffer()->size(); - - mTimeBlockTreeNodes = new TimeBlockTreeNode[mNumTimeBlockTreeNodes]; - activate(&mThreadRecordingBuffers); - - // initialize time block parent pointers - for (auto& base : BlockTimerStatHandle::instance_snapshot()) - { - // because of indirect derivation from LLInstanceTracker, have to downcast - BlockTimerStatHandle& time_block = static_cast(base); - TimeBlockTreeNode& tree_node = mTimeBlockTreeNodes[time_block.getIndex()]; - tree_node.mBlock = &time_block; - tree_node.mParent = &root_time_block; - - time_block.getCurrentAccumulator().mParent = &root_time_block; - } - - mRootTimer = new BlockTimer(root_time_block); - timer_stack->mActiveTimer = mRootTimer; - - BlockTimer::getRootTimeBlock().getCurrentAccumulator().mActiveCount = 1; - - //claim_alloc(gTraceMemStat, this); - //claim_alloc(gTraceMemStat, mRootTimer); - //claim_alloc(gTraceMemStat, sizeof(TimeBlockTreeNode) * mNumTimeBlockTreeNodes); #endif } - ThreadRecorder::ThreadRecorder( ThreadRecorder& parent ) : mParentRecorder(&parent) { @@ -95,28 +61,18 @@ ThreadRecorder::ThreadRecorder( ThreadRecorder& parent ) mParentRecorder->addChildRecorder(this); } - ThreadRecorder::~ThreadRecorder() { #if LL_TRACE_ENABLED - LLThreadLocalSingletonPointer::setInstance(NULL); - - //disclaim_alloc(gTraceMemStat, this); - //disclaim_alloc(gTraceMemStat, sizeof(BlockTimer)); - //disclaim_alloc(gTraceMemStat, sizeof(TimeBlockTreeNode) * mNumTimeBlockTreeNodes); - deactivate(&mThreadRecordingBuffers); - delete mRootTimer; - if (!mActiveRecordings.empty()) { std::for_each(mActiveRecordings.begin(), mActiveRecordings.end(), DeletePointer()); mActiveRecordings.clear(); } - set_thread_recorder(NULL); - delete[] mTimeBlockTreeNodes; + set_thread_recorder(nullptr); if (mParentRecorder) { @@ -125,17 +81,6 @@ ThreadRecorder::~ThreadRecorder() #endif } -TimeBlockTreeNode* ThreadRecorder::getTimeBlockTreeNode( size_t index ) -{ -#if LL_TRACE_ENABLED - if (0 <= index && index < mNumTimeBlockTreeNodes) - { - return &mTimeBlockTreeNodes[index]; - } -#endif - return NULL; -} - AccumulatorBufferGroup* ThreadRecorder::activate( AccumulatorBufferGroup* recording) { #if LL_TRACE_ENABLED @@ -144,7 +89,6 @@ AccumulatorBufferGroup* ThreadRecorder::activate( AccumulatorBufferGroup* record { AccumulatorBufferGroup& prev_active_recording = mActiveRecordings.back()->mPartialRecording; prev_active_recording.sync(); - BlockTimer::updateTimes(); prev_active_recording.handOffTo(active_recording->mPartialRecording); } mActiveRecordings.push_back(active_recording); @@ -163,7 +107,6 @@ ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::bringUpToDate( return mActiveRecordings.end(); mActiveRecordings.back()->mPartialRecording.sync(); - BlockTimer::updateTimes(); active_recording_list_t::reverse_iterator it, end_it; for (it = mActiveRecordings.rbegin(), end_it = mActiveRecordings.rend(); diff --git a/indra/llcommon/lltracethreadrecorder.h b/indra/llcommon/lltracethreadrecorder.h index e3eadfb0bd2..a137099a1b8 100644 --- a/indra/llcommon/lltracethreadrecorder.h +++ b/indra/llcommon/lltracethreadrecorder.h @@ -57,8 +57,6 @@ namespace LLTrace void pullFromChildren(); void pushToParent(); - TimeBlockTreeNode* getTimeBlockTreeNode(size_t index); - protected: void init(); @@ -74,16 +72,11 @@ namespace LLTrace }; AccumulatorBufferGroup mThreadRecordingBuffers; - - BlockTimerStackRecord mBlockTimerStackRecord; active_recording_list_t mActiveRecordings; - class BlockTimer* mRootTimer; - TimeBlockTreeNode* mTimeBlockTreeNodes; - size_t mNumTimeBlockTreeNodes; typedef std::list child_thread_recorder_list_t; - child_thread_recorder_list_t mChildThreadRecorders; // list of child thread recorders associated with this master + LLMutex mChildListMutex; // protects access to child list LLMutex mSharedRecordingMutex; AccumulatorBufferGroup mSharedRecordingBuffers; diff --git a/indra/llcommon/tests/llstreamqueue_test.cpp b/indra/llcommon/tests/llstreamqueue_test.cpp deleted file mode 100644 index 82b451119ed..00000000000 --- a/indra/llcommon/tests/llstreamqueue_test.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/** - * @file llstreamqueue_test.cpp - * @author Nat Goodspeed - * @date 2012-01-05 - * @brief Test for llstreamqueue. - * - * $LicenseInfo:firstyear=2012&license=viewerlgpl$ - * Copyright (c) 2012, Linden Research, Inc. - * $/LicenseInfo$ - */ - -// Precompiled header -#include "linden_common.h" -// associated header -#include "llstreamqueue.h" -// STL headers -#include -// other Linden headers -#include "../test/lltut.h" -#include "stringize.h" - -/***************************************************************************** -* TUT -*****************************************************************************/ -namespace tut -{ - struct llstreamqueue_data - { - llstreamqueue_data(): - // we want a buffer with actual bytes in it, not an empty vector - buffer(10) - {} - // As LLStreamQueue is merely a typedef for - // LLGenericStreamQueue, and no logic in LLGenericStreamQueue is - // specific to the instantiation, we're comfortable for now - // testing only the narrow-char version. - LLStreamQueue strq; - // buffer for use in multiple tests - std::vector buffer; - }; - typedef test_group llstreamqueue_group; - typedef llstreamqueue_group::object object; - llstreamqueue_group llstreamqueuegrp("llstreamqueue"); - - template<> template<> - void object::test<1>() - { - set_test_name("empty LLStreamQueue"); - ensure_equals("brand-new LLStreamQueue isn't empty", - strq.size(), 0); - ensure_equals("brand-new LLStreamQueue returns data", - strq.asSource().read(&buffer[0], buffer.size()), 0); - strq.asSink().close(); - ensure_equals("closed empty LLStreamQueue not at EOF", - strq.asSource().read(&buffer[0], buffer.size()), -1); - } - - template<> template<> - void object::test<2>() - { - set_test_name("one internal block, one buffer"); - LLStreamQueue::Sink sink(strq.asSink()); - ensure_equals("write(\"\")", sink.write("", 0), 0); - ensure_equals("0 write should leave LLStreamQueue empty (size())", - strq.size(), 0); - ensure_equals("0 write should leave LLStreamQueue empty (peek())", - strq.peek(&buffer[0], buffer.size()), 0); - // The meaning of "atomic" is that it must be smaller than our buffer. - std::string atomic("atomic"); - ensure("test data exceeds buffer", atomic.length() < buffer.size()); - ensure_equals(STRINGIZE("write(\"" << atomic << "\")"), - sink.write(&atomic[0], atomic.length()), atomic.length()); - ensure_equals("size() after write()", strq.size(), atomic.length()); - size_t peeklen(strq.peek(&buffer[0], buffer.size())); - ensure_equals(STRINGIZE("peek(\"" << atomic << "\")"), - peeklen, atomic.length()); - ensure_equals(STRINGIZE("peek(\"" << atomic << "\") result"), - std::string(buffer.begin(), buffer.begin() + peeklen), atomic); - ensure_equals("size() after peek()", strq.size(), atomic.length()); - // peek() should not consume. Use a different buffer to prove it isn't - // just leftover data from the first peek(). - std::vector again(buffer.size()); - peeklen = size_t(strq.peek(&again[0], again.size())); - ensure_equals(STRINGIZE("peek(\"" << atomic << "\") again"), - peeklen, atomic.length()); - ensure_equals(STRINGIZE("peek(\"" << atomic << "\") again result"), - std::string(again.begin(), again.begin() + peeklen), atomic); - // now consume. - std::vector third(buffer.size()); - size_t readlen(strq.read(&third[0], third.size())); - ensure_equals(STRINGIZE("read(\"" << atomic << "\")"), - readlen, atomic.length()); - ensure_equals(STRINGIZE("read(\"" << atomic << "\") result"), - std::string(third.begin(), third.begin() + readlen), atomic); - ensure_equals("peek() after read()", strq.peek(&buffer[0], buffer.size()), 0); - ensure_equals("size() after read()", strq.size(), 0); - } - - template<> template<> - void object::test<3>() - { - set_test_name("basic skip()"); - std::string lovecraft("lovecraft"); - ensure("test data exceeds buffer", lovecraft.length() < buffer.size()); - ensure_equals(STRINGIZE("write(\"" << lovecraft << "\")"), - strq.write(&lovecraft[0], lovecraft.length()), lovecraft.length()); - size_t peeklen(strq.peek(&buffer[0], buffer.size())); - ensure_equals(STRINGIZE("peek(\"" << lovecraft << "\")"), - peeklen, lovecraft.length()); - ensure_equals(STRINGIZE("peek(\"" << lovecraft << "\") result"), - std::string(buffer.begin(), buffer.begin() + peeklen), lovecraft); - std::streamsize skip1(4); - ensure_equals(STRINGIZE("skip(" << skip1 << ")"), strq.skip(skip1), skip1); - ensure_equals("size() after skip()", strq.size(), lovecraft.length() - skip1); - size_t readlen(strq.read(&buffer[0], buffer.size())); - ensure_equals(STRINGIZE("read(\"" << lovecraft.substr(skip1) << "\")"), - readlen, lovecraft.length() - skip1); - ensure_equals(STRINGIZE("read(\"" << lovecraft.substr(skip1) << "\") result"), - std::string(buffer.begin(), buffer.begin() + readlen), - lovecraft.substr(skip1)); - ensure_equals("unconsumed", strq.read(&buffer[0], buffer.size()), 0); - } - - template<> template<> - void object::test<4>() - { - set_test_name("skip() multiple blocks"); - std::string blocks[] = { "books of ", "H.P. ", "Lovecraft" }; - std::streamsize total(blocks[0].length() + blocks[1].length() + blocks[2].length()); - std::streamsize leave(5); // len("craft") above - std::streamsize skip(total - leave); - std::streamsize written(0); - for (const std::string& block : blocks) - { - written += strq.write(&block[0], block.length()); - ensure_equals("size() after write()", strq.size(), written); - } - std::streamsize skiplen(strq.skip(skip)); - ensure_equals(STRINGIZE("skip(" << skip << ")"), skiplen, skip); - ensure_equals("size() after skip()", strq.size(), leave); - size_t readlen(strq.read(&buffer[0], buffer.size())); - ensure_equals("read(\"craft\")", readlen, leave); - ensure_equals("read(\"craft\") result", - std::string(buffer.begin(), buffer.begin() + readlen), "craft"); - } - - template<> template<> - void object::test<5>() - { - set_test_name("concatenate blocks"); - std::string blocks[] = { "abcd", "efghij", "klmnopqrs" }; - for (const std::string& block : blocks) - { - strq.write(&block[0], block.length()); - } - std::vector longbuffer(30); - std::streamsize readlen(strq.read(&longbuffer[0], longbuffer.size())); - ensure_equals("read() multiple blocks", - readlen, blocks[0].length() + blocks[1].length() + blocks[2].length()); - ensure_equals("read() multiple blocks result", - std::string(longbuffer.begin(), longbuffer.begin() + readlen), - blocks[0] + blocks[1] + blocks[2]); - } - - template<> template<> - void object::test<6>() - { - set_test_name("split blocks"); - std::string blocks[] = { "abcdefghijklm", "nopqrstuvwxyz" }; - for (const std::string& block : blocks) - { - strq.write(&block[0], block.length()); - } - strq.close(); - // We've already verified what strq.size() should be at this point; - // see above test named "skip() multiple blocks" - std::streamsize chksize(strq.size()); - std::streamsize readlen(strq.read(&buffer[0], buffer.size())); - ensure_equals("read() 0", readlen, buffer.size()); - ensure_equals("read() 0 result", std::string(buffer.begin(), buffer.end()), "abcdefghij"); - chksize -= readlen; - ensure_equals("size() after read() 0", strq.size(), chksize); - readlen = strq.read(&buffer[0], buffer.size()); - ensure_equals("read() 1", readlen, buffer.size()); - ensure_equals("read() 1 result", std::string(buffer.begin(), buffer.end()), "klmnopqrst"); - chksize -= readlen; - ensure_equals("size() after read() 1", strq.size(), chksize); - readlen = strq.read(&buffer[0], buffer.size()); - ensure_equals("read() 2", readlen, chksize); - ensure_equals("read() 2 result", - std::string(buffer.begin(), buffer.begin() + readlen), "uvwxyz"); - ensure_equals("read() 3", strq.read(&buffer[0], buffer.size()), -1); - } -} // namespace tut diff --git a/indra/llcommon/timer.h b/indra/llcommon/timer.h deleted file mode 100644 index aaa0cf0775f..00000000000 --- a/indra/llcommon/timer.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @file timer.h - * @brief Legacy wrapper header. - * - * $LicenseInfo:firstyear=2000&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#include "lltimer.h" diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp index 541266af4f6..502e3d6b7f4 100644 --- a/indra/llfilesystem/llfilesystem.cpp +++ b/indra/llfilesystem/llfilesystem.cpp @@ -31,7 +31,6 @@ #include "lldir.h" #include "llfilesystem.h" -#include "llfasttimer.h" #include "lldiskcache.h" #include "boost/filesystem.hpp" @@ -41,8 +40,6 @@ constexpr S32 LLFileSystem::WRITE = 0x00000002; constexpr S32 LLFileSystem::READ_WRITE = 0x00000003; // LLFileSystem::READ & LLFileSystem::WRITE constexpr S32 LLFileSystem::APPEND = 0x00000006; // 0x00000004 & LLFileSystem::WRITE -static LLTrace::BlockTimerStatHandle FTM_VFILE_WAIT("VFile Wait"); - LLFileSystem::LLFileSystem(const LLUUID& file_id, const LLAssetType::EType file_type, S32 mode) { mFileType = file_type; diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 5a941dc958c..8704afd7689 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -38,10 +38,6 @@ // linked. LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl(); -// Test data gathering handle -LLImageCompressionTester* LLImageJ2C::sTesterp = NULL ; -const std::string sTesterName("ImageCompressionTester"); - //static std::string LLImageJ2C::getEngineInfo() { @@ -65,17 +61,6 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C), { // Array size is MAX_DISCARD_LEVEL+1 mDataSizes[i] = 0; } - - // If that test log has ben requested but not yet created, create it - if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName)) - { - sTesterp = new LLImageCompressionTester() ; - if (!sTesterp->isValid()) - { - delete sTesterp; - sTesterp = NULL; - } - } } // virtual @@ -206,21 +191,6 @@ bool LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir LLImage::setLastError(mLastError); } - LLImageCompressionTester* tester = (LLImageCompressionTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); - if (tester) - { - // Decompression stat gathering - // Note that we *do not* take into account the decompression failures data so we might overestimate the time spent processing - - // Always add the decompression time to the stat - tester->updateDecompressionStats(elapsed.getElapsedTimeF32()) ; - if (res) - { - // The whole data stream is finally decompressed when res is returned as true - tester->updateDecompressionStats(this->getDataSize(), raw_imagep->getDataSize()) ; - } - } - return res; } @@ -241,21 +211,6 @@ bool LLImageJ2C::encode(const LLImageRaw *raw_imagep, const char* comment_text, LLImage::setLastError(mLastError); } - LLImageCompressionTester* tester = (LLImageCompressionTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); - if (tester) - { - // Compression stat gathering - // Note that we *do not* take into account the compression failures cases so we night overestimate the time spent processing - - // Always add the compression time to the stat - tester->updateCompressionStats(elapsed.getElapsedTimeF32()) ; - if (res) - { - // The whole data stream is finally compressed when res is returned as true - tester->updateCompressionStats(this->getDataSize(), raw_imagep->getDataSize()) ; - } - } - return res; } @@ -459,133 +414,3 @@ void LLImageJ2C::updateRawDiscardLevel() LLImageJ2CImpl::~LLImageJ2CImpl() { } - -//---------------------------------------------------------------------------------------------- -// Start of LLImageCompressionTester -//---------------------------------------------------------------------------------------------- -LLImageCompressionTester::LLImageCompressionTester() : LLMetricPerformanceTesterBasic(sTesterName) -{ - addMetric("Time Decompression (s)"); - addMetric("Volume In Decompression (kB)"); - addMetric("Volume Out Decompression (kB)"); - addMetric("Decompression Ratio (x:1)"); - addMetric("Perf Decompression (kB/s)"); - - addMetric("Time Compression (s)"); - addMetric("Volume In Compression (kB)"); - addMetric("Volume Out Compression (kB)"); - addMetric("Compression Ratio (x:1)"); - addMetric("Perf Compression (kB/s)"); - - mRunBytesInDecompression = 0; - mRunBytesOutDecompression = 0; - mRunBytesInCompression = 0; - - mTotalBytesInDecompression = 0; - mTotalBytesOutDecompression = 0; - mTotalBytesInCompression = 0; - mTotalBytesOutCompression = 0; - - mTotalTimeDecompression = 0.0f; - mTotalTimeCompression = 0.0f; - mRunTimeDecompression = 0.0f; -} - -LLImageCompressionTester::~LLImageCompressionTester() -{ - outputTestResults(); - LLImageJ2C::sTesterp = NULL; -} - -//virtual -void LLImageCompressionTester::outputTestRecord(LLSD *sd) -{ - std::string currentLabel = getCurrentLabelName(); - - F32 decompressionPerf = 0.0f; - F32 compressionPerf = 0.0f; - F32 decompressionRate = 0.0f; - F32 compressionRate = 0.0f; - - F32 totalkBInDecompression = (F32)(mTotalBytesInDecompression) / 1000.f; - F32 totalkBOutDecompression = (F32)(mTotalBytesOutDecompression) / 1000.f; - F32 totalkBInCompression = (F32)(mTotalBytesInCompression) / 1000.f; - F32 totalkBOutCompression = (F32)(mTotalBytesOutCompression) / 1000.f; - - if (!is_approx_zero(mTotalTimeDecompression)) - { - decompressionPerf = totalkBInDecompression / mTotalTimeDecompression; - } - if (!is_approx_zero(totalkBInDecompression)) - { - decompressionRate = totalkBOutDecompression / totalkBInDecompression; - } - if (!is_approx_zero(mTotalTimeCompression)) - { - compressionPerf = totalkBInCompression / mTotalTimeCompression; - } - if (!is_approx_zero(totalkBOutCompression)) - { - compressionRate = totalkBInCompression / totalkBOutCompression; - } - - (*sd)[currentLabel]["Time Decompression (s)"] = (LLSD::Real)mTotalTimeDecompression; - (*sd)[currentLabel]["Volume In Decompression (kB)"] = (LLSD::Real)totalkBInDecompression; - (*sd)[currentLabel]["Volume Out Decompression (kB)"]= (LLSD::Real)totalkBOutDecompression; - (*sd)[currentLabel]["Decompression Ratio (x:1)"] = (LLSD::Real)decompressionRate; - (*sd)[currentLabel]["Perf Decompression (kB/s)"] = (LLSD::Real)decompressionPerf; - - (*sd)[currentLabel]["Time Compression (s)"] = (LLSD::Real)mTotalTimeCompression; - (*sd)[currentLabel]["Volume In Compression (kB)"] = (LLSD::Real)totalkBInCompression; - (*sd)[currentLabel]["Volume Out Compression (kB)"] = (LLSD::Real)totalkBOutCompression; - (*sd)[currentLabel]["Compression Ratio (x:1)"] = (LLSD::Real)compressionRate; - (*sd)[currentLabel]["Perf Compression (kB/s)"] = (LLSD::Real)compressionPerf; -} - -void LLImageCompressionTester::updateCompressionStats(const F32 deltaTime) -{ - mTotalTimeCompression += deltaTime; -} - -void LLImageCompressionTester::updateCompressionStats(const S32 bytesCompress, const S32 bytesRaw) -{ - mTotalBytesInCompression += bytesRaw; - mRunBytesInCompression += bytesRaw; - mTotalBytesOutCompression += bytesCompress; - if (mRunBytesInCompression > (1000000)) - { - // Output everything - outputTestResults(); - // Reset the compression data of the run - mRunBytesInCompression = 0; - } -} - -void LLImageCompressionTester::updateDecompressionStats(const F32 deltaTime) -{ - mTotalTimeDecompression += deltaTime; -} - -void LLImageCompressionTester::updateDecompressionStats(const S32 bytesIn, const S32 bytesOut) -{ - mTotalBytesInDecompression += bytesIn; - mRunBytesInDecompression += bytesIn; - mTotalBytesOutDecompression += bytesOut; - mRunBytesOutDecompression += bytesOut; - //if (mRunBytesInDecompression > (1000000)) - if (mRunBytesOutDecompression > (10000000)) - //if ((mTotalTimeDecompression - mRunTimeDecompression) >= (5.0f)) - { - // Output everything - outputTestResults(); - // Reset the decompression data of the run - mRunBytesInDecompression = 0; - mRunBytesOutDecompression = 0; - mRunTimeDecompression = mTotalTimeDecompression; - } -} - -//---------------------------------------------------------------------------------------------- -// End of LLTexturePipelineTester -//---------------------------------------------------------------------------------------------- - diff --git a/indra/llimage/llimagej2c.h b/indra/llimage/llimagej2c.h index 19744a7f87b..e5f81d02132 100644 --- a/indra/llimage/llimagej2c.h +++ b/indra/llimage/llimagej2c.h @@ -29,13 +29,11 @@ #include "llimage.h" #include "llassettype.h" -#include "llmetricperformancetester.h" // JPEG2000 : compression rate used in j2c conversion. const F32 DEFAULT_COMPRESSION_RATE = 1.f/8.f; class LLImageJ2CImpl; -class LLImageCompressionTester ; class LLImageJ2C : public LLImageFormatted { @@ -96,9 +94,6 @@ class LLImageJ2C : public LLImageFormatted bool mReversible; std::unique_ptr mImpl; std::string mLastError; - - // Image compression/decompression tester - static LLImageCompressionTester* sTesterp; }; // Derive from this class to implement JPEG2000 decoding @@ -131,42 +126,4 @@ class LLImageJ2CImpl #define LINDEN_J2C_COMMENT_PREFIX "LL_" // Used by LLAppearanceUtility -// -// This class is used for performance data gathering only. -// Tracks the image compression / decompression data, -// records and outputs them to the log file. -// -class LLImageCompressionTester : public LLMetricPerformanceTesterBasic -{ - public: - LLImageCompressionTester(); - ~LLImageCompressionTester(); - - void updateDecompressionStats(const F32 deltaTime) ; - void updateDecompressionStats(const S32 bytesIn, const S32 bytesOut) ; - void updateCompressionStats(const F32 deltaTime) ; - void updateCompressionStats(const S32 bytesIn, const S32 bytesOut) ; - - protected: - /*virtual*/ void outputTestRecord(LLSD* sd); - - private: - // - // Data size - // - U32 mTotalBytesInDecompression; // Total bytes fed to decompressor - U32 mTotalBytesOutDecompression; // Total bytes produced by decompressor - U32 mTotalBytesInCompression; // Total bytes fed to compressor - U32 mTotalBytesOutCompression; // Total bytes produced by compressor - U32 mRunBytesInDecompression; // Bytes fed to decompressor in this run - U32 mRunBytesOutDecompression; // Bytes produced by the decompressor in this run - U32 mRunBytesInCompression; // Bytes fed to compressor in this run - // - // Time - // - F32 mTotalTimeDecompression; // Total time spent in computing decompression - F32 mTotalTimeCompression; // Total time spent in computing compression - F32 mRunTimeDecompression; // Time in this run (we output every 5 sec in decompress) - }; - #endif diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 3defad8f3b0..14a47b66d39 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -28,7 +28,6 @@ #include "llinventory.h" #include "lldbstrings.h" -#include "llfasttimer.h" #include "llinventorydefines.h" #include "llxorcipher.h" #include "llsd.h" diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index ebd8602c8dc..b0ac127b754 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -30,8 +30,6 @@ #include "llsettingsdaycycle.h" #include "llerror.h" #include -#include "lltrace.h" -#include "llfasttimer.h" #include "v3colorutil.h" #include "llsettingssky.h" diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index fd3e49041cf..ae3aa5d9882 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -30,8 +30,6 @@ #include "llsettingssky.h" #include "indra_constants.h" #include -#include "lltrace.h" -#include "llfasttimer.h" #include "v3colorutil.h" #include diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 427f06457f4..2d808c7c589 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -28,8 +28,6 @@ #include "llsettingswater.h" #include -#include "lltrace.h" -#include "llfasttimer.h" #include "v3colorutil.h" #include "indra_constants.h" #include diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index edc431e538c..6930b64f462 100644 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -34,7 +34,6 @@ #include "llbuffer.h" #include "llbufferstream.h" #include "llhttpconstants.h" -#include "llfasttimer.h" #include "llhttpnode.h" #include "lliopipe.h" #include "lliosocket.h" diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index f2192acee06..7d0fa6c92fa 100644 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -32,7 +32,6 @@ #include "llapr.h" #include "llbuffer.h" -#include "llfasttimer.h" #include "llhost.h" #include "llpumpio.h" diff --git a/indra/llmessage/llioutil.cpp b/indra/llmessage/llioutil.cpp index a1bf6332b42..bcf2131e56b 100644 --- a/indra/llmessage/llioutil.cpp +++ b/indra/llmessage/llioutil.cpp @@ -28,7 +28,6 @@ #include "linden_common.h" #include "llioutil.h" -#include "llfasttimer.h" /** * LLIOFlush diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp index e1cd70b2165..86f6c0f0512 100644 --- a/indra/llmessage/llpumpio.cpp +++ b/indra/llmessage/llpumpio.cpp @@ -34,7 +34,6 @@ #include "apr_poll.h" #include "llapr.h" -#include "llfasttimer.h" #include "llstl.h" // These should not be enabled in production, but they can be diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index 850d73e9109..f540cad63aa 100644 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -27,7 +27,6 @@ #include "linden_common.h" #include "lltemplatemessagereader.h" -#include "llfasttimer.h" #include "llmessagebuilder.h" #include "llmessagetemplate.h" #include "llmath.h" @@ -531,12 +530,10 @@ void LLTemplateMessageReader::logRanOffEndOfPacket( const LLHost& host, const S3 gMessageSystem->callExceptionFunc(MX_RAN_OFF_END_OF_PACKET); } -static LLTrace::BlockTimerStatHandle FTM_PROCESS_MESSAGES("Process Messages"); - // decode a given message bool LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender ) { - LL_RECORD_BLOCK_TIME(FTM_PROCESS_MESSAGES); + LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; llassert( mReceiveSize >= 0 ); llassert( mCurrentRMessageTemplate); diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index ad1ff86807a..fea9298b2c3 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -50,7 +50,6 @@ #include "indra_constants.h" #include "lldir.h" #include "llerror.h" -#include "llfasttimer.h" #include "llhttpnodeadapter.h" #include "llmd5.h" #include "llmessagebuilder.h" diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp index eae5623a3cf..85badd1b971 100644 --- a/indra/llrender/llatmosphere.cpp +++ b/indra/llrender/llatmosphere.cpp @@ -27,7 +27,6 @@ #include "linden_common.h" #include "llatmosphere.h" -#include "llfasttimer.h" #include "llsys.h" #include "llglheaders.h" #include "llrender.h" diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 16eec1fdd24..c86dbe05029 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -29,7 +29,6 @@ #include "llfontgl.h" // Linden library includes -#include "llfasttimer.h" #include "llfontfreetype.h" #include "llfontbitmapcache.h" #include "llfontregistry.h" diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 3165cb313b2..fa874de0cab 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -32,7 +32,6 @@ #include "llimagegl.h" #include "llerror.h" -#include "llfasttimer.h" #include "llimage.h" #include "llmath.h" diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index ab88e4868ec..c5213d96f2d 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -235,7 +235,6 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) if(gl_tex->updateBindStats()) { texture->setActive() ; - texture->updateBindStatsForTester() ; } mHasMipMaps = gl_tex->mHasMipMaps; if (gl_tex->mTexOptionsDirty) diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index e9d2212a67c..7420aea3726 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -35,7 +35,6 @@ #include "llrect.h" #include "llgl.h" #include "lltexture.h" -#include "llfasttimer.h" // Project includes #include "llrender2dutils.h" diff --git a/indra/llrender/lltexture.cpp b/indra/llrender/lltexture.cpp index 980c0950f9a..0ee482cc523 100644 --- a/indra/llrender/lltexture.cpp +++ b/indra/llrender/lltexture.cpp @@ -40,4 +40,3 @@ S32 LLTexture::getWidth(S32 discard_level) const { llassert(false); return 0; } S32 LLTexture::getHeight(S32 discard_level) const { llassert(false); return 0; } bool LLTexture::isActiveFetching() { llassert(false); return false; } LLImageGL* LLTexture::getGLTexture() const { llassert(false); return nullptr; } -void LLTexture::updateBindStatsForTester() { } diff --git a/indra/llrender/lltexture.h b/indra/llrender/lltexture.h index 35cded86f22..c6b446e2066 100644 --- a/indra/llrender/lltexture.h +++ b/indra/llrender/lltexture.h @@ -67,9 +67,6 @@ class LLTexture : public virtual LLRefCount virtual S32 getHeight(S32 discard_level = -1) const; virtual bool isActiveFetching(); virtual LLImageGL* getGLTexture() const; - -private: - virtual void updateBindStatsForTester(); }; #endif diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index d59ddd0fecb..1336ba36aff 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -26,7 +26,6 @@ #include "linden_common.h" -#include "llfasttimer.h" #include "llsys.h" #include "llvertexbuffer.h" // #include "llrender.h" diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index db4ab8487e5..29442a05c70 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -1717,14 +1717,12 @@ void LLFolderView::setShowSingleSelection(bool show) } } -static LLTrace::BlockTimerStatHandle FTM_INVENTORY("Inventory"); - // Main idle routine void LLFolderView::update() { // If this is associated with the user's inventory, don't do anything // until that inventory is loaded up. - LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; //LL_RECORD_BLOCK_TIME(FTM_INVENTORY); + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; // If there's no model, the view is in suspended state (being deleted) and shouldn't be updated if (getFolderViewModel() == NULL) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 878f1cb856e..ae729a7fa6d 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -1240,8 +1240,6 @@ void LLFolderViewFolder::addToFolder(LLFolderViewFolder* folder) } } -static LLTrace::BlockTimerStatHandle FTM_ARRANGE("Arrange"); - // Make everything right and in the right place ready for drawing (CHUI-849) // * Sort everything correctly if necessary // * Turn widgets visible/invisible according to their model filtering state @@ -1251,6 +1249,8 @@ static LLTrace::BlockTimerStatHandle FTM_ARRANGE("Arrange"); // * Makes sure that this view and its children are the right size S32 LLFolderViewFolder::arrange( S32* width, S32* height ) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; + // Sort before laying out contents // Note that we sort from the root (CHUI-849) if (mAreChildrenInited) @@ -1258,8 +1258,6 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) getRoot()->getFolderViewModel()->sort(this); } - LL_RECORD_BLOCK_TIME(FTM_ARRANGE); - // evaluate mHasVisibleChildren mHasVisibleChildren = false; if (mAreChildrenInited && getViewModelItem()->descendantsPassedFilter()) @@ -1293,8 +1291,6 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) mIsFolderComplete = getFolderViewModel()->isFolderComplete(this); } - - // calculate height as a single item (without any children), and reshapes rectangle to match LLFolderViewItem::arrange( width, height ); diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 2bea8fb4ed2..c69ce88bd43 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -475,13 +475,11 @@ bool LLKeywords::WStringMapIndex::operator<(const LLKeywords::WStringMapIndex &o return result; } -LLTrace::BlockTimerStatHandle FTM_SYNTAX_COLORING("Syntax Coloring"); - // Walk through a string, applying the rules specified by the keyword token list and // create a list of color segments. void LLKeywords::findSegments(std::vector* seg_list, const LLWString& wtext, LLTextEditor& editor, LLStyleConstSP style) { - LL_RECORD_BLOCK_TIME(FTM_SYNTAX_COLORING); + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; seg_list->clear(); if( wtext.empty() ) diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index db314cae0f5..d784c4d51e5 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -362,8 +362,6 @@ void LLPanel::setBorderVisible(bool b) } } -LLTrace::BlockTimerStatHandle FTM_PANEL_CONSTRUCTION("Panel Construction"); - LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_node) { std::string name("panel"); @@ -374,7 +372,7 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_ LLPanel* panelp = NULL; - { LL_RECORD_BLOCK_TIME(FTM_PANEL_CONSTRUCTION); + { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; if(!class_attr.empty()) { @@ -478,15 +476,12 @@ void LLPanel::initFromParams(const LLPanel::Params& p) setAcceptsBadge(p.accepts_badge); } -static LLTrace::BlockTimerStatHandle FTM_PANEL_SETUP("Panel Setup"); -static LLTrace::BlockTimerStatHandle FTM_EXTERNAL_PANEL_LOAD("Load Extern Panel Reference"); -static LLTrace::BlockTimerStatHandle FTM_PANEL_POSTBUILD("Panel PostBuild"); - bool LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; Params params(default_params); { - LL_RECORD_BLOCK_TIME(FTM_PANEL_SETUP); + LL_PROFILE_ZONE_NAMED_CATEGORY_UI("Panel - Setup"); LLXMLNodePtr referenced_xml; std::string xml_filename = mXMLFilename; @@ -516,7 +511,7 @@ bool LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu LLUICtrlFactory::instance().pushFileName(xml_filename); - LL_RECORD_BLOCK_TIME(FTM_EXTERNAL_PANEL_LOAD); + LL_PROFILE_ZONE_NAMED_CATEGORY_UI("Panel - External Load"); if (!LLUICtrlFactory::getLayeredXMLNode(xml_filename, referenced_xml)) { LL_WARNS() << "Couldn't parse panel from: " << xml_filename << LL_ENDL; @@ -547,7 +542,7 @@ bool LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu params.from_xui = true; applyXUILayout(params, parent); { - LL_RECORD_BLOCK_TIME(FTM_PANEL_CONSTRUCTION); + LL_PROFILE_ZONE_NAMED_CATEGORY_UI("Panel - Construction"); initFromParams(params); } @@ -564,7 +559,7 @@ bool LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu } { - LL_RECORD_BLOCK_TIME(FTM_PANEL_POSTBUILD); + LL_PROFILE_ZONE_NAMED_CATEGORY_UI("Panel - Post Build"); postBuild(); } } diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 91221dc7f3f..d6b1db92deb 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -27,7 +27,6 @@ #ifndef LLUICTRLFACTORY_H #define LLUICTRLFACTORY_H -#include "llfasttimer.h" #include "llinitparam.h" #include "llregistry.h" #include "llxuiparser.h" diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp index ab6de16639b..5a090972aad 100644 --- a/indra/llui/lluistring.cpp +++ b/indra/llui/lluistring.cpp @@ -27,13 +27,9 @@ #include "linden_common.h" #include "lluistring.h" -#include "llfasttimer.h" #include "llsd.h" #include "lltrans.h" -LLTrace::BlockTimerStatHandle FTM_UI_STRING("UI String"); - - LLUIString::LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args) : mOrig(instring), mArgs(new LLStringUtil::format_map_t(args)) @@ -62,7 +58,7 @@ void LLUIString::setArgList(const LLStringUtil::format_map_t& args) void LLUIString::setArgs(const LLSD& sd) { - LL_RECORD_BLOCK_TIME(FTM_UI_STRING); + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; if (!sd.isMap()) return; for(LLSD::map_const_iterator sd_it = sd.beginMap(); @@ -123,9 +119,9 @@ void LLUIString::dirty() void LLUIString::updateResult() const { - mNeedsResult = false; + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; - LL_RECORD_BLOCK_TIME(FTM_UI_STRING); + mNeedsResult = false; // optimize for empty strings (don't attempt string replacement) if (mOrig.empty()) diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 8fd85a89a18..bc0c8eefa45 100644 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -29,7 +29,6 @@ #include "llxuiparser.h" #include "llxmlnode.h" -#include "llfasttimer.h" #ifdef LL_USESYSTEMLIBS #include #else @@ -675,12 +674,11 @@ LLXUIParser::LLXUIParser() } } -static LLTrace::BlockTimerStatHandle FTM_PARSE_XUI("XUI Parsing"); const LLXMLNodePtr DUMMY_NODE = new LLXMLNode(); void LLXUIParser::readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, const std::string& filename, bool silent) { - LL_RECORD_BLOCK_TIME(FTM_PARSE_XUI); + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; mNameStack.clear(); mRootNodeName = node->getName()->mString; mCurFileName = filename; @@ -1384,7 +1382,7 @@ LLSimpleXUIParser::~LLSimpleXUIParser() bool LLSimpleXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBlock& block, bool silent) { - LL_RECORD_BLOCK_TIME(FTM_PARSE_XUI); + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; mParser = XML_ParserCreate(NULL); XML_SetUserData(mParser, this); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 011cb0ed9da..95f140d6b24 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -39,7 +39,6 @@ // Linden library includes #include "llerror.h" #include "llexception.h" -#include "llfasttimer.h" #include "llgl.h" #include "llstring.h" #include "lldir.h" @@ -2283,9 +2282,6 @@ void LLWindowWin32::gatherInput() updateCursor(); } -static LLTrace::BlockTimerStatHandle FTM_KEYHANDLER("Handle Keyboard"); -static LLTrace::BlockTimerStatHandle FTM_MOUSEHANDLER("Handle Mouse"); - #define WINDOW_IMP_POST(x) window_imp->post([=]() { x; }) LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_param, LPARAM l_param) @@ -2687,7 +2683,6 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_LBUTTONDOWN"); { - LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); window_imp->postMouseButtonEvent([=]() { sHandleLeftMouseUp = true; @@ -2735,7 +2730,6 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { window_imp->postMouseButtonEvent([=]() { - LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); if (!sHandleLeftMouseUp) { sHandleLeftMouseUp = true; @@ -2757,7 +2751,6 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_RBUTTONDOWN"); { - LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); window_imp->post([=]() { if (LLWinImm::isAvailable() && window_imp->mPreeditor) @@ -2780,7 +2773,6 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_RBUTTONUP"); { - LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); window_imp->postMouseButtonEvent([=]() { MASK mask = gKeyboard->currentMask(true); @@ -2795,7 +2787,6 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_MBUTTONDOWN"); { - LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); window_imp->postMouseButtonEvent([=]() { if (LLWinImm::isAvailable() && window_imp->mPreeditor) @@ -2814,7 +2805,6 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_MBUTTONUP"); { - LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); window_imp->postMouseButtonEvent([=]() { MASK mask = gKeyboard->currentMask(true); @@ -2828,7 +2818,6 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_XBUTTONDOWN"); window_imp->postMouseButtonEvent([=]() { - LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); S32 button = GET_XBUTTON_WPARAM(w_param); if (LLWinImm::isAvailable() && window_imp->mPreeditor) { @@ -2848,9 +2837,6 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_XBUTTONUP"); window_imp->postMouseButtonEvent([=]() { - - LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); - S32 button = GET_XBUTTON_WPARAM(w_param); MASK mask = gKeyboard->currentMask(true); // Windows uses numbers 1 and 2 for buttons, remap to 4, 5 diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index f46cfad1fd2..34baceeac77 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -177,7 +177,6 @@ set(viewer_SOURCE_FILES llexperiencelog.cpp llexternaleditor.cpp llface.cpp - llfasttimerview.cpp llfavoritesbar.cpp llfeaturemanager.cpp llfetchedgltfmaterial.cpp @@ -861,7 +860,6 @@ set(viewer_HEADER_FILES llexperiencelog.h llexternaleditor.h llface.h - llfasttimerview.h llfavoritesbar.h llfeaturemanager.h llfetchedgltfmaterial.h diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index b2c66b1bace..1eae486b0de 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1192,8 +1192,6 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y) } } -static LLTrace::BlockTimerStatHandle FTM_UPDATE_CAMERA("Camera"); - extern bool gCubeSnapshot; //----------------------------------------------------------------------------- @@ -1201,7 +1199,7 @@ extern bool gCubeSnapshot; //----------------------------------------------------------------------------- void LLAgentCamera::updateCamera() { - LL_RECORD_BLOCK_TIME(FTM_UPDATE_CAMERA); + LL_PROFILE_ZONE_SCOPED; if (gCubeSnapshot) { return; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index f3970ed1a84..54dc7ac9acd 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -90,7 +90,6 @@ #include "lltoast.h" #include "llsdutil_math.h" #include "lllocationhistory.h" -#include "llfasttimerview.h" #include "llvector4a.h" #include "llviewermenufile.h" #include "llvoicechannel.h" @@ -591,32 +590,6 @@ static void settings_modify() gDebugPipeline = gSavedSettings.getBOOL("RenderDebugPipeline"); } -class LLFastTimerLogThread : public LLThread -{ -public: - std::string mFile; - - LLFastTimerLogThread(std::string& test_name) : LLThread("fast timer log") - { - std::string file_name = test_name + std::string(".slp"); - mFile = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, file_name); - } - - void run() - { - llofstream os(mFile.c_str()); - - while (!LLAppViewer::instance()->isQuitting()) - { - LLTrace::BlockTimer::writeLog(os); - os.flush(); - ms_sleep(32); - } - - os.close(); - } -}; - //virtual bool LLAppViewer::initSLURLHandler() { @@ -667,7 +640,6 @@ LLAppViewer::LLAppViewer() mAgentRegionLastAlive(false), mRandomizeFramerate(LLCachedControl(gSavedSettings,"Randomize Framerate", false)), mPeriodicSlowFrame(LLCachedControl(gSavedSettings,"Periodic Slow Frame", false)), - mFastTimerLogThread(NULL), mSettingsLocationList(NULL), mIsFirstRun(false) { @@ -1302,10 +1274,6 @@ void LLAppViewer::initMaxHeapSize() LLMemory::initMaxHeapSizeGB(max_heap_size_gb); } - -// externally visible timers -LLTrace::BlockTimerStatHandle FTM_FRAME("Frame"); - bool LLAppViewer::frame() { bool ret = false; @@ -1348,7 +1316,7 @@ bool LLAppViewer::frame() bool LLAppViewer::doFrame() { - LL_RECORD_BLOCK_TIME(FTM_FRAME); + LL_PROFILE_ZONE_NAMED("Frame"); LL_PROFILE_GPU_ZONE("Frame"); #ifdef LL_DISCORD { @@ -1376,13 +1344,7 @@ bool LLAppViewer::doFrame() LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_IDLE); // perf stats { LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df LLTrace"); - if (LLFloaterReg::instanceVisible("block_timers")) - { - LLTrace::BlockTimer::processTimes(); - } - LLTrace::get_frame_recording().nextPeriod(); - LLTrace::BlockTimer::logStats(); } LLTrace::get_thread_recorder()->pullFromChildren(); @@ -1393,7 +1355,7 @@ bool LLAppViewer::doFrame() { { LLPerfStats::RecordSceneTime T(LLPerfStats::StatType_t::RENDER_IDLE); // ensure we have the entire top scope of frame covered (input event and coro) - LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df processMiscNativeEvents") + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df processMiscNativeEvents"); pingMainloopTimeout("Main:MiscNativeWindowEvents"); if (gViewerWindow) @@ -1403,7 +1365,7 @@ bool LLAppViewer::doFrame() } { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df gatherInput") + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df gatherInput"); pingMainloopTimeout("Main:GatherInput"); } @@ -1537,7 +1499,6 @@ bool LLAppViewer::doFrame() // Sleep and run background threads { - //LL_RECORD_BLOCK_TIME(SLEEP2); LL_PROFILE_ZONE_WARN("Sleep2"); // yield some time to the os based on command line option @@ -1722,13 +1683,6 @@ bool LLAppViewer::cleanup() LLSceneMonitor::deleteSingleton(); } - // There used to be an 'if (LLFastTimerView::sAnalyzePerformance)' block - // here, completely redundant with the one that occurs later in this same - // function. Presumably the duplication was due to an automated merge gone - // bad. Not knowing which instance to prefer, we chose to retain the later - // one because it happens just after mFastTimerLogThread is deleted. This - // comment is in case we guessed wrong, so we can move it here instead. - #if LL_LINUX // remove any old breakpad minidump files from the log directory if (! isError()) @@ -2083,29 +2037,11 @@ bool LLAppViewer::cleanup() } delete sImageDecodeThread; sImageDecodeThread = NULL; - delete mFastTimerLogThread; - mFastTimerLogThread = NULL; delete sPurgeDiskCacheThread; sPurgeDiskCacheThread = NULL; delete mGeneralThreadPool; mGeneralThreadPool = NULL; - if (LLFastTimerView::sAnalyzePerformance) - { - LL_INFOS() << "Analyzing performance" << LL_ENDL; - - std::string baseline_name = LLTrace::BlockTimer::sLogName + "_baseline.slp"; - std::string current_name = LLTrace::BlockTimer::sLogName + ".slp"; - std::string report_name = LLTrace::BlockTimer::sLogName + "_report.csv"; - - LLFastTimerView::doAnalysis( - gDirUtilp->getExpandedFilename(LL_PATH_LOGS, baseline_name), - gDirUtilp->getExpandedFilename(LL_PATH_LOGS, current_name), - gDirUtilp->getExpandedFilename(LL_PATH_LOGS, report_name)); - } - - SUBSYSTEM_CLEANUP(LLMetricPerformanceTesterBasic) ; - LL_INFOS() << "Cleaning up Media and Textures" << LL_ENDL; //Note: @@ -2235,13 +2171,6 @@ bool LLAppViewer::initThreads() LLAppViewer::sPurgeDiskCacheThread = new LLPurgeDiskCacheThread(); - if (LLTrace::BlockTimer::sLog || LLTrace::BlockTimer::sMetricLog) - { - LLTrace::BlockTimer::setLogLock(new LLMutex()); - mFastTimerLogThread = new LLFastTimerLogThread(LLTrace::BlockTimer::sLogName); - mFastTimerLogThread->start(); - } - // Mesh streaming and caching gMeshRepo.init(); @@ -2785,22 +2714,6 @@ bool LLAppViewer::initConfiguration() // If we have specified crash on startup, set the global so we'll trigger the crash at the right time gCrashOnStartup = gSavedSettings.getBOOL("CrashOnStartup"); - if (gSavedSettings.getBOOL("LogPerformance")) - { - LLTrace::BlockTimer::sLog = true; - LLTrace::BlockTimer::sLogName = std::string("performance"); - } - - std::string test_name(gSavedSettings.getString("LogMetrics")); - if (!test_name.empty()) - { - LLTrace::BlockTimer::sMetricLog = true; - // '--logmetrics' is specified with a named test metric argument so the data gathering is done only on that test - // In the absence of argument, every metric would be gathered (makes for a rather slow run and hard to decipher report...) - LL_INFOS() << "'--logmetrics' argument : " << test_name << LL_ENDL; - LLTrace::BlockTimer::sLogName = test_name; - } - if (clp.hasOption("graphicslevel")) { // User explicitly requested --graphicslevel on the command line. We @@ -2813,7 +2726,6 @@ bool LLAppViewer::initConfiguration() mForceGraphicsLevel = gSavedSettings.getU32("RenderQualityPerformance"); } - LLFastTimerView::sAnalyzePerformance = gSavedSettings.getBOOL("AnalyzePerformance"); gAgentPilot.setReplaySession(gSavedSettings.getBOOL("ReplaySession")); if (gSavedSettings.getBOOL("DebugSession")) @@ -4712,20 +4624,6 @@ class LLFrameStatsTimer : public LLFrameTimer } }; -static LLTrace::BlockTimerStatHandle FTM_AUDIO_UPDATE("Update Audio"); -static LLTrace::BlockTimerStatHandle FTM_CLEANUP("Cleanup"); -static LLTrace::BlockTimerStatHandle FTM_CLEANUP_DRAWABLES("Drawables"); -static LLTrace::BlockTimerStatHandle FTM_IDLE_CB("Idle Callbacks"); -static LLTrace::BlockTimerStatHandle FTM_LOD_UPDATE("Update LOD"); -static LLTrace::BlockTimerStatHandle FTM_OBJECTLIST_UPDATE("Update Objectlist"); -static LLTrace::BlockTimerStatHandle FTM_REGION_UPDATE("Update Region"); -static LLTrace::BlockTimerStatHandle FTM_WORLD_UPDATE("Update World"); -static LLTrace::BlockTimerStatHandle FTM_NETWORK("Network"); -static LLTrace::BlockTimerStatHandle FTM_AGENT_NETWORK("Agent Network"); -static LLTrace::BlockTimerStatHandle FTM_VLMANAGER("VL Manager"); -static LLTrace::BlockTimerStatHandle FTM_AGENT_POSITION("Agent Position"); -static LLTrace::BlockTimerStatHandle FTM_HUD_EFFECTS("HUD Effects"); - /////////////////////////////////////////////////////// // idle() // @@ -4824,7 +4722,7 @@ void LLAppViewer::idle() if (!gDisconnected) { - LL_PROFILE_ZONE_NAMED_CATEGORY_NETWORK("network"); //LL_RECORD_BLOCK_TIME(FTM_NETWORK); + LL_PROFILE_ZONE_NAMED_CATEGORY_NETWORK("network"); // Update spaceserver timeinfo LLWorld::getInstance()->setSpaceTimeUSec(LLWorld::getInstance()->getSpaceTimeUSec() + LLUnits::Seconds::fromValue(dt_raw)); @@ -4927,7 +4825,7 @@ void LLAppViewer::idle() if (!mQuitRequested) //MAINT-4243 #endif { -// LL_RECORD_BLOCK_TIME(FTM_IDLE_CB); + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Idle Callbacks"); // Do event notifications if necessary. Yes, we may want to move this elsewhere. gEventNotifier.update(); @@ -4968,11 +4866,11 @@ void LLAppViewer::idle() { // Teleported, but waiting for things to load, start processing surface data { - LL_RECORD_BLOCK_TIME(FTM_NETWORK); + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("teleport - unpack VL data"); gVLManager.unpackData(); } { - LL_RECORD_BLOCK_TIME(FTM_REGION_UPDATE); + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("teleport - region update"); const F32 max_region_update_time = .001f; // 1ms LLWorld::getInstance()->updateRegions(max_region_update_time); } @@ -4995,15 +4893,17 @@ void LLAppViewer::idle() { // Handle pending gesture processing - LL_RECORD_BLOCK_TIME(FTM_AGENT_POSITION); + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("app - gesture update"); LLGestureMgr::instance().update(); + } + { + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("app - agentposition"); gAgent.updateAgentPosition(gFrameDTClamped, yaw, current_mouse.mX, current_mouse.mY); } { - LL_RECORD_BLOCK_TIME(FTM_OBJECTLIST_UPDATE); - + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("app - objectlist update"); if (!(logoutRequestSent() && hasSavedFinalSnapshot())) { gObjectList.update(gAgent); @@ -5018,12 +4918,12 @@ void LLAppViewer::idle() // { - LL_RECORD_BLOCK_TIME(FTM_CLEANUP); + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("app - cleanup"); { gObjectList.cleanDeadObjects(); } { - LL_RECORD_BLOCK_TIME(FTM_CLEANUP_DRAWABLES); + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("app - cleanup drawables"); LLDrawable::cleanupDeadDrawables(); } } @@ -5042,7 +4942,7 @@ void LLAppViewer::idle() // { - LL_RECORD_BLOCK_TIME(FTM_HUD_EFFECTS); + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("app - hudeffects"); LLSelectMgr::getInstance()->updateEffects(); LLHUDManager::getInstance()->cleanupEffects(); LLHUDManager::getInstance()->sendEffects(); @@ -5054,7 +4954,7 @@ void LLAppViewer::idle() // { - LL_RECORD_BLOCK_TIME(FTM_NETWORK); + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("network - unpack VL data"); gVLManager.unpackData(); } @@ -5066,7 +4966,7 @@ void LLAppViewer::idle() LLWorld::getInstance()->updateVisibilities(); { const F32 max_region_update_time = .001f; // 1ms - LL_RECORD_BLOCK_TIME(FTM_REGION_UPDATE); + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("app - region update"); LLWorld::getInstance()->updateRegions(max_region_update_time); } @@ -5103,7 +5003,7 @@ void LLAppViewer::idle() // { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP("world update"); //LL_RECORD_BLOCK_TIME(FTM_WORLD_UPDATE); + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("world update"); gPipeline.updateMove(); } @@ -5136,7 +5036,7 @@ void LLAppViewer::idle() // objects and camera should be in sync, do LOD calculations now { - LL_RECORD_BLOCK_TIME(FTM_LOD_UPDATE); + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("LOD Updates"); gObjectList.updateApparentAngles(gAgent); } @@ -5144,7 +5044,7 @@ void LLAppViewer::idle() LLAvatarRenderInfoAccountant::getInstance()->idle(); { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP("audio update"); //LL_RECORD_BLOCK_TIME(FTM_AUDIO_UPDATE); + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("audio update"); if (gAudiop) { @@ -5460,13 +5360,6 @@ void LLAppViewer::idleNameCache() constexpr F32 CHECK_MESSAGES_DEFAULT_MAX_TIME = 0.020f; // 50 ms = 50 fps (just for messages!) static F32 CheckMessagesMaxTime = CHECK_MESSAGES_DEFAULT_MAX_TIME; -static LLTrace::BlockTimerStatHandle FTM_IDLE_NETWORK("Idle Network"); -static LLTrace::BlockTimerStatHandle FTM_MESSAGE_ACKS("Message Acks"); -static LLTrace::BlockTimerStatHandle FTM_RETRANSMIT("Retransmit"); -static LLTrace::BlockTimerStatHandle FTM_TIMEOUT_CHECK("Timeout Check"); -static LLTrace::BlockTimerStatHandle FTM_DYNAMIC_THROTTLE("Dynamic Throttle"); -static LLTrace::BlockTimerStatHandle FTM_CHECK_REGION_CIRCUIT("Check Region Circuit"); - void LLAppViewer::idleNetwork() { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; @@ -5478,7 +5371,7 @@ void LLAppViewer::idleNetwork() static LLCachedControl speed_test(gSavedSettings, "SpeedTest", false); if (!speed_test()) { - LL_PROFILE_ZONE_NAMED_CATEGORY_NETWORK("idle network"); //LL_RECORD_BLOCK_TIME(FTM_IDLE_NETWORK); // decode + LL_PROFILE_ZONE_NAMED_CATEGORY_NETWORK("idle network"); // decode LLTimer check_message_timer; // Read all available packets from network diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 4f2583cb164..e8d4a74810c 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -64,8 +64,6 @@ class LLViewerJoystick; class LLPurgeDiskCacheThread; class LLViewerRegion; -extern LLTrace::BlockTimerStatHandle FTM_FRAME; - typedef enum { LAST_EXEC_NORMAL = 0, @@ -362,9 +360,6 @@ class LLAppViewer : public LLApp LLWatchdogTimeout* mMainloopTimeout; - // For performance and metric gathering - class LLThread* mFastTimerLogThread; - // for tracking viewer<->region circuit death bool mAgentRegionLastAlive; LLUUID mAgentRegionLastID; diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index c1af09ebc76..3027e4232ba 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -1227,11 +1227,9 @@ void LLChatHistory::clear() mLastFromID = LLUUID::null; } -static LLTrace::BlockTimerStatHandle FTM_APPEND_MESSAGE("Append Chat Message"); - void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LLStyle::Params& input_append_params) { - LL_RECORD_BLOCK_TIME(FTM_APPEND_MESSAGE); + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; bool use_plain_text_chat_history = args["use_plain_text_chat_history"].asBoolean(); bool square_brackets = false; // square brackets necessary for a system messages diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index 53da9826ed7..b77195928bb 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -29,7 +29,6 @@ #include "lldebugview.h" // library includes -#include "llfasttimerview.h" #include "llconsole.h" #include "lltextureview.h" #include "llresmgr.h" @@ -53,7 +52,6 @@ static LLDefaultChildRegistry::Register r("debug_view"); LLDebugView::LLDebugView(const LLDebugView::Params& p) : LLView(p), - mFastTimerView(NULL), mDebugConsolep(NULL), mFloaterSnapRegion(NULL) {} @@ -89,8 +87,6 @@ void LLDebugView::init() r.setLeftTopAndSize(25, rect.getHeight() - 50, (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f), (S32) (gViewerWindow->getWindowRectScaled().getHeight() * 0.75f)); - mFastTimerView = dynamic_cast(LLFloaterReg::getInstance("block_timers")); - gSceneView = new LLSceneView(r); gSceneView->setFollowsTop(); gSceneView->setFollowsLeft(); diff --git a/indra/newview/lldebugview.h b/indra/newview/lldebugview.h index 8fa2acc3c9d..4ba9cb360bc 100644 --- a/indra/newview/lldebugview.h +++ b/indra/newview/lldebugview.h @@ -35,7 +35,6 @@ // declarations class LLButton; class LLStatusPanel; -class LLFastTimerView; class LLConsole; class LLTextureView; class LLFloaterStats; @@ -59,7 +58,6 @@ class LLDebugView : public LLView void setStatsVisible(bool visible); - LLFastTimerView* mFastTimerView; LLConsole* mDebugConsolep; LLView* mFloaterSnapRegion; }; diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp index b4ced668d01..2039bab8437 100644 --- a/indra/newview/lldonotdisturbnotificationstorage.cpp +++ b/indra/newview/lldonotdisturbnotificationstorage.cpp @@ -130,11 +130,9 @@ void LLDoNotDisturbNotificationStorage::saveNotifications() resetDirty(); } -static LLTrace::BlockTimerStatHandle FTM_LOAD_DND_NOTIFICATIONS("Load DND Notifications"); - void LLDoNotDisturbNotificationStorage::loadNotifications() { - LL_RECORD_BLOCK_TIME(FTM_LOAD_DND_NOTIFICATIONS); + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; LL_INFOS("LLDoNotDisturbNotificationStorage") << "start loading notifications" << LL_ENDL; diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 3eca6059ed0..11ddfcfc21f 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -28,7 +28,6 @@ #include "lldrawpool.h" #include "llrender.h" -#include "llfasttimer.h" #include "llviewercontrol.h" #include "lldrawable.h" diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 87b6ce6cb3a..fb19d40b416 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -31,7 +31,6 @@ #include "llglheaders.h" #include "llviewercontrol.h" #include "llcriticaldamp.h" -#include "llfasttimer.h" #include "llrender.h" #include "llcubemap.h" diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 90ee95d424b..0fe7405d09f 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -662,7 +662,7 @@ void LLDrawPoolAvatar::endDeferredSkinned() void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; //LL_RECORD_BLOCK_TIME(FTM_RENDER_CHARACTERS); + LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; if (pass == -1) { @@ -825,8 +825,6 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) } } -static LLTrace::BlockTimerStatHandle FTM_RIGGED_VBO("Rigged VBO"); - //----------------------------------------------------------------------------- // getDebugTexture() //----------------------------------------------------------------------------- diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index bf593bff07e..70a3858d921 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -283,7 +283,7 @@ void LLDrawPoolBump::unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& void LLDrawPoolBump::beginFullbrightShiny() { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD0; @@ -354,7 +354,7 @@ void LLDrawPoolBump::beginFullbrightShiny() void LLDrawPoolBump::renderFullbrightShiny() { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; { LLGLEnable blend_enable(GL_BLEND); @@ -386,7 +386,7 @@ void LLDrawPoolBump::renderFullbrightShiny() void LLDrawPoolBump::endFullbrightShiny() { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; if( cube_map && !LLPipeline::sReflectionProbesEnabled ) @@ -495,7 +495,7 @@ bool LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, S32 cha //static void LLDrawPoolBump::beginBump() { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; sVertexMask = VERTEX_MASK_BUMP; // Optional second pass: emboss bump map stop_glerror(); @@ -517,7 +517,7 @@ void LLDrawPoolBump::beginBump() //static void LLDrawPoolBump::renderBump(U32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_LEQUAL); LLGLEnable blend(GL_BLEND); gGL.diffuseColor4f(1,1,1,1); @@ -542,7 +542,7 @@ S32 LLDrawPoolBump::getNumDeferredPasses() void LLDrawPoolBump::renderDeferred(S32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; shiny = true; for (int i = 0; i < 2; ++i) diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 836a90adab7..022601a9f50 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -38,10 +38,6 @@ #include "llrender.h" #include "gltfscenemanager.h" -static LLTrace::BlockTimerStatHandle FTM_RENDER_SIMPLE_DEFERRED("Deferred Simple"); -static LLTrace::BlockTimerStatHandle FTM_RENDER_GRASS_DEFERRED("Deferred Grass"); - - void LLDrawPoolGlow::renderPostDeferred(S32 pass) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; @@ -75,8 +71,6 @@ LLDrawPoolSimple::LLDrawPoolSimple() : { } -static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_MASK("Alpha Mask"); - LLDrawPoolAlphaMask::LLDrawPoolAlphaMask() : LLRenderPass(POOL_ALPHA_MASK) { @@ -98,7 +92,7 @@ S32 LLDrawPoolSimple::getNumDeferredPasses() void LLDrawPoolSimple::renderDeferred(S32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SIMPLE_DEFERRED); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LLGLDisable blend(GL_BLEND); //render static @@ -110,12 +104,9 @@ void LLDrawPoolSimple::renderDeferred(S32 pass) pushRiggedBatches(LLRenderPass::PASS_SIMPLE_RIGGED, true, true); } -static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_MASK_DEFERRED("Deferred Alpha Mask"); - - void LLDrawPoolAlphaMask::renderDeferred(S32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK_DEFERRED); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LLGLSLShader* shader = &gDeferredDiffuseAlphaMaskProgram; //render static @@ -155,7 +146,7 @@ LLDrawPoolFullbright::LLDrawPoolFullbright() : void LLDrawPoolFullbright::renderPostDeferred(S32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_FULLBRIGHT); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LLGLSLShader* shader = nullptr; if (LLPipeline::sRenderingHUDs) @@ -183,7 +174,7 @@ void LLDrawPoolFullbright::renderPostDeferred(S32 pass) void LLDrawPoolFullbrightAlphaMask::renderPostDeferred(S32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_FULLBRIGHT); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; // render unrigged unlit GLTF LL::GLTFSceneManager::instance().render(true, false, true); diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index d75b8d0ac6e..df9fd5afd35 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -28,8 +28,6 @@ #include "lldrawpoolterrain.h" -#include "llfasttimer.h" - #include "llagent.h" #include "llviewercontrol.h" #include "lldrawable.h" @@ -58,8 +56,6 @@ S32 LLDrawPoolTerrain::sPBRDetailMode = 0; F32 LLDrawPoolTerrain::sDetailScale = DETAIL_SCALE; F32 LLDrawPoolTerrain::sPBRDetailScale = DETAIL_SCALE; static LLGLSLShader* sShader = NULL; -static LLTrace::BlockTimerStatHandle FTM_SHADOW_TERRAIN("Terrain Shadow"); - LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) : LLFacePool(POOL_TERRAIN), @@ -121,20 +117,20 @@ void LLDrawPoolTerrain::boostTerrainDetailTextures() void LLDrawPoolTerrain::beginDeferredPass(S32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LLFacePool::beginRenderPass(pass); } void LLDrawPoolTerrain::endDeferredPass(S32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LLFacePool::endRenderPass(pass); sShader->unbind(); } void LLDrawPoolTerrain::renderDeferred(S32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; if (mDrawFace.empty()) { return; @@ -154,7 +150,7 @@ void LLDrawPoolTerrain::renderDeferred(S32 pass) void LLDrawPoolTerrain::beginShadowPass(S32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_SHADOW_TERRAIN); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LLFacePool::beginRenderPass(pass); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gDeferredShadowProgram.bind(); @@ -165,14 +161,14 @@ void LLDrawPoolTerrain::beginShadowPass(S32 pass) void LLDrawPoolTerrain::endShadowPass(S32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_SHADOW_TERRAIN); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LLFacePool::endRenderPass(pass); gDeferredShadowProgram.unbind(); } void LLDrawPoolTerrain::renderShadow(S32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_SHADOW_TERRAIN); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; if (mDrawFace.empty()) { return; diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index 26ef190fbbf..a4188705f37 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -55,7 +55,7 @@ LLDrawPoolTree::LLDrawPoolTree(LLViewerTexture *texturep) : //============================================ void LLDrawPoolTree::beginDeferredPass(S32 pass) { - LL_RECORD_BLOCK_TIME(FTM_RENDER_TREES); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; shader = &gDeferredTreeProgram; shader->bind(); @@ -96,7 +96,7 @@ void LLDrawPoolTree::renderDeferred(S32 pass) void LLDrawPoolTree::endDeferredPass(S32 pass) { - LL_RECORD_BLOCK_TIME(FTM_RENDER_TREES); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; shader->unbind(); } diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index cdf3244389b..31ac3ee44ee 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -106,7 +106,7 @@ S32 LLDrawPoolWater::getNumPostDeferredPasses() void LLDrawPoolWater::beginPostDeferredPass(S32 pass) { - LL_PROFILE_GPU_ZONE("water beginPostDeferredPass") + LL_PROFILE_GPU_ZONE("water beginPostDeferredPass"); gGL.setColorMask(true, true); if (LLPipeline::sRenderTransparentWater) diff --git a/indra/newview/lldrawpoolwaterexclusion.cpp b/indra/newview/lldrawpoolwaterexclusion.cpp index d796bf39bf9..8000baa8cf8 100644 --- a/indra/newview/lldrawpoolwaterexclusion.cpp +++ b/indra/newview/lldrawpoolwaterexclusion.cpp @@ -42,7 +42,7 @@ LLDrawPoolWaterExclusion::LLDrawPoolWaterExclusion() : LLRenderPass(LLDrawPool:: void LLDrawPoolWaterExclusion::render(S32 pass) { // render invisiprims - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; // LL_RECORD_BLOCK_TIME(FTM_RENDER_INVISIBLE); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; if (gPipeline.shadersLoaded()) { diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 305215f5413..53f74d46ea1 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -471,7 +471,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() void LLDrawPoolWLSky::renderDeferred(S32 pass) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_WL_SKY); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY) || gSky.mVOSkyp.isNull()) { return; diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 33325e352f0..66eb3135d32 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -184,6 +184,7 @@ void LLViewerDynamicTexture::postRender(bool success) bool LLViewerDynamicTexture::updateAllInstances() { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; + LL_PROFILE_GPU_ZONE("llvdt - updateall"); sNumRenders = 0; if (gGLManager.mIsDisabled) diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 875dac103c8..7e40527f066 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -35,8 +35,6 @@ #include "llviewerregion.h" #include "llwlhandlers.h" #include "lltrans.h" -#include "lltrace.h" -#include "llfasttimer.h" #include "llviewercamera.h" #include "pipeline.h" #include "llsky.h" @@ -102,8 +100,6 @@ namespace const std::string LOCAL_ENV_STORAGE_FILE("local_environment_data.bin"); //--------------------------------------------------------------------- - LLTrace::BlockTimerStatHandle FTM_ENVIRONMENT_UPDATE("Update Environment Tick"); - LLSettingsBase::Seconds DEFAULT_UPDATE_THRESHOLD(10.0); const LLSettingsBase::Seconds MINIMUM_SPANLENGTH(0.01f); @@ -1669,7 +1665,7 @@ extern bool gCubeSnapshot; //------------------------------------------------------------------------- void LLEnvironment::update(const LLViewerCamera * cam) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT; //LL_RECORD_BLOCK_TIME(FTM_ENVIRONMENT_UPDATE); + LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT; //F32Seconds now(LLDate::now().secondsSinceEpoch()); if (!gCubeSnapshot) { diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp deleted file mode 100644 index cce6eeb19dd..00000000000 --- a/indra/newview/llfasttimerview.cpp +++ /dev/null @@ -1,1665 +0,0 @@ -/** - * @file llfasttimerview.cpp - * @brief LLFastTimerView class implementation - * - * $LicenseInfo:firstyear=2004&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfasttimerview.h" - -#include "llviewerwindow.h" -#include "llrect.h" -#include "llcombobox.h" -#include "llerror.h" -#include "llgl.h" -#include "llimagepng.h" -#include "llrender.h" -#include "llrendertarget.h" -#include "lllocalcliprect.h" -#include "lllayoutstack.h" -#include "llmath.h" -#include "llfontgl.h" -#include "llsdserialize.h" -#include "lltooltip.h" -#include "llbutton.h" -#include "llscrollbar.h" - -#include "llappviewer.h" -#include "llviewertexturelist.h" -#include "llui.h" -#include "llviewercontrol.h" - -#include "llfasttimer.h" -#include "lltreeiterators.h" -#include "llmetricperformancetester.h" -#include "llviewerstats.h" - -////////////////////////////////////////////////////////////////////////////// - -using namespace LLTrace; - -static constexpr S32 MAX_VISIBLE_HISTORY = 12; -static constexpr S32 LINE_GRAPH_HEIGHT = 240; -static constexpr S32 MIN_BAR_HEIGHT = 3; -static constexpr S32 RUNNING_AVERAGE_WIDTH = 100; -static constexpr S32 NUM_FRAMES_HISTORY = 200; - -std::vector ft_display_idx; // line of table entry for display purposes (for collapse) - -bool LLFastTimerView::sAnalyzePerformance = false; - -S32 get_depth(const BlockTimerStatHandle* blockp) -{ - S32 depth = 0; - BlockTimerStatHandle* timerp = blockp->getParent(); - while(timerp) - { - depth++; - if (timerp->getParent() == timerp) break; - timerp = timerp->getParent(); - } - return depth; -} - -LLFastTimerView::LLFastTimerView(const LLSD& key) -: LLFloater(key), - mHoverTimer(NULL), - mDisplayMode(0), - mDisplayType(DISPLAY_TIME), - mScrollIndex(0), - mHoverID(NULL), - mHoverBarIndex(-1), - mStatsIndex(-1), - mPauseHistory(false), - mRecording(NUM_FRAMES_HISTORY) -{ - mTimerBarRows.resize(NUM_FRAMES_HISTORY); -} - -LLFastTimerView::~LLFastTimerView() -{ -} - -void LLFastTimerView::onPause() -{ - setPauseState(!mPauseHistory); -} - -void LLFastTimerView::setPauseState(bool pause_state) -{ - if (pause_state == mPauseHistory) return; - - // reset scroll to bottom when unpausing - if (!pause_state) - { - - getChild("pause_btn")->setLabel(getString("pause")); - } - else - { - mScrollIndex = 0; - - getChild("pause_btn")->setLabel(getString("run")); - } - - mPauseHistory = pause_state; -} - -bool LLFastTimerView::postBuild() -{ - LLButton& pause_btn = getChildRef("pause_btn"); - mScrollBar = getChild("scroll_vert"); - - pause_btn.setCommitCallback(boost::bind(&LLFastTimerView::onPause, this)); - return true; -} - -bool LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask) -{ - if (mHoverTimer ) - { - // right click collapses timers - if (!mHoverTimer->getTreeNode().mCollapsed) - { - mHoverTimer->getTreeNode().mCollapsed = true; - } - else if (mHoverTimer->getParent()) - { - mHoverTimer->getParent()->getTreeNode().mCollapsed = true; - } - return true; - } - else if (mBarRect.pointInRect(x, y)) - { - S32 bar_idx = MAX_VISIBLE_HISTORY - ((y - mBarRect.mBottom) * (MAX_VISIBLE_HISTORY + 2) / mBarRect.getHeight()); - bar_idx = llclamp(bar_idx, 0, MAX_VISIBLE_HISTORY); - mStatsIndex = mScrollIndex + bar_idx; - return true; - } - return LLFloater::handleRightMouseDown(x, y, mask); -} - -BlockTimerStatHandle* LLFastTimerView::getLegendID(S32 y) -{ - S32 idx = (mLegendRect.mTop - y) / (LLFontGL::getFontMonospace()->getLineHeight() + 2); - - if (idx >= 0 && idx < (S32)ft_display_idx.size()) - { - return ft_display_idx[idx]; - } - - return NULL; -} - -bool LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask) -{ - for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); - it != LLTrace::end_block_timer_tree_df(); - ++it) - { - (*it)->getTreeNode().mCollapsed = false; - } - return true; -} - -bool LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) -{ - if (x < mScrollBar->getRect().mLeft) - { - BlockTimerStatHandle* idp = getLegendID(y); - if (idp) - { - idp->getTreeNode().mCollapsed = !idp->getTreeNode().mCollapsed; - } - } - else if (mHoverTimer) - { - //left click drills down by expanding timers - mHoverTimer->getTreeNode().mCollapsed = false; - } - else if (mGraphRect.pointInRect(x, y)) - { - gFocusMgr.setMouseCapture(this); - return true; - } - - return LLFloater::handleMouseDown(x, y, mask); -} - -bool LLFastTimerView::handleMouseUp(S32 x, S32 y, MASK mask) -{ - if (hasMouseCapture()) - { - gFocusMgr.setMouseCapture(NULL); - } - return LLFloater::handleMouseUp(x, y, mask);; -} - -bool LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) -{ - if (hasMouseCapture()) - { - F32 lerp = llclamp(1.f - (F32) (x - mGraphRect.mLeft) / (F32) mGraphRect.getWidth(), 0.f, 1.f); - mScrollIndex = ll_round( lerp * (F32)(mRecording.getNumRecordedPeriods() - MAX_VISIBLE_HISTORY)); - mScrollIndex = llclamp( mScrollIndex, 0, (S32)mRecording.getNumRecordedPeriods()); - return true; - } - mHoverTimer = NULL; - mHoverID = NULL; - - if(mPauseHistory && mBarRect.pointInRect(x, y)) - { - //const S32 bars_top = mBarRect.mTop; - const S32 bars_top = mBarRect.mTop - ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4); - - mHoverBarIndex = llmin((bars_top - y) / (mBarRect.getHeight() / (MAX_VISIBLE_HISTORY + 2)) - 1, - (S32)mRecording.getNumRecordedPeriods() - 1, - MAX_VISIBLE_HISTORY); - if (mHoverBarIndex == 0) - { - return true; - } - else if (mHoverBarIndex < 0) - { - mHoverBarIndex = 0; - } - - TimerBarRow& row = mHoverBarIndex == 0 ? mAverageTimerRow : mTimerBarRows[mScrollIndex + mHoverBarIndex - 1]; - - TimerBar* hover_bar = NULL; - F32Seconds mouse_time_offset = ((F32)(x - mBarRect.mLeft) / (F32)mBarRect.getWidth()) * mTotalTimeDisplay; - for (size_t bar_index = 0, end_index = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); - bar_index < end_index; - ++bar_index) - { - TimerBar& bar = row.mBars[bar_index]; - if (bar.mSelfStart > mouse_time_offset) - { - break; - } - if (bar.mSelfEnd > mouse_time_offset) - { - hover_bar = &bar; - if (bar.mTimeBlock->getTreeNode().mCollapsed) - { - // stop on first collapsed BlockTimerStatHandle, since we can't select any children - break; - } - } - } - - if (hover_bar) - { - mHoverID = hover_bar->mTimeBlock; - if (mHoverTimer != mHoverID) - { - // could be that existing tooltip is for a parent and is thus - // covering region for this new timer, go ahead and unblock - // so we can create a new tooltip - LLToolTipMgr::instance().unblockToolTips(); - mHoverTimer = mHoverID; - mToolTipRect.set((S32)(mBarRect.mLeft + (hover_bar->mSelfStart / mTotalTimeDisplay) * mBarRect.getWidth()), - row.mTop, - (S32)(mBarRect.mLeft + (hover_bar->mSelfEnd / mTotalTimeDisplay) * mBarRect.getWidth()), - row.mBottom); - } - } - } - else if (x < mScrollBar->getRect().mLeft) - { - BlockTimerStatHandle* timer_id = getLegendID(y); - if (timer_id) - { - mHoverID = timer_id; - } - } - - return LLFloater::handleHover(x, y, mask); -} - - -static std::string get_tooltip(BlockTimerStatHandle& timer, S32 history_index, PeriodicRecording& frame_recording) -{ - std::string tooltip; - if (history_index == 0) - { - // by default, show average number of call - tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)F64Milliseconds(frame_recording.getPeriodMean (timer, RUNNING_AVERAGE_WIDTH)).value(), (S32)frame_recording.getPeriodMean(timer.callCount(), RUNNING_AVERAGE_WIDTH)); - } - else - { - tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)F64Milliseconds(frame_recording.getPrevRecording(history_index).getSum(timer)).value(), (S32)frame_recording.getPrevRecording(history_index).getSum(timer.callCount())); - } - return tooltip; -} - -bool LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask) -{ - if(mPauseHistory && mBarRect.pointInRect(x, y)) - { - // tooltips for timer bars - if (mHoverTimer) - { - LLRect screen_rect; - localRectToScreen(mToolTipRect, &screen_rect); - - std::string tooltip = get_tooltip(*mHoverTimer, mHoverBarIndex > 0 ? mScrollIndex + mHoverBarIndex : 0, mRecording); - - LLToolTipMgr::instance().show(LLToolTip::Params() - .message(tooltip) - .sticky_rect(screen_rect) - .delay_time(0.f)); - - return true; - } - } - else - { - // tooltips for timer legend - if (x < mScrollBar->getRect().mLeft) - { - BlockTimerStatHandle* idp = getLegendID(y); - if (idp) - { - LLToolTipMgr::instance().show(get_tooltip(*idp, 0, mRecording)); - - return true; - } - } - } - - return LLFloater::handleToolTip(x, y, mask); -} - -bool LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks) -{ - if (x < mBarRect.mLeft) - { - // Inside mScrollBar and list of timers - mScrollBar->handleScrollWheel(x,y,clicks); - } - else - { - setPauseState(true); - mScrollIndex = llclamp( mScrollIndex + clicks, - 0, - llmin((S32)mRecording.getNumRecordedPeriods(), (S32)mRecording.getNumRecordedPeriods() - MAX_VISIBLE_HISTORY)); - } - return true; -} - -static BlockTimerStatHandle FTM_RENDER_TIMER("Timers"); -static const S32 MARGIN = 10; - -static std::vector sTimerColors; - -void LLFastTimerView::draw() -{ - LL_RECORD_BLOCK_TIME(FTM_RENDER_TIMER); - - if (!mPauseHistory) - { - mRecording.appendRecording(LLTrace::get_frame_recording().getLastRecording()); - mTimerBarRows.pop_back(); - mTimerBarRows.push_front(TimerBarRow()); - } - - mDisplayMode = llclamp(getChild("time_scale_combo")->getCurrentIndex(), 0, 3); - mDisplayType = (EDisplayType)llclamp(getChild("metric_combo")->getCurrentIndex(), 0, 2); - - generateUniqueColors(); - - LLView::drawChildren(); - //getChild("timer_bars_stack")->updateLayout(); - //getChild("legend_stack")->updateLayout(); - LLView* bars_panel = getChildView("bars_panel"); - bars_panel->localRectToOtherView(bars_panel->getLocalRect(), &mBarRect, this); - - LLView* lines_panel = getChildView("lines_panel"); - lines_panel->localRectToOtherView(lines_panel->getLocalRect(), &mGraphRect, this); - - LLView* legend_panel = getChildView("legend"); - legend_panel->localRectToOtherView(legend_panel->getLocalRect(), &mLegendRect, this); - - // Draw the window background - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gl_rect_2d(getLocalRect(), LLColor4(0.f, 0.f, 0.f, 0.25f)); - - drawHelp(getRect().getHeight() - MARGIN); - drawLegend(); - - //mBarRect.mLeft = MARGIN + LEGEND_WIDTH + 8; - //mBarRect.mTop = y; - //mBarRect.mRight = getRect().getWidth() - MARGIN; - //mBarRect.mBottom = MARGIN + LINE_GRAPH_HEIGHT; - - drawBars(); - drawLineGraph(); - printLineStats(); - LLView::draw(); - - mAllTimeMax = llmax(mAllTimeMax, mRecording.getLastRecording().getSum(FTM_FRAME)); - mHoverID = NULL; - mHoverBarIndex = -1; -} - -void LLFastTimerView::onOpen(const LLSD& key) -{ - setPauseState(false); - mRecording.reset(); - mRecording.appendPeriodicRecording(LLTrace::get_frame_recording()); - for(std::deque::iterator it = mTimerBarRows.begin(), end_it = mTimerBarRows.end(); - it != end_it; - ++it) - { - delete []it->mBars; - it->mBars = NULL; - } -} - -void LLFastTimerView::onClose(bool app_quitting) -{ - setVisible(false); -} - -void saveChart(const std::string& label, const char* suffix, LLImageRaw* scratch) -{ - // disable use of glReadPixels which messes up nVidia nSight graphics debugging - if (!LLRender::sNsightDebugSupport) - { - LLImageDataSharedLock lock(scratch); - - //read result back into raw image - glReadPixels(0, 0, 1024, 512, GL_RGB, GL_UNSIGNED_BYTE, scratch->getData()); - - //write results to disk - LLPointer result = new LLImagePNG(); - result->encode(scratch, 0.f); - - std::string ext = result->getExtension(); - std::string filename = llformat("%s_%s.%s", label.c_str(), suffix, ext.c_str()); - - std::string out_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, filename); - result->save(out_file); - } -} - -//static -void LLFastTimerView::exportCharts(const std::string& base, const std::string& target) -{ - //allocate render target for drawing charts - LLRenderTarget buffer; - buffer.allocate(1024,512, GL_RGB); - - - LLSD cur; - - LLSD base_data; - - { //read base log into memory - S32 i = 0; - llifstream is(base.c_str()); - while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is)) - { - base_data[i++] = cur; - } - is.close(); - } - - LLSD cur_data; - std::set chart_names; - - { //read current log into memory - S32 i = 0; - llifstream is(target.c_str()); - while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is)) - { - cur_data[i++] = cur; - - for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter) - { - std::string label = iter->first; - chart_names.insert(label); - } - } - is.close(); - } - - //allocate raw scratch space - LLPointer scratch = new LLImageRaw(1024, 512, 3); - - gGL.pushMatrix(); - gGL.loadIdentity(); - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.loadIdentity(); - gGL.ortho(-0.05f, 1.05f, -0.05f, 1.05f, -1.0f, 1.0f); - - //render charts - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - buffer.bindTarget(); - - for (std::set::iterator iter = chart_names.begin(); iter != chart_names.end(); ++iter) - { - std::string label = *iter; - - LLSD::Real max_time = 0.0; - LLSD::Integer max_calls = 0; - LLSD::Real max_execution = 0.0; - - std::vector cur_execution; - std::vector cur_times; - std::vector cur_calls; - - std::vector base_execution; - std::vector base_times; - std::vector base_calls; - - for (U32 i = 0; i < cur_data.size(); ++i) - { - LLSD::Real time = cur_data[i][label]["Time"].asReal(); - LLSD::Integer calls = cur_data[i][label]["Calls"].asInteger(); - - LLSD::Real execution = 0.0; - if (calls > 0) - { - execution = time/calls; - cur_execution.push_back(execution); - cur_times.push_back(time); - } - - cur_calls.push_back(calls); - } - - for (U32 i = 0; i < base_data.size(); ++i) - { - LLSD::Real time = base_data[i][label]["Time"].asReal(); - LLSD::Integer calls = base_data[i][label]["Calls"].asInteger(); - - LLSD::Real execution = 0.0; - if (calls > 0) - { - execution = time/calls; - base_execution.push_back(execution); - base_times.push_back(time); - } - - base_calls.push_back(calls); - } - - std::sort(base_calls.begin(), base_calls.end()); - std::sort(base_times.begin(), base_times.end()); - std::sort(base_execution.begin(), base_execution.end()); - - std::sort(cur_calls.begin(), cur_calls.end()); - std::sort(cur_times.begin(), cur_times.end()); - std::sort(cur_execution.begin(), cur_execution.end()); - - //remove outliers - const U32 OUTLIER_CUTOFF = 512; - if (base_times.size() > OUTLIER_CUTOFF) - { - ll_remove_outliers(base_times, 1.f); - } - - if (base_execution.size() > OUTLIER_CUTOFF) - { - ll_remove_outliers(base_execution, 1.f); - } - - if (cur_times.size() > OUTLIER_CUTOFF) - { - ll_remove_outliers(cur_times, 1.f); - } - - if (cur_execution.size() > OUTLIER_CUTOFF) - { - ll_remove_outliers(cur_execution, 1.f); - } - - - max_time = llmax(base_times.empty() ? 0.0 : *base_times.rbegin(), cur_times.empty() ? 0.0 : *cur_times.rbegin()); - max_calls = llmax(base_calls.empty() ? 0 : *base_calls.rbegin(), cur_calls.empty() ? 0 : *cur_calls.rbegin()); - max_execution = llmax(base_execution.empty() ? 0.0 : *base_execution.rbegin(), cur_execution.empty() ? 0.0 : *cur_execution.rbegin()); - - - LLVector3 last_p; - - //==================================== - // basic - //==================================== - buffer.clear(); - - last_p.clear(); - - LLGLDisable cull(GL_CULL_FACE); - - LLVector3 base_col(0, 0.7f, 0.f); - LLVector3 cur_col(1.f, 0.f, 0.f); - - gGL.setSceneBlendType(LLRender::BT_ADD); - - gGL.color3fv(base_col.mV); - for (U32 i = 0; i < base_times.size(); ++i) - { - gGL.begin(LLRender::TRIANGLE_STRIP); - gGL.vertex3fv(last_p.mV); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - last_p.set((F32)i/(F32) base_times.size(), (F32)(base_times[i]/max_time), 0.f); - gGL.vertex3fv(last_p.mV); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.end(); - } - - gGL.flush(); - - - last_p.clear(); - { - LLGLEnable blend(GL_BLEND); - - gGL.color3fv(cur_col.mV); - for (U32 i = 0; i < cur_times.size(); ++i) - { - gGL.begin(LLRender::TRIANGLE_STRIP); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.vertex3fv(last_p.mV); - last_p.set((F32) i / (F32) cur_times.size(), (F32)(cur_times[i]/max_time), 0.f); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.vertex3fv(last_p.mV); - gGL.end(); - } - - gGL.flush(); - } - - saveChart(label, "time", scratch); - - //====================================== - // calls - //====================================== - buffer.clear(); - - last_p.clear(); - - gGL.color3fv(base_col.mV); - for (U32 i = 0; i < base_calls.size(); ++i) - { - gGL.begin(LLRender::TRIANGLE_STRIP); - gGL.vertex3fv(last_p.mV); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - last_p.set((F32) i / (F32) base_calls.size(), (F32)base_calls[i]/max_calls, 0.f); - gGL.vertex3fv(last_p.mV); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.end(); - } - - gGL.flush(); - - { - LLGLEnable blend(GL_BLEND); - gGL.color3fv(cur_col.mV); - last_p.clear(); - - for (U32 i = 0; i < cur_calls.size(); ++i) - { - gGL.begin(LLRender::TRIANGLE_STRIP); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.vertex3fv(last_p.mV); - last_p.set((F32) i / (F32) cur_calls.size(), (F32) cur_calls[i]/max_calls, 0.f); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.vertex3fv(last_p.mV); - gGL.end(); - - } - - gGL.flush(); - } - - saveChart(label, "calls", scratch); - - //====================================== - // execution - //====================================== - buffer.clear(); - - gGL.color3fv(base_col.mV); - U32 count = 0; - U32 total_count = static_cast(base_execution.size()); - - last_p.clear(); - - for (std::vector::iterator iter = base_execution.begin(); iter != base_execution.end(); ++iter) - { - gGL.begin(LLRender::TRIANGLE_STRIP); - gGL.vertex3fv(last_p.mV); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - last_p.set((F32)count/(F32)total_count, (F32)(*iter/max_execution), 0.f); - gGL.vertex3fv(last_p.mV); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.end(); - count++; - } - - last_p.clear(); - - { - LLGLEnable blend(GL_BLEND); - gGL.color3fv(cur_col.mV); - count = 0; - total_count = static_cast(cur_execution.size()); - - for (std::vector::iterator iter = cur_execution.begin(); iter != cur_execution.end(); ++iter) - { - gGL.begin(LLRender::TRIANGLE_STRIP); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.vertex3fv(last_p.mV); - last_p.set((F32)count/(F32)total_count, (F32)(*iter/max_execution), 0.f); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.vertex3fv(last_p.mV); - gGL.end(); - count++; - } - - gGL.flush(); - } - - saveChart(label, "execution", scratch); - } - - buffer.flush(); - - gGL.popMatrix(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.popMatrix(); -} - -//static -LLSD LLFastTimerView::analyzePerformanceLogDefault(std::istream& is) -{ - LLSD ret; - - LLSD cur; - - LLSD::Real total_time = 0.0; - LLSD::Integer total_frames = 0; - - typedef std::map stats_map_t; - stats_map_t time_stats; - stats_map_t sample_stats; - - while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is)) - { - for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter) - { - std::string label = iter->first; - - F64 time = iter->second["Time"].asReal(); - - // Skip the total figure - if(label.compare("Total") != 0) - { - total_time += time; - } - - if (time > 0.0) - { - LLSD::Integer samples = iter->second["Calls"].asInteger(); - - time_stats[label].push((F32)time); - sample_stats[label].push((F32)samples); - } - } - total_frames++; - } - - for(stats_map_t::iterator it = time_stats.begin(); it != time_stats.end(); ++it) - { - std::string label = it->first; - ret[label]["TotalTime"] = time_stats[label].getSum(); - ret[label]["MeanTime"] = time_stats[label].getMean(); - ret[label]["MaxTime"] = time_stats[label].getMaxValue(); - ret[label]["MinTime"] = time_stats[label].getMinValue(); - ret[label]["StdDevTime"] = time_stats[label].getStdDev(); - - ret[label]["Samples"] = sample_stats[label].getSum(); - ret[label]["MaxSamples"] = sample_stats[label].getMaxValue(); - ret[label]["MinSamples"] = sample_stats[label].getMinValue(); - ret[label]["StdDevSamples"] = sample_stats[label].getStdDev(); - - ret[label]["Frames"] = (LLSD::Integer)time_stats[label].getCount(); - } - - ret["SessionTime"] = total_time; - ret["FrameCount"] = total_frames; - - return ret; - -} - -//static -void LLFastTimerView::doAnalysisDefault(std::string baseline, std::string target, std::string output) -{ - // Open baseline and current target, exit if one is inexistent - llifstream base_is(baseline.c_str()); - llifstream target_is(target.c_str()); - if (!base_is.is_open() || !target_is.is_open()) - { - LL_WARNS() << "'-analyzeperformance' error : baseline or current target file inexistent" << LL_ENDL; - base_is.close(); - target_is.close(); - return; - } - - //analyze baseline - LLSD base = analyzePerformanceLogDefault(base_is); - base_is.close(); - - //analyze current - LLSD current = analyzePerformanceLogDefault(target_is); - target_is.close(); - - //output comparison - llofstream os(output.c_str()); - - LLSD::Real session_time = current["SessionTime"].asReal(); - os << - "Label, " - "% Change, " - "% of Session, " - "Cur Min, " - "Cur Max, " - "Cur Mean/sample, " - "Cur Mean/frame, " - "Cur StdDev/frame, " - "Cur Total, " - "Cur Frames, " - "Cur Samples, " - "Base Min, " - "Base Max, " - "Base Mean/sample, " - "Base Mean/frame, " - "Base StdDev/frame, " - "Base Total, " - "Base Frames, " - "Base Samples\n"; - - for (LLSD::map_iterator iter = base.beginMap(); iter != base.endMap(); ++iter) - { - LLSD::String label = iter->first; - - if (current[label]["Samples"].asInteger() == 0 || - base[label]["Samples"].asInteger() == 0) - { - //cannot compare - continue; - } - LLSD::Real a = base[label]["TotalTime"].asReal() / base[label]["Samples"].asReal(); - LLSD::Real b = current[label]["TotalTime"].asReal() / current[label]["Samples"].asReal(); - - LLSD::Real diff = b-a; - - LLSD::Real perc = diff/a * 100; - - os << llformat("%s, %.2f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %d, %d, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %d, %d\n", - label.c_str(), - (F32) perc, - (F32) (current[label]["TotalTime"].asReal()/session_time * 100.0), - - (F32) current[label]["MinTime"].asReal(), - (F32) current[label]["MaxTime"].asReal(), - (F32) b, - (F32) current[label]["MeanTime"].asReal(), - (F32) current[label]["StdDevTime"].asReal(), - (F32) current[label]["TotalTime"].asReal(), - current[label]["Frames"].asInteger(), - current[label]["Samples"].asInteger(), - (F32) base[label]["MinTime"].asReal(), - (F32) base[label]["MaxTime"].asReal(), - (F32) a, - (F32) base[label]["MeanTime"].asReal(), - (F32) base[label]["StdDevTime"].asReal(), - (F32) base[label]["TotalTime"].asReal(), - base[label]["Frames"].asInteger(), - base[label]["Samples"].asInteger()); - } - - exportCharts(baseline, target); - - os.flush(); - os.close(); -} - -//static -void LLFastTimerView::outputAllMetrics() -{ - if (LLMetricPerformanceTesterBasic::hasMetricPerformanceTesters()) - { - for (LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin(); - iter != LLMetricPerformanceTesterBasic::sTesterMap.end(); ++iter) - { - LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second); - tester->outputTestResults(); - } - } -} - -//static -void LLFastTimerView::doAnalysis(std::string baseline, std::string target, std::string output) -{ - if(BlockTimer::sLog) - { - doAnalysisDefault(baseline, target, output) ; - return ; - } - - if(BlockTimer::sMetricLog) - { - LLMetricPerformanceTesterBasic::doAnalysisMetrics(baseline, target, output) ; - return ; - } -} - - -void LLFastTimerView::printLineStats() -{ - // Output stats for clicked bar to log - if (mStatsIndex >= 0) - { - std::string legend_stat; - bool first = true; - for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); - it != LLTrace::end_block_timer_tree_df(); - ++it) - { - BlockTimerStatHandle* idp = (*it); - - if (!first) - { - legend_stat += ", "; - } - first = false; - legend_stat += idp->getName(); - - //if (idp->getTreeNode().mCollapsed) - //{ - // it.skipDescendants(); - //} - } - LL_INFOS() << legend_stat << LL_ENDL; - - std::string timer_stat; - first = true; - for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); - it != LLTrace::end_block_timer_tree_df(); - ++it) - { - BlockTimerStatHandle* idp = (*it); - - if (!first) - { - timer_stat += ", "; - } - first = false; - - F32Seconds ticks; - if (mStatsIndex == 0) - { - ticks = mRecording.getPeriodMean(*idp, RUNNING_AVERAGE_WIDTH); - } - else - { - ticks = mRecording.getPrevRecording(mStatsIndex).getSum(*idp); - } - F32Milliseconds ms = ticks; - - timer_stat += llformat("%.1f",ms.value()); - - //if (idp->getTreeNode().mCollapsed) - //{ - // it.skipDescendants(); - //} - } - LL_INFOS() << timer_stat << LL_ENDL; - mStatsIndex = -1; - } -} - -void LLFastTimerView::drawLineGraph() -{ - LL_PROFILE_ZONE_SCOPED; - //draw line graph history - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLLocalClipRect clip(mGraphRect); - - //normalize based on last frame's maximum - static F32Seconds max_time(0.000001); - static U32 max_calls = 0; - static F32 alpha_interp = 0.f; - - //highlight visible range - { - S32 first_frame = static_cast(mRecording.getNumRecordedPeriods()) - mScrollIndex; - S32 last_frame = first_frame - MAX_VISIBLE_HISTORY; - - F32 frame_delta = ((F32) (mGraphRect.getWidth()))/(mRecording.getNumRecordedPeriods()-1); - - F32 right = (F32) mGraphRect.mLeft + frame_delta*first_frame; - F32 left = (F32) mGraphRect.mLeft + frame_delta*last_frame; - - gGL.color4f(0.5f,0.5f,0.5f,0.3f); - gl_rect_2d((S32) left, mGraphRect.mTop, (S32) right, mGraphRect.mBottom); - - if (mHoverBarIndex > 0) - { - S32 bar_frame = first_frame - (mScrollIndex + mHoverBarIndex) - 1; - F32 bar = (F32) mGraphRect.mLeft + frame_delta*bar_frame; - - gGL.color4f(0.5f,0.5f,0.5f,1); - - gGL.begin(LLRender::LINES); - gGL.vertex2i((S32)bar, mGraphRect.mBottom); - gGL.vertex2i((S32)bar, mGraphRect.mTop); - gGL.end(); - } - } - - F32Seconds cur_max(0); - U32 cur_max_calls = 0; - - for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); - it != LLTrace::end_block_timer_tree_df(); - ++it) - { - BlockTimerStatHandle* idp = (*it); - - //fatten highlighted timer - if (mHoverID == idp) - { - gGL.setLineWidth(3); - } - - llassert(idp->getIndex() < sTimerColors.size()); - const F32 * col = sTimerColors[idp->getIndex()].mV;// ft_display_table[idx].color->mV; - - F32 alpha = 1.f; - bool is_hover_timer = true; - - if (mHoverID != NULL && - mHoverID != idp) - { //fade out non-highlighted timers - if (idp->getParent() != mHoverID) - { - alpha = alpha_interp; - is_hover_timer = false; - } - } - - gGL.color4f(col[0], col[1], col[2], alpha); - gGL.begin(LLRender::TRIANGLE_STRIP); - F32 call_scale_factor = (F32)mGraphRect.getHeight() / (F32)max_calls; - F32 time_scale_factor = (F32)mGraphRect.getHeight() / max_time.value(); - F32 hz_scale_factor = (F32) mGraphRect.getHeight() / (1.f / max_time.value()); - - for (U32 j = static_cast(mRecording.getNumRecordedPeriods()); - j > 0; - j--) - { - LLTrace::Recording& recording = mRecording.getPrevRecording(j); - F32Seconds time = llmax(recording.getSum(*idp), F64Seconds(0.000001)); - U32 calls = recording.getSum(idp->callCount()); - - if (is_hover_timer) - { - //normalize to highlighted timer - cur_max = llmax(cur_max, time); - cur_max_calls = llmax(cur_max_calls, calls); - } - F32 x = mGraphRect.mRight - j * (F32)(mGraphRect.getWidth())/(mRecording.getNumRecordedPeriods()-1); - F32 y; - switch(mDisplayType) -{ - case DISPLAY_TIME: - y = mGraphRect.mBottom + time.value() * time_scale_factor; - break; - case DISPLAY_CALLS: - y = mGraphRect.mBottom + (F32)calls * call_scale_factor; - break; - case DISPLAY_HZ: - y = mGraphRect.mBottom + (1.f / time.value()) * hz_scale_factor; - break; - } - gGL.vertex2f(x,y); - gGL.vertex2f(x,(GLfloat)mGraphRect.mBottom); - } - gGL.end(); - - if (mHoverID == idp) - { - gGL.setLineWidth(1.f); - } - - if (idp->getTreeNode().mCollapsed) - { - //skip hidden timers - it.skipDescendants(); - } - } - - //interpolate towards new maximum - max_time = (F32Seconds)lerp(max_time.value(), cur_max.value(), LLSmoothInterpolation::getInterpolant(0.1f)); - if (llabs((max_time - cur_max).value()) <= 1) - { - max_time = llmax(F32Microseconds(1.f), F32Microseconds(cur_max)); - } - - max_calls = ll_round(lerp((F32)max_calls, (F32) cur_max_calls, LLSmoothInterpolation::getInterpolant(0.1f))); - if (llabs((S32)(max_calls - cur_max_calls)) <= 1) - { - max_calls = cur_max_calls; - } - - // TODO: make sure alpha is correct in DisplayHz mode - F32 alpha_target = (max_time > cur_max) - ? llmin(max_time / cur_max - 1.f,1.f) - : llmin(cur_max/ max_time - 1.f,1.f); - alpha_interp = lerp(alpha_interp, alpha_target, LLSmoothInterpolation::getInterpolant(0.1f)); - - if (mHoverID != NULL) - { - S32 x = (mGraphRect.mRight + mGraphRect.mLeft)/2; - S32 y = mGraphRect.mBottom + 8; - - LLFontGL::getFontMonospace()->renderUTF8( - mHoverID->getName(), - 0, - x, y, - LLColor4::white, - LLFontGL::LEFT, LLFontGL::BOTTOM); - } - - //display y-axis range - std::string axis_label; - switch(mDisplayType) - { - case DISPLAY_TIME: - axis_label = llformat("%4.2f ms", F32Milliseconds(max_time).value()); - break; - case DISPLAY_CALLS: - axis_label = llformat("%d calls", (int)max_calls); - break; - case DISPLAY_HZ: - axis_label = llformat("%4.2f Hz", max_time.value() ? 1.f / max_time.value() : 0.f); - break; - } - - LLFontGL* font = LLFontGL::getFontMonospace(); - S32 x = mGraphRect.mRight - font->getWidth(axis_label)-5; - S32 y = mGraphRect.mTop - font->getLineHeight();; - - font->renderUTF8(axis_label, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); -} - -void LLFastTimerView::drawLegend() -{ - // draw legend - S32 dx; - S32 x = mLegendRect.mLeft; - S32 y = mLegendRect.mTop; - const S32 TEXT_HEIGHT = (S32)LLFontGL::getFontMonospace()->getLineHeight(); - - { - LLLocalClipRect clip(mLegendRect); - S32 cur_line = 0; - S32 scroll_offset = 0; // element's y offset from top of the inner scroll's rect - ft_display_idx.clear(); - std::map display_line; - for (LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); - it != LLTrace::end_block_timer_tree_df(); - ++it) - { - BlockTimerStatHandle* idp = (*it); - // Needed to figure out offsets and parenting - display_line[idp] = cur_line; - cur_line++; - if (scroll_offset < mScrollBar->getDocPos()) - { - // only offset for visible items - scroll_offset += TEXT_HEIGHT + 2; - if (idp->getTreeNode().mCollapsed) - { - it.skipDescendants(); - } - continue; - } - - // used for mouse clicks - ft_display_idx.push_back(idp); - - // Actual draw, first bar (square), then text - x = MARGIN; - - LLRect bar_rect(x, y, x + TEXT_HEIGHT, y - TEXT_HEIGHT); - S32 scale_offset = 0; - if (idp == mHoverID) - { - scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 2.f); - } - bar_rect.stretch(scale_offset); - llassert(idp->getIndex() < sTimerColors.size()); - gl_rect_2d(bar_rect, sTimerColors[idp->getIndex()]); - - F32Milliseconds ms(0); - S32 calls = 0; - if (mHoverBarIndex > 0 && mHoverID) - { - S32 hidx = mScrollIndex + mHoverBarIndex; - ms = mRecording.getPrevRecording(hidx).getSum(*idp); - calls = mRecording.getPrevRecording(hidx).getSum(idp->callCount()); - } - else - { - ms = F64Seconds(mRecording.getPeriodMean(*idp, RUNNING_AVERAGE_WIDTH)); - calls = (S32)mRecording.getPeriodMean(idp->callCount(), RUNNING_AVERAGE_WIDTH); - } - - std::string timer_label; - switch(mDisplayType) - { - case DISPLAY_TIME: - timer_label = llformat("%s [%.1f]",idp->getName().c_str(),ms.value()); - break; - case DISPLAY_CALLS: - timer_label = llformat("%s (%d)",idp->getName().c_str(),calls); - break; - case DISPLAY_HZ: - timer_label = llformat("%.1f", ms.value() ? (1.f / ms.value()) : 0.f); - break; - } - dx = (TEXT_HEIGHT+4) + get_depth(idp)*8; - - LLColor4 color = LLColor4::white; - if (get_depth(idp) > 0) - { - S32 line_start_y = bar_rect.getCenterY(); - S32 line_end_y = line_start_y + ((TEXT_HEIGHT + 2) * (cur_line - display_line[idp->getParent()])) - TEXT_HEIGHT; - gl_line_2d(x + dx - 8, line_start_y, x + dx, line_start_y, color); - S32 line_x = x + (TEXT_HEIGHT + 4) + ((get_depth(idp) - 1) * 8); - gl_line_2d(line_x, line_start_y, line_x, line_end_y, color); - if (idp->getTreeNode().mCollapsed && !idp->getChildren().empty()) - { - gl_line_2d(line_x+4, line_start_y-3, line_x+4, line_start_y+4, color); - } - } - - x += dx; - bool is_child_of_hover_item = (idp == mHoverID); - BlockTimerStatHandle* next_parent = idp->getParent(); - while(!is_child_of_hover_item && next_parent) - { - is_child_of_hover_item = (mHoverID == next_parent); - if (next_parent->getParent() == next_parent) break; - next_parent = next_parent->getParent(); - } - - LLFontGL::getFontMonospace()->renderUTF8(timer_label, 0, - x, y, - color, - LLFontGL::LEFT, LLFontGL::TOP, - is_child_of_hover_item ? LLFontGL::BOLD : LLFontGL::NORMAL); - - y -= (TEXT_HEIGHT + 2); - - scroll_offset += TEXT_HEIGHT + 2; - if (idp->getTreeNode().mCollapsed) - { - it.skipDescendants(); - } - } - // Recalculate scroll size - mScrollBar->setDocSize(scroll_offset - mLegendRect.getHeight()); - } -} - -void LLFastTimerView::generateUniqueColors() -{ - // generate unique colors - { - sTimerColors.resize(LLTrace::BlockTimerStatHandle::getNumIndices()); - sTimerColors[FTM_FRAME.getIndex()] = LLColor4::grey; - - F32 hue = 0.f; - - for (LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); - it != LLTrace::end_block_timer_tree_df(); - ++it) - { - BlockTimerStatHandle* idp = (*it); - - const F32 HUE_INCREMENT = 0.23f; - hue = fmodf(hue + HUE_INCREMENT, 1.f); - // saturation increases with depth - F32 saturation = clamp_rescale((F32)get_depth(idp), 0.f, 3.f, 0.f, 1.f); - // lightness alternates with depth - F32 lightness = get_depth(idp) % 2 ? 0.5f : 0.6f; - - LLColor4 child_color; - child_color.setHSL(hue, saturation, lightness); - - llassert(idp->getIndex() < sTimerColors.size()); - sTimerColors[idp->getIndex()] = child_color; - } - } -} - -void LLFastTimerView::drawHelp( S32 y ) -{ - // Draw some help - const S32 texth = (S32)LLFontGL::getFontMonospace()->getLineHeight(); - - y -= (texth + 2); - y -= (texth + 2); - - LLFontGL::getFontMonospace()->renderUTF8(std::string("[Right-Click log selected]"), - 0, MARGIN, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); -} - -void LLFastTimerView::drawTicks() -{ - // Draw MS ticks - { - U32Milliseconds ms = mTotalTimeDisplay; - std::string tick_label; - S32 x; - S32 barw = mBarRect.getWidth(); - - tick_label = llformat("%.1f ms |", (F32)ms.value()*.25f); - x = mBarRect.mLeft + barw/4 - LLFontGL::getFontMonospace()->getWidth(tick_label); - LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white, - LLFontGL::LEFT, LLFontGL::TOP); - - tick_label = llformat("%.1f ms |", (F32)ms.value()*.50f); - x = mBarRect.mLeft + barw/2 - LLFontGL::getFontMonospace()->getWidth(tick_label); - LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white, - LLFontGL::LEFT, LLFontGL::TOP); - - tick_label = llformat("%.1f ms |", (F32)ms.value()*.75f); - x = mBarRect.mLeft + (barw*3)/4 - LLFontGL::getFontMonospace()->getWidth(tick_label); - LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white, - LLFontGL::LEFT, LLFontGL::TOP); - - tick_label = llformat( "%d ms |", (U32)ms.value()); - x = mBarRect.mLeft + barw - LLFontGL::getFontMonospace()->getWidth(tick_label); - LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white, - LLFontGL::LEFT, LLFontGL::TOP); - } -} - -void LLFastTimerView::drawBorders( S32 y, const S32 x_start, S32 bar_height, S32 dy ) -{ - // Draw borders - { - S32 by = y + 6 + (S32)LLFontGL::getFontMonospace()->getLineHeight(); - - //heading - gl_rect_2d(x_start-5, by, getRect().getWidth()-5, y+5, LLColor4::grey, false); - - //tree view - gl_rect_2d(5, by, x_start-10, 5, LLColor4::grey, false); - - by = y + 5; - //average bar - gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-5, LLColor4::grey, false); - - by -= bar_height*2+dy; - - //current frame bar - gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-2, LLColor4::grey, false); - - by -= bar_height+dy+1; - - //history bars - gl_rect_2d(x_start-5, by, getRect().getWidth()-5, LINE_GRAPH_HEIGHT-bar_height-dy-2, LLColor4::grey, false); - - by = LINE_GRAPH_HEIGHT-dy; - - //line graph - //mGraphRect = LLRect(x_start-5, by, getRect().getWidth()-5, 5); - - gl_rect_2d(mGraphRect, false); - } -} - -void LLFastTimerView::updateTotalTime() -{ - switch(mDisplayMode) - { - case 0: - mTotalTimeDisplay = mRecording.getPeriodMean(FTM_FRAME, RUNNING_AVERAGE_WIDTH)*2; - break; - case 1: - mTotalTimeDisplay = mRecording.getPeriodMax(FTM_FRAME); - break; - case 2: - // Calculate the max total ticks for the current history - mTotalTimeDisplay = mRecording.getPeriodMax(FTM_FRAME, 20); - break; - default: - mTotalTimeDisplay = F64Milliseconds(100); - break; - } - - mTotalTimeDisplay = LLUnits::Milliseconds::fromValue(llceil((F32)mTotalTimeDisplay.valueInUnits() / 20.f) * 20.f); -} - -void LLFastTimerView::drawBars() -{ - LL_PROFILE_ZONE_SCOPED; - LLLocalClipRect clip(mBarRect); - - S32 bar_height = mBarRect.getHeight() / (MAX_VISIBLE_HISTORY + 2); - const S32 vpad = llmax(1, bar_height / 4); // spacing between bars - bar_height -= vpad; - - updateTotalTime(); - if (mTotalTimeDisplay <= (F32Seconds)0.0) return; - - drawTicks(); - const S32 bars_top = mBarRect.mTop - ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4); - drawBorders(bars_top, mBarRect.mLeft, bar_height, vpad); - - // Draw bars for each history entry - // Special: 0 = show running average - LLPointer bar_image = LLUI::getUIImage("Rounded_Square"); - - const S32 image_width = bar_image->getTextureWidth(); - const S32 image_height = bar_image->getTextureHeight(); - - gGL.getTexUnit(0)->bind(bar_image->getImage()); - { - const S32 histmax = (S32)mRecording.getNumRecordedPeriods(); - - // update widths - if (!mPauseHistory) - { - U32 bar_index = 0; - if (!mAverageTimerRow.mBars) - { - mAverageTimerRow.mBars = new TimerBar[LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount()]; - } - updateTimerBarWidths(&FTM_FRAME, mAverageTimerRow, -1, bar_index); - updateTimerBarOffsets(&FTM_FRAME, mAverageTimerRow); - - for (S32 history_index = 1; history_index <= histmax; history_index++) - { - llassert(history_index <= mTimerBarRows.size()); - TimerBarRow& row = mTimerBarRows[history_index - 1]; - bar_index = 0; - if (!row.mBars) - { - row.mBars = new TimerBar[LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount()]; - updateTimerBarWidths(&FTM_FRAME, row, history_index, bar_index); - updateTimerBarOffsets(&FTM_FRAME, row); - } - } - } - - // draw bars - LLRect frame_bar_rect; - frame_bar_rect.setLeftTopAndSize(mBarRect.mLeft, - bars_top, - (S32)ll_round((mAverageTimerRow.mBars[0].mTotalTime / mTotalTimeDisplay) * mBarRect.getWidth()), - bar_height); - mAverageTimerRow.mTop = frame_bar_rect.mTop; - mAverageTimerRow.mBottom = frame_bar_rect.mBottom; - drawBar(frame_bar_rect, mAverageTimerRow, image_width, image_height); - frame_bar_rect.translate(0, -(bar_height + vpad + bar_height)); - - for(S32 bar_index = mScrollIndex; bar_index < llmin(histmax, mScrollIndex + MAX_VISIBLE_HISTORY); ++bar_index) - { - llassert(bar_index < mTimerBarRows.size()); - TimerBarRow& row = mTimerBarRows[bar_index]; - row.mTop = frame_bar_rect.mTop; - row.mBottom = frame_bar_rect.mBottom; - frame_bar_rect.mRight = frame_bar_rect.mLeft - + (S32)ll_round((row.mBars[0].mTotalTime / mTotalTimeDisplay) * mBarRect.getWidth()); - drawBar(frame_bar_rect, row, image_width, image_height); - - frame_bar_rect.translate(0, -(bar_height + vpad)); - } - - } - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); -} - -F32Seconds LLFastTimerView::updateTimerBarWidths(LLTrace::BlockTimerStatHandle* time_block, TimerBarRow& row, S32 history_index, U32& bar_index) -{ - LL_PROFILE_ZONE_SCOPED; - const F32Seconds self_time = history_index == -1 - ? mRecording.getPeriodMean(time_block->selfTime(), RUNNING_AVERAGE_WIDTH) - : mRecording.getPrevRecording(history_index).getSum(time_block->selfTime()); - - F32Seconds full_time = self_time; - - // reserve a spot for this bar to be rendered before its children - // even though we don't know its size yet - TimerBar& timer_bar = row.mBars[bar_index]; - bar_index++; - - for (BlockTimerStatHandle::child_iter it = time_block->beginChildren(), end_it = time_block->endChildren(); it != end_it; ++it) - { - full_time += updateTimerBarWidths(*it, row, history_index, bar_index); - } - - timer_bar.mTotalTime = full_time; - timer_bar.mSelfTime = self_time; - timer_bar.mTimeBlock = time_block; - - return full_time; -} - -S32 LLFastTimerView::updateTimerBarOffsets(LLTrace::BlockTimerStatHandle* time_block, TimerBarRow& row, S32 timer_bar_index) -{ - LL_PROFILE_ZONE_SCOPED; - - TimerBar& timer_bar = row.mBars[timer_bar_index]; - const F32Seconds bar_time = timer_bar.mTotalTime - timer_bar.mSelfTime; - timer_bar.mChildrenStart = timer_bar.mSelfStart + timer_bar.mSelfTime / 2; - timer_bar.mChildrenEnd = timer_bar.mChildrenStart + timer_bar.mTotalTime - timer_bar.mSelfTime; - - if (timer_bar_index == 0) - { - timer_bar.mSelfStart = F32Seconds(0.f); - timer_bar.mSelfEnd = bar_time; - } - - //now loop through children and figure out portion of bar image covered by each bar, now that we know the - //sum of all children - F32 bar_fraction_start = 0.f; - TimerBar* last_child_timer_bar = NULL; - - bool first_child = true; - for (BlockTimerStatHandle::child_iter it = time_block->beginChildren(), end_it = time_block->endChildren(); - it != end_it; - ++it) - { - timer_bar_index++; - - TimerBar& child_timer_bar = row.mBars[timer_bar_index]; - BlockTimerStatHandle* child_time_block = *it; - - if (last_child_timer_bar) - { - last_child_timer_bar->mLastChild = false; - } - child_timer_bar.mLastChild = true; - last_child_timer_bar = &child_timer_bar; - - child_timer_bar.mFirstChild = first_child; - if (first_child) - { - first_child = false; - } - - child_timer_bar.mStartFraction = bar_fraction_start; - child_timer_bar.mEndFraction = bar_time > (S32Seconds)0 - ? bar_fraction_start + child_timer_bar.mTotalTime / bar_time - : 1.f; - child_timer_bar.mSelfStart = timer_bar.mChildrenStart - + child_timer_bar.mStartFraction - * (timer_bar.mChildrenEnd - timer_bar.mChildrenStart); - child_timer_bar.mSelfEnd = timer_bar.mChildrenStart - + child_timer_bar.mEndFraction - * (timer_bar.mChildrenEnd - timer_bar.mChildrenStart); - - timer_bar_index = updateTimerBarOffsets(child_time_block, row, timer_bar_index); - - bar_fraction_start = child_timer_bar.mEndFraction; - } - return timer_bar_index; -} - -S32 LLFastTimerView::drawBar(LLRect bar_rect, TimerBarRow& row, S32 image_width, S32 image_height, bool hovered, bool visible, S32 bar_index) -{ - LL_PROFILE_ZONE_SCOPED; - TimerBar& timer_bar = row.mBars[bar_index]; - LLTrace::BlockTimerStatHandle* time_block = timer_bar.mTimeBlock; - - hovered |= mHoverID == time_block; - - // animate scale of bar when hovering over that particular timer - if (visible && (F32)bar_rect.getWidth() * (timer_bar.mEndFraction - timer_bar.mStartFraction) > 2.f) - { - LLRect render_rect(bar_rect); - S32 scale_offset = 0; - if (mHoverID == time_block) - { - scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 3.f); - render_rect.mTop += scale_offset; - render_rect.mBottom -= scale_offset; - } - - llassert(time_block->getIndex() < sTimerColors.size()); - LLColor4 color = sTimerColors[time_block->getIndex()]; - if (!hovered) color = lerp(color, LLColor4::grey, 0.2f); - gGL.color4fv(color.mV); - gl_segmented_rect_2d_fragment_tex(render_rect, - image_width, image_height, - 16, - timer_bar.mStartFraction, timer_bar.mEndFraction); - } - - LLRect children_rect; - children_rect.mLeft = (S32)ll_round(timer_bar.mChildrenStart / mTotalTimeDisplay * (F32)mBarRect.getWidth()) + mBarRect.mLeft; - children_rect.mRight = (S32)ll_round(timer_bar.mChildrenEnd / mTotalTimeDisplay * (F32)mBarRect.getWidth()) + mBarRect.mLeft; - - if (bar_rect.getHeight() > MIN_BAR_HEIGHT) - { - // shrink as we go down a level - children_rect.mTop = bar_rect.mTop - 1; - children_rect.mBottom = bar_rect.mBottom + 1; - } - else - { - children_rect.mTop = bar_rect.mTop; - children_rect.mBottom = bar_rect.mBottom; - } - - bool children_visible = visible && !time_block->getTreeNode().mCollapsed; - - bar_index++; - const auto num_bars = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); - if (bar_index < num_bars && row.mBars[bar_index].mFirstChild) - { - bool is_last = false; - do - { - is_last = row.mBars[bar_index].mLastChild; - bar_index = drawBar(children_rect, row, image_width, image_height, hovered, children_visible, bar_index); - } - while(!is_last && bar_index < num_bars); - } - - return bar_index; -} diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h deleted file mode 100644 index e0ef52f166c..00000000000 --- a/indra/newview/llfasttimerview.h +++ /dev/null @@ -1,151 +0,0 @@ -/** - * @file llfasttimerview.h - * @brief LLFastTimerView class definition - * - * $LicenseInfo:firstyear=2004&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLFASTTIMERVIEW_H -#define LL_LLFASTTIMERVIEW_H - -#include "llfloater.h" -#include "llfasttimer.h" -#include "llunits.h" -#include "lltracerecording.h" -#include - -class LLScrollbar; - -class LLFastTimerView : public LLFloater -{ -public: - LLFastTimerView(const LLSD&); - ~LLFastTimerView(); - bool postBuild(); - - static bool sAnalyzePerformance; - - static void outputAllMetrics(); - static void doAnalysis(std::string baseline, std::string target, std::string output); - -private: - static void doAnalysisDefault(std::string baseline, std::string target, std::string output) ; - static LLSD analyzePerformanceLogDefault(std::istream& is) ; - static void exportCharts(const std::string& base, const std::string& target); - void onPause(); - -public: - - virtual bool handleMouseDown(S32 x, S32 y, MASK mask); - virtual bool handleDoubleClick(S32 x, S32 y, MASK mask); - virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual bool handleMouseUp(S32 x, S32 y, MASK mask); - virtual bool handleHover(S32 x, S32 y, MASK mask); - virtual bool handleToolTip(S32 x, S32 y, MASK mask); - virtual bool handleScrollWheel(S32 x, S32 y, S32 clicks); - virtual void draw(); - virtual void onOpen(const LLSD& key); - virtual void onClose(bool app_quitting); - LLTrace::BlockTimerStatHandle* getLegendID(S32 y); - -private: - void drawTicks(); - void drawLineGraph(); - void drawLegend(); - void drawHelp(S32 y); - void drawBorders( S32 y, const S32 x_start, S32 barh, S32 dy); - void drawBars(); - - void printLineStats(); - void generateUniqueColors(); - void updateTotalTime(); - - struct TimerBar - { - TimerBar() - : mTotalTime(0), - mSelfTime(0), - mStartFraction(0.f), - mEndFraction(1.f), - mFirstChild(false), - mLastChild(false) - {} - F32Seconds mTotalTime, - mSelfTime, - mChildrenStart, - mChildrenEnd, - mSelfStart, - mSelfEnd; - LLTrace::BlockTimerStatHandle* mTimeBlock; - bool mVisible, - mFirstChild, - mLastChild; - F32 mStartFraction, - mEndFraction; - }; - - struct TimerBarRow - { - TimerBarRow() - : mBottom(0), - mTop(0), - mBars(NULL) - {} - S32 mBottom, - mTop; - TimerBar* mBars; - }; - - F32Seconds updateTimerBarWidths(LLTrace::BlockTimerStatHandle* time_block, TimerBarRow& row, S32 history_index, U32& bar_index); - S32 updateTimerBarOffsets(LLTrace::BlockTimerStatHandle* time_block, TimerBarRow& row, S32 timer_bar_index = 0); - S32 drawBar(LLRect bar_rect, TimerBarRow& row, S32 image_width, S32 image_height, bool hovered = false, bool visible = true, S32 bar_index = 0); - void setPauseState(bool pause_state); - - std::deque mTimerBarRows; - TimerBarRow mAverageTimerRow; - - enum EDisplayType - { - DISPLAY_TIME, - DISPLAY_CALLS, - DISPLAY_HZ - } mDisplayType; - bool mPauseHistory; - F64Seconds mAllTimeMax, - mTotalTimeDisplay; - S32 mScrollIndex, - mHoverBarIndex, - mStatsIndex; - S32 mDisplayMode; - LLTrace::BlockTimerStatHandle* mHoverID; - LLTrace::BlockTimerStatHandle* mHoverTimer; - LLRect mToolTipRect, - mGraphRect, - mBarRect, - mLegendRect; - LLFrameTimer mHighlightTimer; - LLTrace::PeriodicRecording mRecording; - - LLScrollbar* mScrollBar; -}; - -#endif diff --git a/indra/newview/llfilteredwearablelist.cpp b/indra/newview/llfilteredwearablelist.cpp index 0f29cbbe3a3..598848b57bf 100644 --- a/indra/newview/llfilteredwearablelist.cpp +++ b/indra/newview/llfilteredwearablelist.cpp @@ -92,11 +92,9 @@ void LLFilteredWearableListManager::populateIfNeeded() } } -LLTrace::BlockTimerStatHandle FTM_MANAGER_LIST_POPULATION("Manager List Population"); - void LLFilteredWearableListManager::populateList() { - LL_RECORD_BLOCK_TIME(FTM_MANAGER_LIST_POPULATION); + LL_PROFILE_ZONE_SCOPED; LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 65c13797ac3..771bf01d7f0 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -695,10 +695,9 @@ void LLFloaterIMSessionTab::updateUsedEmojis(LLWStringView text) } } -static LLTrace::BlockTimerStatHandle FTM_BUILD_CONVERSATION_VIEW_PARTICIPANT("Build Conversation View"); void LLFloaterIMSessionTab::buildConversationViewParticipant() { - LL_RECORD_BLOCK_TIME(FTM_BUILD_CONVERSATION_VIEW_PARTICIPANT); + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; // Clear the widget list since we are rebuilding afresh from the model conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); while (widget_it != mConversationsWidgets.end()) diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp index 1377526f695..edaf4f3e374 100644 --- a/indra/newview/llfloaterlagmeter.cpp +++ b/indra/newview/llfloaterlagmeter.cpp @@ -141,7 +141,7 @@ void LLFloaterLagMeter::draw() void LLFloaterLagMeter::determineClient() { - F32Milliseconds client_frame_time = LLTrace::get_frame_recording().getPeriodMean(LLStatViewer::FRAME_STACKTIME); + F32Milliseconds client_frame_time = LLTrace::get_frame_recording().getPeriodMean(LLStatViewer::FRAMETIME); bool find_cause = false; if (!gFocusMgr.getAppHasFocus()) @@ -198,7 +198,7 @@ void LLFloaterLagMeter::determineNetwork() // particular if the frame rate is low, because a low frame // rate is a sure recipe for bad ping times right now until // the network handlers are de-synched from the rendering. - F32Milliseconds client_frame_time = frame_recording.getPeriodMean(LLStatViewer::FRAME_STACKTIME); + F32Milliseconds client_frame_time = frame_recording.getPeriodMean(LLStatViewer::FRAMETIME); // Todo: account for LLPacketRing dropped packets? viewer drops those when it can't keep up if(packet_loss >= mNetworkPacketLossCritical) diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index a0621bb0157..e069a3fac3d 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -35,8 +35,6 @@ // // class LLFolderViewModelInventory // -static LLTrace::BlockTimerStatHandle FTM_INVENTORY_SORT("Inventory Sort"); - bool LLFolderViewModelInventory::startDrag(std::vector& items) { std::vector types; @@ -64,7 +62,7 @@ bool LLFolderViewModelInventory::startDrag(std::vector& void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder ) { - LL_RECORD_BLOCK_TIME(FTM_INVENTORY_SORT); + LL_PROFILE_ZONE_SCOPED_CATEGORY_INVENTORY; if (!folder->areChildrenInited() || !needsSort(folder->getViewModelItem())) return; diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 3e4aadc3815..e21a4d9bbf9 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -623,7 +623,7 @@ LLFetchedGLTFMaterial* LLGLTFMaterialList::getMaterial(const LLUUID& id) uuid_mat_map_t::iterator iter = mList.find(id); if (iter == mList.end()) { - LL_PROFILE_ZONE_NAMED("gltf fetch") + LL_PROFILE_ZONE_NAMED("gltf fetch"); LLFetchedGLTFMaterial* mat = new LLFetchedGLTFMaterial(); mList[id] = mat; diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp index 0f3e220ae08..8a8ed8c0a44 100644 --- a/indra/newview/llheroprobemanager.cpp +++ b/indra/newview/llheroprobemanager.cpp @@ -489,7 +489,7 @@ void LLHeroProbeManager::updateUniforms() } LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; - LL_PROFILE_GPU_ZONE("hpmu - uniforms") + LL_PROFILE_GPU_ZONE("hpmu - uniforms"); LLMatrix4a modelview; modelview.loadu(gGLModelView); diff --git a/indra/newview/llhudmanager.cpp b/indra/newview/llhudmanager.cpp index fd8efe68165..a80f7ec7d6b 100644 --- a/indra/newview/llhudmanager.cpp +++ b/indra/newview/llhudmanager.cpp @@ -54,11 +54,9 @@ LLHUDManager::~LLHUDManager() { } -static LLTrace::BlockTimerStatHandle FTM_UPDATE_HUD_EFFECTS("Update Hud Effects"); - void LLHUDManager::updateEffects() { - LL_RECORD_BLOCK_TIME(FTM_UPDATE_HUD_EFFECTS); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; S32 i; for (i = 0; i < mHUDEffects.size(); i++) { diff --git a/indra/newview/llhudobject.cpp b/indra/newview/llhudobject.cpp index 04e9e2dff2d..e8320ede6f3 100644 --- a/indra/newview/llhudobject.cpp +++ b/indra/newview/llhudobject.cpp @@ -256,12 +256,10 @@ LLHUDEffect *LLHUDObject::addHUDEffect(const U8 type) return hud_objectp; } -static LLTrace::BlockTimerStatHandle FTM_HUD_UPDATE("Update Hud"); - // static void LLHUDObject::updateAll() { - LL_RECORD_BLOCK_TIME(FTM_HUD_UPDATE); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; LLHUDText::updateAll(); LLHUDIcon::updateAll(); LLHUDNameTag::updateAll(); diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index d538d42972b..b913da1c373 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -735,11 +735,9 @@ void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID& request_i } } -static LLTrace::BlockTimerStatHandle FTM_BULK_FETCH("Bulk Fetch"); - void LLInventoryModelBackgroundFetch::bulkFetchViaAis() { - LL_RECORD_BLOCK_TIME(FTM_BULK_FETCH); + LL_PROFILE_ZONE_SCOPED_CATEGORY_INVENTORY; //Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped. if (gDisconnected) { @@ -1055,7 +1053,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc // Bundle up a bunch of requests to send all at once. void LLInventoryModelBackgroundFetch::bulkFetch() { - LL_RECORD_BLOCK_TIME(FTM_BULK_FETCH); + LL_PROFILE_ZONE_SCOPED_CATEGORY_INVENTORY; //Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped. //If there are items in mFetchQueue, we want to check the time since the last bulkFetch was //sent. If it exceeds our retry time, go ahead and fire off another batch. diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index ac4b15c1757..2b2cce0272e 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -70,7 +70,6 @@ #include "lluploadfloaterobservers.h" #include "bufferarray.h" #include "bufferstream.h" -#include "llfasttimer.h" #include "llcorehttputil.h" #include "lltrans.h" #include "llstatusbar.h" @@ -318,8 +317,6 @@ // under the 'Mesh Fetch' timer which will be either top-level // or under 'Render' time. -static LLFastTimer::DeclareTimer FTM_MESH_FETCH("Mesh Fetch"); - // Random failure testing for development/QA. // // Set the MESH_*_FAILED macros to either 'false' or to @@ -1031,7 +1028,7 @@ void LLMeshRepoThread::run() // On the other hand, this may actually be an effective and efficient scheme... mSignal->wait(); - LL_PROFILE_ZONE_NAMED("mesh_thread_loop") + LL_PROFILE_ZONE_NAMED("mesh_thread_loop"); if (LLApp::isExiting()) { @@ -4296,7 +4293,7 @@ void LLMeshRepository::unregisterMesh(LLVOVolume* vobj) S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_params, S32 new_lod, S32 last_lod) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; //LL_LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH); + LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; // Manage time-to-load metrics for mesh download operations. metricsProgress(1); @@ -4384,7 +4381,7 @@ S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_para void LLMeshRepository::notifyLoadedMeshes() { //called from main thread - LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; //LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH); + LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; // GetMesh2 operation with keepalives, etc. With pipelining, // we'll increase this. See llappcorehttp and llcorehttp for @@ -4830,7 +4827,7 @@ const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, LLVOV void LLMeshRepository::fetchPhysicsShape(const LLUUID& mesh_id) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; //LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH); + LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; if (mesh_id.notNull()) { @@ -4858,7 +4855,7 @@ void LLMeshRepository::fetchPhysicsShape(const LLUUID& mesh_id) LLModel::Decomposition* LLMeshRepository::getDecomposition(const LLUUID& mesh_id) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; //LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH); + LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; LLModel::Decomposition* ret = NULL; diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 9ef9c26411d..c5532e009a2 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -229,8 +229,6 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) adjustParticipant(avatar_id); } -static LLFastTimer::DeclareTimer FTM_FOLDERVIEW_TEST("add test avatar agents"); - void LLParticipantList::adjustParticipant(const LLUUID& speaker_id) { LLPointer speakerp = mSpeakerMgr->findSpeaker(speaker_id); diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index 37bb59a65c3..74d9baaadce 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -150,7 +150,7 @@ namespace LLPerfStats { // create a queue tunables.initialiseFromSettings(); - LLPerfStats::cpu_hertz = (F64)LLTrace::BlockTimer::countsPerSecond(); + LLPerfStats::cpu_hertz = (F64)LLFastTimer::countsPerSecond(); LLPerfStats::vsync_max_fps = gViewerWindow->getWindow()->getRefreshRate(); } diff --git a/indra/newview/llperfstats.h b/indra/newview/llperfstats.h index 1a2098ec7e0..14a2ec4ac17 100644 --- a/indra/newview/llperfstats.h +++ b/indra/newview/llperfstats.h @@ -312,7 +312,7 @@ namespace LLPerfStats StatsRecord stat; RecordTime( const LLUUID& av, const LLUUID& id, StatType_t type, bool isRiggedAtt=false, bool isHUDAtt=false): - start{LLTrace::BlockTimer::getCPUClockCount64()}, + start{LLFastTimer::getCPUClockCount64()}, stat{type, ObjTypeDiscriminator, std::move(av), std::move(id), 0, isRiggedAtt, isHUDAtt} { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; @@ -332,7 +332,7 @@ namespace LLPerfStats return; } - stat.time = LLTrace::BlockTimer::getCPUClockCount64() - start; + stat.time = LLFastTimer::getCPUClockCount64() - start; StatsRecorder::send(std::move(stat)); }; }; diff --git a/indra/newview/llpersistentnotificationstorage.cpp b/indra/newview/llpersistentnotificationstorage.cpp index e06d025f592..32d7ba51bd9 100644 --- a/indra/newview/llpersistentnotificationstorage.cpp +++ b/indra/newview/llpersistentnotificationstorage.cpp @@ -90,7 +90,7 @@ void LLPersistentNotificationStorage::saveNotifications() void LLPersistentNotificationStorage::loadNotifications() { - LL_PROFILE_ZONE_SCOPED; + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; LL_INFOS("LLPersistentNotificationStorage") << "start loading notifications" << LL_ENDL; diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index c6fa64753c3..41966b53e6d 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -1078,7 +1078,7 @@ void LLReflectionMapManager::updateUniforms() } LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; - LL_PROFILE_GPU_ZONE("rmmu - uniforms") + LL_PROFILE_GPU_ZONE("rmmu - uniforms"); mReflectionMaps.resize(mReflectionProbeCount); diff --git a/indra/newview/llsceneview.cpp b/indra/newview/llsceneview.cpp index a61474636a6..eb7aac55ff4 100644 --- a/indra/newview/llsceneview.cpp +++ b/indra/newview/llsceneview.cpp @@ -37,11 +37,6 @@ LLSceneView* gSceneView = NULL; -//borrow this helper function from llfasttimerview.cpp -template -void removeOutliers(std::vector& data, F32 k); - - LLSceneView::LLSceneView(const LLRect& rect) : LLFloater(LLSD()) { diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 8329ed86dae..14a5e2488ab 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -33,8 +33,6 @@ #include #include -#include "lltrace.h" -#include "llfasttimer.h" #include "v3colorutil.h" #include "llglslshader.h" diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 0bf676536b8..192d3bfbb0b 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -176,7 +176,6 @@ #include "llxfermanager.h" #include "pipeline.h" #include "llappviewer.h" -#include "llfasttimerview.h" #include "llfloatermap.h" #include "llweb.h" #include "llvoiceclient.h" @@ -1804,7 +1803,7 @@ bool idle_startup() //--------------------------------------------------------------------- if (STATE_INVENTORY_SEND == LLStartUp::getStartupState()) { - LL_PROFILE_ZONE_NAMED("State inventory send") + LL_PROFILE_ZONE_NAMED("State inventory send"); do_startup_frame(); // request mute list @@ -1855,14 +1854,14 @@ bool idle_startup() if (STATE_INVENTORY_SKEL == LLStartUp::getStartupState()) { - LL_PROFILE_ZONE_NAMED("State inventory load skeleton") + LL_PROFILE_ZONE_NAMED("State inventory load skeleton"); LLSD response = LLLoginInstance::getInstance()->getResponse(); LLSD inv_skel_lib = response["inventory-skel-lib"]; if (inv_skel_lib.isDefined() && gInventory.getLibraryOwnerID().notNull()) { - LL_PROFILE_ZONE_NAMED("load library inv") + LL_PROFILE_ZONE_NAMED("load library inv"); if (!gInventory.loadSkeleton(inv_skel_lib, gInventory.getLibraryOwnerID())) { LL_WARNS("AppInit") << "Problem loading inventory-skel-lib" << LL_ENDL; @@ -1873,7 +1872,7 @@ bool idle_startup() LLSD inv_skeleton = response["inventory-skeleton"]; if (inv_skeleton.isDefined()) { - LL_PROFILE_ZONE_NAMED("load personal inv") + LL_PROFILE_ZONE_NAMED("load personal inv"); if (!gInventory.loadSkeleton(inv_skeleton, gAgent.getID())) { LL_WARNS("AppInit") << "Problem loading inventory-skel-targets" << LL_ENDL; @@ -1887,7 +1886,7 @@ bool idle_startup() if (STATE_INVENTORY_SEND2 == LLStartUp::getStartupState()) { - LL_PROFILE_ZONE_NAMED("State inventory send2") + LL_PROFILE_ZONE_NAMED("State inventory send2"); LLSD response = LLLoginInstance::getInstance()->getResponse(); diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index f7cb0ee7ed8..2865d375199 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -73,9 +73,6 @@ LLTrace::SampleStatHandle LLTextureFetch::sTexDecodeLatency("texture LLTrace::SampleStatHandle LLTextureFetch::sCacheWriteLatency("texture_write_latency"); LLTrace::SampleStatHandle LLTextureFetch::sTexFetchLatency("texture_fetch_latency"); -LLTextureFetchTester* LLTextureFetch::sTesterp = NULL ; -const std::string sTesterName("TextureFetchTester"); - ////////////////////////////////////////////////////////////////////////////// // // Introduction @@ -2474,17 +2471,6 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, bool threaded, bool qa_mod mHttpHighWater = HTTP_NONPIPE_REQUESTS_HIGH_WATER; mHttpLowWater = HTTP_NONPIPE_REQUESTS_LOW_WATER; mHttpSemaphore = 0; - - // If that test log has ben requested but not yet created, create it - if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName)) - { - sTesterp = new LLTextureFetchTester() ; - if (!sTesterp->isValid()) - { - delete sTesterp; - sTesterp = NULL; - } - } } LLTextureFetch::~LLTextureFetch() @@ -2833,12 +2819,6 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level, S3 if (fetch_time > min_time_to_log) { //LL_INFOS() << "fetch_time: " << fetch_time << " cache_read_time: " << cache_read_time << " decode_time: " << decode_time << " cache_write_time: " << cache_write_time << LL_ENDL; - - LLTextureFetchTester* tester = (LLTextureFetchTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); - if (tester) - { - tester->updateStats(logged_state_timers, fetch_time, skipped_states_time, file_size) ; - } } } else @@ -3694,41 +3674,3 @@ truncate_viewer_metrics(int max_regions, LLSD & metrics) } } // end of anonymous namespace - -LLTextureFetchTester::LLTextureFetchTester() : LLMetricPerformanceTesterBasic(sTesterName) -{ - mTextureFetchTime = 0; - mSkippedStatesTime = 0; - mFileSize = 0; -} - -LLTextureFetchTester::~LLTextureFetchTester() -{ - outputTestResults(); - LLTextureFetch::sTesterp = NULL; -} - -//virtual -void LLTextureFetchTester::outputTestRecord(LLSD *sd) -{ - std::string currentLabel = getCurrentLabelName(); - - (*sd)[currentLabel]["Texture Fetch Time"] = (LLSD::Real)mTextureFetchTime; - (*sd)[currentLabel]["File Size"] = (LLSD::Integer)mFileSize; - (*sd)[currentLabel]["Skipped States Time"] = (LLSD::String)llformat("%.6f", mSkippedStatesTime); - - for(auto i : LOGGED_STATES) - { - (*sd)[currentLabel][sStateDescs[i]] = mStateTimersMap[i]; - } -} - -void LLTextureFetchTester::updateStats(const std::map state_timers, const F32 fetch_time, const F32 skipped_states_time, const S32 file_size) -{ - mTextureFetchTime = fetch_time; - mStateTimersMap = state_timers; - mFileSize = file_size; - mSkippedStatesTime = skipped_states_time; - outputTestResults(); -} - diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index 851d6c11a0b..82898aa208e 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -49,7 +49,6 @@ class LLImageDecodeThread; class LLHost; class LLViewerAssetStats; class LLTextureCache; -class LLTextureFetchTester; // Interface class @@ -405,8 +404,6 @@ class LLTextureFetch : public LLWorkerThread INVALID_SOURCE }; - static LLTextureFetchTester* sTesterp; - private: e_tex_source mFetchSource; e_tex_source mOriginFetchSource; @@ -420,27 +417,5 @@ class LLTextureFetch : public LLWorkerThread bool canLoadFromCache() { return mFetchSource != FROM_HTTP_ONLY;} }; -//debug use -class LLViewerFetchedTexture; - -class LLTextureFetchTester : public LLMetricPerformanceTesterBasic -{ -public: - LLTextureFetchTester(); - ~LLTextureFetchTester(); - - void updateStats(const std::map states_timers, const F32 fetch_time, const F32 other_states_time, const S32 file_size); - -protected: - /*virtual*/ void outputTestRecord(LLSD* sd); - -private: - - F32 mTextureFetchTime; - F32 mSkippedStatesTime; - S32 mFileSize; - - std::map mStateTimersMap; -}; #endif // LL_LLTEXTUREFETCH_H diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 61c5aa4da46..75c04a17e21 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -42,7 +42,6 @@ #include "lldrawpoolwater.h" #include "lldynamictexture.h" #include "llenvironment.h" -#include "llfasttimer.h" #include "llfeaturemanager.h" #include "llfloatertools.h" #include "llfocusmgr.h" @@ -141,6 +140,8 @@ std::string getProfileStatsFilename(); void display_startup() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; + LL_PROFILE_GPU_ZONE("display_startup"); if ( !gViewerWindow || !gViewerWindow->getActive() || !gViewerWindow->getWindow()->getVisible() @@ -150,14 +151,18 @@ void display_startup() return; } - gPipeline.updateGL(); + { + LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("ds - updateGL"); + LL_PROFILE_GPU_ZONE("ds - updateGL"); + gPipeline.updateGL(); + } // Written as branch to appease GCC which doesn't like different // pointer types across ternary ops // if (!LLViewerFetchedTexture::sWhiteImagep.isNull()) { - LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName(); + LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName(); } LLGLSDefault gls_default; @@ -183,9 +188,10 @@ void display_startup() gPipeline.disableLights(); if (gViewerWindow) - gViewerWindow->setup2DRender(); - if (gViewerWindow) - gViewerWindow->draw(); + { + gViewerWindow->setup2DRender(); + gViewerWindow->draw(); + } gGL.flush(); LLVertexBuffer::unbind(); @@ -193,7 +199,9 @@ void display_startup() LLGLState::checkStates(); if (gViewerWindow && gViewerWindow->getWindow()) - gViewerWindow->getWindow()->swapBuffers(); + { + gViewerWindow->getWindow()->swapBuffers(); + } glClear(GL_DEPTH_BUFFER_BIT); } @@ -714,7 +722,7 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot) if (gPipeline.RenderMirrors && !gSnapshot) { LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Update hero probes"); - LL_PROFILE_GPU_ZONE("hero manager") + LL_PROFILE_GPU_ZONE("hero manager"); gPipeline.mHeroProbeManager.update(); gPipeline.mHeroProbeManager.renderProbes(); } @@ -790,7 +798,7 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot) LLAppViewer::instance()->pingMainloopTimeout("Display:Swap"); { - LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 2") + LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 2"); if (gResizeScreenTexture) { gPipeline.resizeScreenTexture(); @@ -881,7 +889,7 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot) // LLAppViewer::instance()->pingMainloopTimeout("Display:StateSort"); { - LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 4") + LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 4"); LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; gPipeline.stateSort(*LLViewerCamera::getInstance(), result); stop_glerror(); @@ -906,7 +914,7 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot) { LLAppViewer::instance()->pingMainloopTimeout("Display:Sky"); - LL_PROFILE_ZONE_NAMED_CATEGORY_ENVIRONMENT("update sky"); //LL_RECORD_BLOCK_TIME(FTM_UPDATE_SKY); + LL_PROFILE_ZONE_NAMED_CATEGORY_ENVIRONMENT("update sky"); gSky.updateSky(); } @@ -982,7 +990,7 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot) if (!(LLAppViewer::instance()->logoutRequestSent() && LLAppViewer::instance()->hasSavedFinalSnapshot()) && !gRestoreGL) { - LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 5") + LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 5"); LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; static LLCachedControl render_depth_pre_pass(gSavedSettings, "RenderDepthPrePass", false); @@ -1466,7 +1474,7 @@ bool setup_hud_matrices(const LLRect& screen_region) void render_ui(F32 zoom_factor, int subfield) { LLPerfStats::RecordSceneTime T ( LLPerfStats::StatType_t::RENDER_UI ); // render time capture - Primary UI stat can have HUD time overlap (TODO) - LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI); + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; LL_PROFILE_GPU_ZONE("ui"); LLGLState::checkStates(); @@ -1513,7 +1521,7 @@ void render_ui(F32 zoom_factor, int subfield) { if (!gDisconnected) { - LL_PROFILE_ZONE_NAMED_CATEGORY_UI("UI 3D"); //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI_3D); + LL_PROFILE_ZONE_NAMED_CATEGORY_UI("UI 3D"); LLGLState::checkStates(); render_ui_3d(); LLGLState::checkStates(); @@ -1531,7 +1539,7 @@ void render_ui(F32 zoom_factor, int subfield) if (render_ui) { - LL_PROFILE_ZONE_NAMED_CATEGORY_UI("UI 2D"); //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI_2D); + LL_PROFILE_ZONE_NAMED_CATEGORY_UI("UI 2D"); LLHUDObject::renderAll(); render_ui_2d(); } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index e8fe99b3392..e4be3f944cc 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -33,7 +33,6 @@ #include "llcommandhandler.h" #include "llcompilequeue.h" -#include "llfasttimerview.h" #include "llfloater360capture.h" #include "llfloaterabout.h" #include "llfloateraddpaymentmethod.h" @@ -240,7 +239,6 @@ class LLFloaterOpenHandler : public LLCommandHandler { const std::list blacklist_untrusted = { "360capture", - "block_timers", "add_payment_method", "appearance", "associate_listing", @@ -329,7 +327,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterAboutUtil::registerFloater(); LLFloaterReg::add("360capture", "floater_360capture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("block_timers", "floater_fast_timers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("add_payment_method", "floater_add_payment_method.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 7870fe78232..d1b85079474 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -29,7 +29,6 @@ //----------------------------------------------------------------------------- #include "llviewerprecompiledheaders.h" -#include "llfasttimer.h" #include "llrender.h" #include "llapr.h" diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index a75f2b2c642..98310419449 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -609,15 +609,6 @@ static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMedi } } -static LLTrace::BlockTimerStatHandle FTM_MEDIA_UPDATE("Update Media"); -static LLTrace::BlockTimerStatHandle FTM_MEDIA_SPARE_IDLE("Spare Idle"); -static LLTrace::BlockTimerStatHandle FTM_MEDIA_UPDATE_INTEREST("Update/Interest"); -static LLTrace::BlockTimerStatHandle FTM_MEDIA_UPDATE_VOLUME("Update/Volume"); -static LLTrace::BlockTimerStatHandle FTM_MEDIA_SORT("Media Sort"); -static LLTrace::BlockTimerStatHandle FTM_MEDIA_SORT2("Media Sort 2"); -static LLTrace::BlockTimerStatHandle FTM_MEDIA_MISC("Misc"); - - ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMedia::onIdle(void *dummy_arg) { @@ -627,7 +618,7 @@ void LLViewerMedia::onIdle(void *dummy_arg) ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMedia::updateMedia(void *dummy_arg) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_MEDIA; //LL_RECORD_BLOCK_TIME(FTM_MEDIA_UPDATE); + LL_PROFILE_ZONE_SCOPED_CATEGORY_MEDIA; llassert(!gCubeSnapshot); @@ -653,7 +644,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg) impl_list::iterator end = sViewerMediaImplList.end(); { - LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("media update interest"); //LL_RECORD_BLOCK_TIME(FTM_MEDIA_UPDATE_INTEREST); + LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("media update interest"); for(; iter != end;) { LLViewerMediaImpl* pimpl = *iter++; @@ -665,12 +656,12 @@ void LLViewerMedia::updateMedia(void *dummy_arg) // Let the spare media source actually launch if(mSpareBrowserMediaSource) { - LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("media spare idle"); //LL_RECORD_BLOCK_TIME(FTM_MEDIA_SPARE_IDLE); + LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("media spare idle"); mSpareBrowserMediaSource->idle(); } { - LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("media sort"); //LL_RECORD_BLOCK_TIME(FTM_MEDIA_SORT); + LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("media sort"); // Sort the static instance list using our interest criteria sViewerMediaImplList.sort(priorityComparitor); } @@ -702,7 +693,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg) // If max_normal + max_low is less than max_instances, things will tend to get unloaded instead of being set to slideshow. { - LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("media misc"); //LL_RECORD_BLOCK_TIME(FTM_MEDIA_MISC); + LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("media misc"); for(; iter != end; iter++) { LLViewerMediaImpl* pimpl = *iter; @@ -889,7 +880,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg) } else { - LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("media sort2"); // LL_RECORD_BLOCK_TIME(FTM_MEDIA_SORT2); + LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("media sort2"); // Use a distance-based sort for proximity values. std::stable_sort(proximity_order.begin(), proximity_order.end(), proximity_comparitor); } @@ -2105,7 +2096,7 @@ void LLViewerMediaImpl::setMute(bool mute) ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::updateVolume() { - LL_RECORD_BLOCK_TIME(FTM_MEDIA_UPDATE_VOLUME); + LL_PROFILE_ZONE_SCOPED_CATEGORY_MEDIA; if(mMediaSource) { // always scale the volume by the global media volume @@ -2816,14 +2807,9 @@ bool LLViewerMediaImpl::canNavigateBack() } ////////////////////////////////////////////////////////////////////////////////////////// -static LLTrace::BlockTimerStatHandle FTM_MEDIA_DO_UPDATE("Do Update"); -static LLTrace::BlockTimerStatHandle FTM_MEDIA_GET_DATA("Get Data"); -static LLTrace::BlockTimerStatHandle FTM_MEDIA_SET_SUBIMAGE("Set Subimage"); - - void LLViewerMediaImpl::update() { - LL_PROFILE_ZONE_SCOPED_CATEGORY_MEDIA; //LL_RECORD_BLOCK_TIME(FTM_MEDIA_DO_UPDATE); + LL_PROFILE_ZONE_SCOPED_CATEGORY_MEDIA; if(mMediaSource == NULL) { if(mPriority == LLPluginClassMedia::PRIORITY_UNLOADED) @@ -3666,11 +3652,9 @@ bool LLViewerMediaImpl::isUpdated() return mIsUpdated ; } -static LLTrace::BlockTimerStatHandle FTM_MEDIA_CALCULATE_INTEREST("Calculate Interest"); - void LLViewerMediaImpl::calculateInterest() { - LL_PROFILE_ZONE_SCOPED_CATEGORY_MEDIA; //LL_RECORD_BLOCK_TIME(FTM_MEDIA_CALCULATE_INTEREST); + LL_PROFILE_ZONE_SCOPED_CATEGORY_MEDIA; LLViewerMediaTexture* texture = LLViewerTextureManager::findMediaTexture( mTextureId ); llassert(!gCubeSnapshot); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 34a3745222e..b7358b891eb 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -616,10 +616,6 @@ class LLAdvancedToggleConsole : public view_listener_t { toggle_visibility(gDebugView->mDebugConsolep); } - else if ("fast timers" == console_type) - { - LLFloaterReg::toggleInstance("block_timers"); - } else if ("scene view" == console_type) { toggle_visibility(gSceneView); @@ -646,10 +642,6 @@ class LLAdvancedCheckConsole : public view_listener_t { new_value = get_visibility(gDebugView->mDebugConsolep); } - else if ("fast timers" == console_type) - { - new_value = LLFloaterReg::instanceVisible("block_timers"); - } else if ("scene view" == console_type) { new_value = get_visibility(gSceneView); @@ -8610,11 +8602,6 @@ void handle_dump_avatar_local_textures() gAgentAvatarp->dumpLocalTextures(); } -void handle_dump_timers() -{ - LLTrace::BlockTimer::dumpCurTimes(); -} - void handle_debug_avatar_textures() { LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); @@ -9912,7 +9899,6 @@ void initialize_menus() view_listener_t::addMenu(new LLAdvancedBuyCurrencyTest(), "Advanced.BuyCurrencyTest"); view_listener_t::addMenu(new LLAdvancedDumpSelectMgr(), "Advanced.DumpSelectMgr"); view_listener_t::addMenu(new LLAdvancedDumpInventory(), "Advanced.DumpInventory"); - commit.add("Advanced.DumpTimers", boost::bind(&handle_dump_timers) ); commit.add("Advanced.DumpFocusHolder", boost::bind(&handle_dump_focus) ); view_listener_t::addMenu(new LLAdvancedPrintSelectedObjectInfo(), "Advanced.PrintSelectedObjectInfo"); view_listener_t::addMenu(new LLAdvancedPrintAgentInfo(), "Advanced.PrintAgentInfo"); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index ed4856df114..5fe4e12a081 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -34,7 +34,6 @@ #include "llflexibleobject.h" #include "llviewercontrol.h" #include "lldatapacker.h" -#include "llfasttimer.h" #include "llfloaterreg.h" #include "llfontgl.h" #include "llframetimer.h" diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index fb9e5fd0a98..a27569b5015 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -29,7 +29,6 @@ #include "llviewerobjectlist.h" #include "message.h" -#include "llfasttimer.h" #include "llrender.h" #include "llwindow.h" // decBusyCount() @@ -294,8 +293,6 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp, } } -static LLTrace::BlockTimerStatHandle FTM_PROCESS_OBJECTS("Process Objects"); - LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry* entry, LLViewerRegion* regionp) { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; @@ -395,7 +392,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, const EObjectUpdateType update_type, bool compressed) { - LL_RECORD_BLOCK_TIME(FTM_PROCESS_OBJECTS); + LL_PROFILE_ZONE_SCOPED; LLViewerObject *objectp; S32 num_objects; diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index b556aef768c..251933b41a7 100644 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -656,10 +656,9 @@ void LLViewerPartSim::shift(const LLVector3 &offset) } } -static LLTrace::BlockTimerStatHandle FTM_SIMULATE_PARTICLES("Simulate Particles"); - void LLViewerPartSim::updateSimulation() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE; static LLFrameTimer update_timer; const F32 dt = llmin(update_timer.getElapsedTimeAndResetF32(), 0.1f); @@ -669,8 +668,6 @@ void LLViewerPartSim::updateSimulation() return; } - LL_RECORD_BLOCK_TIME(FTM_SIMULATE_PARTICLES); - // Start at a random particle system so the same // particle system doesn't always get first pick at the // particles. Theoretically we'd want to do this in distance diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index 5700d8b2784..25490ead543 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -58,7 +58,6 @@ #include "lldefs.h" #include "lldepthstack.h" #include "llerror.h" -#include "llfasttimer.h" #include "llframetimer.h" #include "llinstancetracker.h" #include "llpointer.h" diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index a085bc4d914..b780d974433 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -716,9 +716,6 @@ void LLViewerRegion::initStats() mAlive = false; // can become false if circuit disconnects } -static LLTrace::BlockTimerStatHandle FTM_CLEANUP_REGION_OBJECTS("Cleanup Region Objects"); -static LLTrace::BlockTimerStatHandle FTM_SAVE_REGION_CACHE("Save Region Cache"); - LLViewerRegion::~LLViewerRegion() { LL_PROFILE_ZONE_SCOPED; @@ -735,7 +732,7 @@ LLViewerRegion::~LLViewerRegion() LLViewerPartSim::getInstance()->cleanupRegion(this); { - LL_RECORD_BLOCK_TIME(FTM_CLEANUP_REGION_OBJECTS); + LL_PROFILE_ZONE_NAMED("Cleanup Region Objects"); gObjectList.killObjects(this); } @@ -749,7 +746,7 @@ LLViewerRegion::~LLViewerRegion() std::for_each(mImpl->mObjectPartition.begin(), mImpl->mObjectPartition.end(), DeletePointer()); { - LL_RECORD_BLOCK_TIME(FTM_SAVE_REGION_CACHE); + LL_PROFILE_ZONE_NAMED("Save Region Cache"); saveObjectCache(); } diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index d39d4662053..d68c358aca3 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -50,7 +50,6 @@ #include "llversioninfo.h" #include "llfloatertools.h" #include "lldebugview.h" -#include "llfasttimerview.h" #include "llviewerregion.h" #include "llvoavatar.h" #include "llvoavatarself.h" @@ -242,7 +241,6 @@ LLTrace::EventStatHandle > AGENT_POSITION_SNAP("age LLTrace::EventStatHandle<> LOADING_WEARABLES_LONG_DELAY("loadingwearableslongdelay", "Wearables took too long to load"); LLTrace::EventStatHandle REGION_CROSSING_TIME("regioncrossingtime", "CROSSING_AVG"), - FRAME_STACKTIME("framestacktime", "FRAME_SECS"), UPDATE_STACKTIME("updatestacktime", "UPDATE_SECS"), NETWORK_STACKTIME("networkstacktime", "NETWORK_SECS"), IMAGE_STACKTIME("imagestacktime", "IMAGE_SECS"), @@ -475,10 +473,6 @@ void update_statistics() sample(LLStatViewer::DRAW_DISTANCE, (F64)gSavedSettings.getF32("RenderFarClip")); sample(LLStatViewer::CHAT_BUBBLES, gSavedSettings.getBOOL("UseChatBubbles")); - typedef LLTrace::StatType::instance_tracker_t stat_type_t; - - record(LLStatViewer::FRAME_STACKTIME, last_frame_recording.getSum(*stat_type_t::getInstance("Frame"))); - if (gAgent.getRegion() && isAgentAvatarValid()) { LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(gAgent.getRegion()->getHost()); diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index 011269d7ee6..5f1ed892a6f 100644 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -215,8 +215,21 @@ extern LLTrace::EventStatHandle > AGENT_POSITION_SN extern LLTrace::EventStatHandle<> LOADING_WEARABLES_LONG_DELAY; +extern LLTrace::SampleStatHandle FRAMETIME_JITTER, + FRAMETIME, + FRAMETIME_JITTER_99TH, + FRAMETIME_JITTER_95TH, + FRAMETIME_99TH, + FRAMETIME_95TH, + FRAMETIME_JITTER_CUMULATIVE, + FRAMETIME_JITTER_STDDEV, + FRAMETIME_STDDEV; + +extern LLTrace::SampleStatHandle FRAMETIME_JITTER_EVENTS, + FRAMETIME_JITTER_EVENTS_PER_MINUTE, + FRAMETIME_JITTER_EVENTS_LAST_MINUTE; + extern LLTrace::EventStatHandle REGION_CROSSING_TIME, - FRAME_STACKTIME, UPDATE_STACKTIME, NETWORK_STACKTIME, IMAGE_STACKTIME, diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 6135e188409..e3c7e90b5bd 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -77,11 +77,8 @@ LLPointer LLViewerFetchedTexture::sSmokeImagep = nullptr LLPointer LLViewerFetchedTexture::sFlatNormalImagep = nullptr; LLPointer LLViewerFetchedTexture::sDefaultIrradiancePBRp; LLViewerMediaTexture::media_map_t LLViewerMediaTexture::sMediaMap; -LLTexturePipelineTester* LLViewerTextureManager::sTesterp = nullptr; F32 LLViewerFetchedTexture::sMaxVirtualSize = 8192.f*8192.f; -const std::string sTesterName("TextureTester"); - S32 LLViewerTexture::sImageCount = 0; S32 LLViewerTexture::sRawCount = 0; S32 LLViewerTexture::sAuxCount = 0; @@ -433,16 +430,6 @@ void LLViewerTextureManager::init() // Create a texture manager bridge. gTextureManagerBridgep = new LLViewerTextureManagerBridge; - - if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName)) - { - sTesterp = new LLTexturePipelineTester(); - if (!sTesterp->isValid()) - { - delete sTesterp; - sTesterp = NULL; - } - } } void LLViewerTextureManager::cleanup() @@ -482,12 +469,6 @@ void LLViewerTexture::updateClass() LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; sCurrentTime = gFrameTimeSeconds; - LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); - if (tester) - { - tester->update(); - } - LLViewerMediaTexture::updateClass(); // This is a divisor used to determine how much VRAM from our overall VRAM budget to use. // This is **cumulative** on whatever the detected or manually set VRAM budget is. @@ -856,11 +837,6 @@ bool LLViewerTexture::bindDefaultImage(S32 stage) } stop_glerror(); - LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); - if (tester) - { - tester->updateGrayTextureBinding(); - } return res; } @@ -1061,16 +1037,6 @@ bool LLViewerTexture::isLargeImage() return (S32)mTexelsPerImage > LLViewerTexture::sMinLargeImageSize; } -//virtual -void LLViewerTexture::updateBindStatsForTester() -{ - LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); - if (tester) - { - tester->updateTextureBindingStats(this); - } -} - //---------------------------------------------------------------------------------------------- //end of LLViewerTexture //---------------------------------------------------------------------------------------------- @@ -1866,12 +1832,6 @@ bool LLViewerFetchedTexture::processFetchResults(S32& desired_discard, S32 curre if (mRawImage.notNull()) { LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - has raw image"); - LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); - if (tester) - { - mIsFetched = true; - tester->updateTextureLoadingStats(this, mRawImage, LLAppViewer::getTextureFetch()->isFromLocalCache(mID)); - } mRawDiscardLevel = fetch_discard; if ((mRawImage->getDataSize() > 0 && mRawDiscardLevel >= 0) && (current_discard < 0 || mRawDiscardLevel < current_discard)) @@ -3680,397 +3640,3 @@ F32 LLViewerMediaTexture::getMaxVirtualSize() //---------------------------------------------------------------------------------------------- //end of LLViewerMediaTexture //---------------------------------------------------------------------------------------------- - -//---------------------------------------------------------------------------------------------- -//start of LLTexturePipelineTester -//---------------------------------------------------------------------------------------------- -LLTexturePipelineTester::LLTexturePipelineTester() : LLMetricPerformanceTesterWithSession(sTesterName) -{ - addMetric("TotalBytesLoaded"); - addMetric("TotalBytesLoadedFromCache"); - addMetric("TotalBytesLoadedForLargeImage"); - addMetric("TotalBytesLoadedForSculpties"); - addMetric("StartFetchingTime"); - addMetric("TotalGrayTime"); - addMetric("TotalStablizingTime"); - addMetric("StartTimeLoadingSculpties"); - addMetric("EndTimeLoadingSculpties"); - - addMetric("Time"); - addMetric("TotalBytesBound"); - addMetric("TotalBytesBoundForLargeImage"); - addMetric("PercentageBytesBound"); - - mTotalBytesLoaded = (S32Bytes)0; - mTotalBytesLoadedFromCache = (S32Bytes)0; - mTotalBytesLoadedForLargeImage = (S32Bytes)0; - mTotalBytesLoadedForSculpties = (S32Bytes)0; - - reset(); -} - -LLTexturePipelineTester::~LLTexturePipelineTester() -{ - LLViewerTextureManager::sTesterp = NULL; -} - -void LLTexturePipelineTester::update() -{ - mLastTotalBytesUsed = mTotalBytesUsed; - mLastTotalBytesUsedForLargeImage = mTotalBytesUsedForLargeImage; - mTotalBytesUsed = (S32Bytes)0; - mTotalBytesUsedForLargeImage = (S32Bytes)0; - - if(LLAppViewer::getTextureFetch()->getNumRequests() > 0) //fetching list is not empty - { - if(mPause) - { - //start a new fetching session - reset(); - mStartFetchingTime = LLImageGL::sLastFrameTime; - mPause = false; - } - - //update total gray time - if(mUsingDefaultTexture) - { - mUsingDefaultTexture = false; - mTotalGrayTime = LLImageGL::sLastFrameTime - mStartFetchingTime; - } - - //update the stablizing timer. - updateStablizingTime(); - - outputTestResults(); - } - else if(!mPause) - { - //stop the current fetching session - mPause = true; - outputTestResults(); - reset(); - } -} - -void LLTexturePipelineTester::reset() -{ - mPause = true; - - mUsingDefaultTexture = false; - mStartStablizingTime = 0.0f; - mEndStablizingTime = 0.0f; - - mTotalBytesUsed = (S32Bytes)0; - mTotalBytesUsedForLargeImage = (S32Bytes)0; - mLastTotalBytesUsed = (S32Bytes)0; - mLastTotalBytesUsedForLargeImage = (S32Bytes)0; - - mStartFetchingTime = 0.0f; - - mTotalGrayTime = 0.0f; - mTotalStablizingTime = 0.0f; - - mStartTimeLoadingSculpties = 1.0f; - mEndTimeLoadingSculpties = 0.0f; -} - -//virtual -void LLTexturePipelineTester::outputTestRecord(LLSD *sd) -{ - std::string currentLabel = getCurrentLabelName(); - (*sd)[currentLabel]["TotalBytesLoaded"] = (LLSD::Integer)mTotalBytesLoaded.value(); - (*sd)[currentLabel]["TotalBytesLoadedFromCache"] = (LLSD::Integer)mTotalBytesLoadedFromCache.value(); - (*sd)[currentLabel]["TotalBytesLoadedForLargeImage"] = (LLSD::Integer)mTotalBytesLoadedForLargeImage.value(); - (*sd)[currentLabel]["TotalBytesLoadedForSculpties"] = (LLSD::Integer)mTotalBytesLoadedForSculpties.value(); - - (*sd)[currentLabel]["StartFetchingTime"] = (LLSD::Real)mStartFetchingTime; - (*sd)[currentLabel]["TotalGrayTime"] = (LLSD::Real)mTotalGrayTime; - (*sd)[currentLabel]["TotalStablizingTime"] = (LLSD::Real)mTotalStablizingTime; - - (*sd)[currentLabel]["StartTimeLoadingSculpties"] = (LLSD::Real)mStartTimeLoadingSculpties; - (*sd)[currentLabel]["EndTimeLoadingSculpties"] = (LLSD::Real)mEndTimeLoadingSculpties; - - (*sd)[currentLabel]["Time"] = LLImageGL::sLastFrameTime; - (*sd)[currentLabel]["TotalBytesBound"] = (LLSD::Integer)mLastTotalBytesUsed.value(); - (*sd)[currentLabel]["TotalBytesBoundForLargeImage"] = (LLSD::Integer)mLastTotalBytesUsedForLargeImage.value(); - (*sd)[currentLabel]["PercentageBytesBound"] = (LLSD::Real)(100.f * mLastTotalBytesUsed / mTotalBytesLoaded); -} - -void LLTexturePipelineTester::updateTextureBindingStats(const LLViewerTexture* imagep) -{ - U32Bytes mem_size = imagep->getTextureMemory(); - mTotalBytesUsed += mem_size; - - if(MIN_LARGE_IMAGE_AREA <= (U32)(mem_size.value() / (U32)imagep->getComponents())) - { - mTotalBytesUsedForLargeImage += mem_size; - } -} - -void LLTexturePipelineTester::updateTextureLoadingStats(const LLViewerFetchedTexture* imagep, const LLImageRaw* raw_imagep, bool from_cache) -{ - U32Bytes data_size = (U32Bytes)raw_imagep->getDataSize(); - mTotalBytesLoaded += data_size; - - if(from_cache) - { - mTotalBytesLoadedFromCache += data_size; - } - - if(MIN_LARGE_IMAGE_AREA <= (U32)(data_size.value() / (U32)raw_imagep->getComponents())) - { - mTotalBytesLoadedForLargeImage += data_size; - } - - if(imagep->forSculpt()) - { - mTotalBytesLoadedForSculpties += data_size; - - if(mStartTimeLoadingSculpties > mEndTimeLoadingSculpties) - { - mStartTimeLoadingSculpties = LLImageGL::sLastFrameTime; - } - mEndTimeLoadingSculpties = LLImageGL::sLastFrameTime; - } -} - -void LLTexturePipelineTester::updateGrayTextureBinding() -{ - mUsingDefaultTexture = true; -} - -void LLTexturePipelineTester::setStablizingTime() -{ - if(mStartStablizingTime <= mStartFetchingTime) - { - mStartStablizingTime = LLImageGL::sLastFrameTime; - } - mEndStablizingTime = LLImageGL::sLastFrameTime; -} - -void LLTexturePipelineTester::updateStablizingTime() -{ - if(mStartStablizingTime > mStartFetchingTime) - { - F32 t = mEndStablizingTime - mStartStablizingTime; - - if(t > F_ALMOST_ZERO && (t - mTotalStablizingTime) < F_ALMOST_ZERO) - { - //already stablized - mTotalStablizingTime = LLImageGL::sLastFrameTime - mStartStablizingTime; - - //cancel the timer - mStartStablizingTime = 0.f; - mEndStablizingTime = 0.f; - } - else - { - mTotalStablizingTime = t; - } - } - mTotalStablizingTime = 0.f; -} - -//virtual -void LLTexturePipelineTester::compareTestSessions(llofstream* os) -{ - LLTexturePipelineTester::LLTextureTestSession* base_sessionp = dynamic_cast(mBaseSessionp); - LLTexturePipelineTester::LLTextureTestSession* current_sessionp = dynamic_cast(mCurrentSessionp); - if(!base_sessionp || !current_sessionp) - { - LL_ERRS() << "type of test session does not match!" << LL_ENDL; - } - - //compare and output the comparison - *os << llformat("%s\n", getTesterName().c_str()); - *os << llformat("AggregateResults\n"); - - compareTestResults(os, "TotalGrayTime", base_sessionp->mTotalGrayTime, current_sessionp->mTotalGrayTime); - compareTestResults(os, "TotalStablizingTime", base_sessionp->mTotalStablizingTime, current_sessionp->mTotalStablizingTime); - compareTestResults(os, "StartTimeLoadingSculpties", base_sessionp->mStartTimeLoadingSculpties, current_sessionp->mStartTimeLoadingSculpties); - compareTestResults(os, "TotalTimeLoadingSculpties", base_sessionp->mTotalTimeLoadingSculpties, current_sessionp->mTotalTimeLoadingSculpties); - - compareTestResults(os, "TotalBytesLoaded", base_sessionp->mTotalBytesLoaded, current_sessionp->mTotalBytesLoaded); - compareTestResults(os, "TotalBytesLoadedFromCache", base_sessionp->mTotalBytesLoadedFromCache, current_sessionp->mTotalBytesLoadedFromCache); - compareTestResults(os, "TotalBytesLoadedForLargeImage", base_sessionp->mTotalBytesLoadedForLargeImage, current_sessionp->mTotalBytesLoadedForLargeImage); - compareTestResults(os, "TotalBytesLoadedForSculpties", base_sessionp->mTotalBytesLoadedForSculpties, current_sessionp->mTotalBytesLoadedForSculpties); - - *os << llformat("InstantResults\n"); - S32 size = llmin(base_sessionp->mInstantPerformanceListCounter, current_sessionp->mInstantPerformanceListCounter); - for(S32 i = 0; i < size; i++) - { - *os << llformat("Time(B-T)-%.4f-%.4f\n", base_sessionp->mInstantPerformanceList[i].mTime, current_sessionp->mInstantPerformanceList[i].mTime); - - compareTestResults(os, "AverageBytesUsedPerSecond", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond, - current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond); - - compareTestResults(os, "AverageBytesUsedForLargeImagePerSecond", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond, - current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond); - - compareTestResults(os, "AveragePercentageBytesUsedPerSecond", base_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond, - current_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond); - } - - if(size < base_sessionp->mInstantPerformanceListCounter) - { - for(S32 i = size; i < base_sessionp->mInstantPerformanceListCounter; i++) - { - *os << llformat("Time(B-T)-%.4f- \n", base_sessionp->mInstantPerformanceList[i].mTime); - - *os << llformat(", AverageBytesUsedPerSecond, %d, N/A \n", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond); - *os << llformat(", AverageBytesUsedForLargeImagePerSecond, %d, N/A \n", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond); - *os << llformat(", AveragePercentageBytesUsedPerSecond, %.4f, N/A \n", base_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond); - } - } - else if(size < current_sessionp->mInstantPerformanceListCounter) - { - for(S32 i = size; i < current_sessionp->mInstantPerformanceListCounter; i++) - { - *os << llformat("Time(B-T)- -%.4f\n", current_sessionp->mInstantPerformanceList[i].mTime); - - *os << llformat(", AverageBytesUsedPerSecond, N/A, %d\n", current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond); - *os << llformat(", AverageBytesUsedForLargeImagePerSecond, N/A, %d\n", current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond); - *os << llformat(", AveragePercentageBytesUsedPerSecond, N/A, %.4f\n", current_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond); - } - } -} - -//virtual -LLMetricPerformanceTesterWithSession::LLTestSession* LLTexturePipelineTester::loadTestSession(LLSD* log) -{ - LLTexturePipelineTester::LLTextureTestSession* sessionp = new LLTexturePipelineTester::LLTextureTestSession(); - if(!sessionp) - { - return NULL; - } - - F32 total_gray_time = 0.f; - F32 total_stablizing_time = 0.f; - F32 total_loading_sculpties_time = 0.f; - - F32 start_fetching_time = -1.f; - F32 start_fetching_sculpties_time = 0.f; - - F32 last_time = 0.0f; - S32 frame_count = 0; - - sessionp->mInstantPerformanceListCounter = 0; - sessionp->mInstantPerformanceList.resize(128); - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond = 0; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f; - - //load a session - std::string currentLabel = getCurrentLabelName(); - bool in_log = (*log).has(currentLabel); - while (in_log) - { - LLSD::String label = currentLabel; - - if(sessionp->mInstantPerformanceListCounter >= (S32)sessionp->mInstantPerformanceList.size()) - { - sessionp->mInstantPerformanceList.resize(sessionp->mInstantPerformanceListCounter + 128); - } - - //time - F32 start_time = (F32)(*log)[label]["StartFetchingTime"].asReal(); - F32 cur_time = (F32)(*log)[label]["Time"].asReal(); - if(start_time - start_fetching_time > F_ALMOST_ZERO) //fetching has paused for a while - { - sessionp->mTotalGrayTime += total_gray_time; - sessionp->mTotalStablizingTime += total_stablizing_time; - - sessionp->mStartTimeLoadingSculpties = start_fetching_sculpties_time; - sessionp->mTotalTimeLoadingSculpties += total_loading_sculpties_time; - - start_fetching_time = start_time; - total_gray_time = 0.f; - total_stablizing_time = 0.f; - total_loading_sculpties_time = 0.f; - } - else - { - total_gray_time = (F32)(*log)[label]["TotalGrayTime"].asReal(); - total_stablizing_time = (F32)(*log)[label]["TotalStablizingTime"].asReal(); - - total_loading_sculpties_time = (F32)(*log)[label]["EndTimeLoadingSculpties"].asReal() - (F32)(*log)[label]["StartTimeLoadingSculpties"].asReal(); - if(start_fetching_sculpties_time < 0.f && total_loading_sculpties_time > 0.f) - { - start_fetching_sculpties_time = (F32)(*log)[label]["StartTimeLoadingSculpties"].asReal(); - } - } - - //total loaded bytes - sessionp->mTotalBytesLoaded = (*log)[label]["TotalBytesLoaded"].asInteger(); - sessionp->mTotalBytesLoadedFromCache = (*log)[label]["TotalBytesLoadedFromCache"].asInteger(); - sessionp->mTotalBytesLoadedForLargeImage = (*log)[label]["TotalBytesLoadedForLargeImage"].asInteger(); - sessionp->mTotalBytesLoadedForSculpties = (*log)[label]["TotalBytesLoadedForSculpties"].asInteger(); - - //instant metrics - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond += - (*log)[label]["TotalBytesBound"].asInteger(); - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond += - (*log)[label]["TotalBytesBoundForLargeImage"].asInteger(); - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond += - (F32)(*log)[label]["PercentageBytesBound"].asReal(); - frame_count++; - if(cur_time - last_time >= 1.0f) - { - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond /= frame_count; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond /= frame_count; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond /= frame_count; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = last_time; - - frame_count = 0; - last_time = cur_time; - sessionp->mInstantPerformanceListCounter++; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond = 0; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f; - } - // Next label - incrementCurrentCount(); - currentLabel = getCurrentLabelName(); - in_log = (*log).has(currentLabel); - } - - sessionp->mTotalGrayTime += total_gray_time; - sessionp->mTotalStablizingTime += total_stablizing_time; - - if(sessionp->mStartTimeLoadingSculpties < 0.f) - { - sessionp->mStartTimeLoadingSculpties = start_fetching_sculpties_time; - } - sessionp->mTotalTimeLoadingSculpties += total_loading_sculpties_time; - - return sessionp; -} - -LLTexturePipelineTester::LLTextureTestSession::LLTextureTestSession() -{ - reset(); -} -LLTexturePipelineTester::LLTextureTestSession::~LLTextureTestSession() -{ -} -void LLTexturePipelineTester::LLTextureTestSession::reset() -{ - mTotalGrayTime = 0.0f; - mTotalStablizingTime = 0.0f; - - mStartTimeLoadingSculpties = 0.0f; - mTotalTimeLoadingSculpties = 0.0f; - - mTotalBytesLoaded = 0; - mTotalBytesLoadedFromCache = 0; - mTotalBytesLoadedForLargeImage = 0; - mTotalBytesLoadedForSculpties = 0; - - mInstantPerformanceListCounter = 0; -} -//---------------------------------------------------------------------------------------------- -//end of LLTexturePipelineTester -//---------------------------------------------------------------------------------------------- - diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 29376519953..d640c7d737f 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -34,7 +34,6 @@ #include "llhost.h" #include "llgltypes.h" #include "llrender.h" -#include "llmetricperformancetester.h" #include "httpcommon.h" #include "workqueue.h" #include "gltf/common.h" @@ -49,8 +48,6 @@ class LLViewerObject; class LLViewerTexture; class LLViewerFetchedTexture ; class LLViewerMediaTexture ; -class LLTexturePipelineTester ; - typedef void (*loaded_callback_func)( bool success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, bool final, void* userdata ); @@ -171,8 +168,6 @@ class LLViewerTexture : public LLGLTexture bool hasParcelMedia() const { return mParcelMedia != NULL;} LLViewerMediaTexture* getParcelMedia() const { return mParcelMedia;} - /*virtual*/ void updateBindStatsForTester() ; - struct MaterialEntry { S32 mIndex = LL::GLTF::INVALID_INDEX; @@ -623,9 +618,6 @@ class LLViewerTextureManager LLViewerTextureManager(){} public: - //texture pipeline tester - static LLTexturePipelineTester* sTesterp ; - //returns NULL if tex is not a LLViewerFetchedTexture nor derived from LLViewerFetchedTexture. static LLViewerFetchedTexture* staticCastToFetchedTexture(LLTexture* tex, bool report_error = false) ; @@ -694,98 +686,4 @@ class LLViewerTextureManager static void init() ; static void cleanup() ; }; -// -//this class is used for test/debug only -//it tracks the activities of the texture pipeline -//records them, and outputs them to log files -// -class LLTexturePipelineTester : public LLMetricPerformanceTesterWithSession -{ - enum - { - MIN_LARGE_IMAGE_AREA = 262144 //512 * 512 - }; -public: - LLTexturePipelineTester() ; - ~LLTexturePipelineTester() ; - - void update(); - void updateTextureBindingStats(const LLViewerTexture* imagep) ; - void updateTextureLoadingStats(const LLViewerFetchedTexture* imagep, const LLImageRaw* raw_imagep, bool from_cache) ; - void updateGrayTextureBinding() ; - void setStablizingTime() ; - -private: - void reset() ; - void updateStablizingTime() ; - - /*virtual*/ void outputTestRecord(LLSD* sd) ; - -private: - bool mPause ; -private: - bool mUsingDefaultTexture; //if set, some textures are still gray. - - U32Bytes mTotalBytesUsed ; //total bytes of textures bound/used for the current frame. - U32Bytes mTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the current frame for images larger than 256 * 256. - U32Bytes mLastTotalBytesUsed ; //total bytes of textures bound/used for the previous frame. - U32Bytes mLastTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the previous frame for images larger than 256 * 256. - - // - //data size - // - U32Bytes mTotalBytesLoaded ; //total bytes fetched by texture pipeline - U32Bytes mTotalBytesLoadedFromCache ; //total bytes fetched by texture pipeline from local cache - U32Bytes mTotalBytesLoadedForLargeImage ; //total bytes fetched by texture pipeline for images larger than 256 * 256. - U32Bytes mTotalBytesLoadedForSculpties ; //total bytes fetched by texture pipeline for sculpties - - // - //time - //NOTE: the error tolerances of the following timers is one frame time. - // - F32 mStartFetchingTime ; - F32 mTotalGrayTime ; //total loading time when no gray textures. - F32 mTotalStablizingTime ; //total stablizing time when texture memory overflows - F32 mStartTimeLoadingSculpties ; //the start moment of loading sculpty images. - F32 mEndTimeLoadingSculpties ; //the end moment of loading sculpty images. - F32 mStartStablizingTime ; - F32 mEndStablizingTime ; - -private: - // - //The following members are used for performance analyzing - // - class LLTextureTestSession : public LLTestSession - { - public: - LLTextureTestSession() ; - /*virtual*/ ~LLTextureTestSession() ; - - void reset() ; - - F32 mTotalGrayTime ; - F32 mTotalStablizingTime ; - F32 mStartTimeLoadingSculpties ; - F32 mTotalTimeLoadingSculpties ; - - S32 mTotalBytesLoaded ; - S32 mTotalBytesLoadedFromCache ; - S32 mTotalBytesLoadedForLargeImage ; - S32 mTotalBytesLoadedForSculpties ; - - typedef struct _texture_instant_preformance_t - { - S32 mAverageBytesUsedPerSecond ; - S32 mAverageBytesUsedForLargeImagePerSecond ; - F32 mAveragePercentageBytesUsedPerSecond ; - F32 mTime ; - }texture_instant_preformance_t ; - std::vector mInstantPerformanceList ; - S32 mInstantPerformanceListCounter ; - }; - - /*virtual*/ LLMetricPerformanceTesterWithSession::LLTestSession* loadTestSession(LLSD* log) ; - /*virtual*/ void compareTestSessions(llofstream* os) ; -}; - #endif diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index d6ed7acd333..45ac849732a 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -403,9 +403,6 @@ void normalized_float_to_string(const float x, char *out_str) // // LLDebugText // - -static LLTrace::BlockTimerStatHandle FTM_DISPLAY_DEBUG_TEXT("Display Debug Text"); - class LLDebugText { private: @@ -940,7 +937,7 @@ class LLDebugText void draw() { - LL_RECORD_BLOCK_TIME(FTM_DISPLAY_DEBUG_TEXT); + LL_PROFILE_ZONE_SCOPED; // Camera matrix text is hard to see again a white background // Add a dark background underneath the matrices for readability (contrast) @@ -2717,7 +2714,8 @@ void LLViewerWindow::drawDebugText() void LLViewerWindow::draw() { - + LL_PROFILE_ZONE_SCOPED; + LL_PROFILE_GPU_ZONE("viewerwindow_draw"); //#if LL_DEBUG LLView::sIsDrawing = true; //#endif @@ -3408,13 +3406,11 @@ void append_xui_tooltip(LLView* viewp, LLToolTip::Params& params) } } -static LLTrace::BlockTimerStatHandle ftm("Update UI"); - // Update UI based on stored mouse position from mouse-move // event processing. void LLViewerWindow::updateUI() { - LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; //LL_RECORD_BLOCK_TIME(ftm); + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; static std::string last_handle_msg; @@ -4063,10 +4059,9 @@ void LLViewerWindow::updateKeyboardFocus() } } -static LLTrace::BlockTimerStatHandle FTM_UPDATE_WORLD_VIEW("Update World View"); void LLViewerWindow::updateWorldViewRect(bool use_full_window) { - LL_RECORD_BLOCK_TIME(FTM_UPDATE_WORLD_VIEW); + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; // start off using whole window to render world LLRect new_world_rect = mWindowRectRaw; @@ -5954,11 +5949,9 @@ void LLViewerWindow::requestResolutionUpdate() mResDirty = true; } -static LLTrace::BlockTimerStatHandle FTM_WINDOW_CHECK_SETTINGS("Window Settings"); - void LLViewerWindow::checkSettings() { - LL_RECORD_BLOCK_TIME(FTM_WINDOW_CHECK_SETTINGS); + LL_PROFILE_ZONE_SCOPED; if (mStatesDirty) { gGL.refreshState(); diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index fdd39a0e303..760f81aa3a5 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -401,11 +401,9 @@ LLDrawable* LLVOGrass::createDrawable(LLPipeline *pipeline) return mDrawable; } -static LLTrace::BlockTimerStatHandle FTM_UPDATE_GRASS("Update Grass"); - bool LLVOGrass::updateGeometry(LLDrawable *drawable) { - LL_RECORD_BLOCK_TIME(FTM_UPDATE_GRASS); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE; dirtySpatialGroup(); diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 8792ae3285a..b00a4db39dc 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -7187,8 +7187,6 @@ LLVivoxProtocolParser::~LLVivoxProtocolParser() XML_ParserFree(parser); } -static LLTrace::BlockTimerStatHandle FTM_VIVOX_PROCESS("Vivox Process"); - // virtual LLIOPipe::EStatus LLVivoxProtocolParser::process_impl( const LLChannelDescriptors& channels, @@ -7197,7 +7195,7 @@ LLIOPipe::EStatus LLVivoxProtocolParser::process_impl( LLSD& context, LLPumpIO* pump) { - LL_RECORD_BLOCK_TIME(FTM_VIVOX_PROCESS); + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE; LLBufferStream istr(channels, buffer.get()); std::ostringstream ostr; while (istr.good()) diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 3a1aa5f9952..fa2e36ff550 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -507,7 +507,7 @@ void LLWebRTCVoiceClient::voiceConnectionCoro() LLMuteList::getInstance()->addObserver(this); while (!sShuttingDown) { - LL_PROFILE_ZONE_NAMED_CATEGORY_VOICE("voiceConnectionCoroLoop") + LL_PROFILE_ZONE_NAMED_CATEGORY_VOICE("voiceConnectionCoroLoop"); // TODO: Doing some measurement and calculation here, // we could reduce the timeout to take into account the // time spent on the previous loop to have the loop @@ -2837,7 +2837,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() { case VOICE_STATE_START_SESSION: { - LL_PROFILE_ZONE_NAMED_CATEGORY_VOICE("VOICE_STATE_START_SESSION") + LL_PROFILE_ZONE_NAMED_CATEGORY_VOICE("VOICE_STATE_START_SESSION"); if (mShutDown) { setVoiceConnectionState(VOICE_STATE_SESSION_EXIT); diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index ec32a798291..afed882ba33 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -30,7 +30,6 @@ #include "lldrawpoolalpha.h" -#include "llfasttimer.h" #include "message.h" #include "v2math.h" diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 38c702c4ca9..0e016670b41 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -53,9 +53,6 @@ #include "llsettingssky.h" #include "llenvironment.h" -#include "lltrace.h" -#include "llfasttimer.h" - #undef min #undef max diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index aa230f46361..de2cdd6436d 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1370,11 +1370,6 @@ void LLVOVolume::sculpt() sculpt_width = 0; sculpt_height = 0; sculpt_data = NULL ; - - if(LLViewerTextureManager::sTesterp) - { - LLViewerTextureManager::sTesterp->updateGrayTextureBinding(); - } } else { @@ -1385,11 +1380,6 @@ void LLVOVolume::sculpt() sculpt_components = raw_image->getComponents(); sculpt_data = raw_image->getData(); - - if(LLViewerTextureManager::sTesterp) - { - mSculptTexture->updateBindStatsForTester() ; - } } getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level, mSculptTexture->isMissingAsset()); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 262da507bed..04b032b2ffd 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -33,7 +33,6 @@ #include "llaudioengine.h" // For debugging. #include "llerror.h" #include "llviewercontrol.h" -#include "llfasttimer.h" #include "llfontgl.h" #include "llfontvertexbuffer.h" #include "llnamevalue.h" @@ -251,40 +250,6 @@ bool gDebugPipeline = false; LLPipeline gPipeline; const LLMatrix4* gGLLastMatrix = NULL; -LLTrace::BlockTimerStatHandle FTM_RENDER_GEOMETRY("Render Geometry"); -LLTrace::BlockTimerStatHandle FTM_RENDER_GRASS("Grass"); -LLTrace::BlockTimerStatHandle FTM_RENDER_INVISIBLE("Invisible"); -LLTrace::BlockTimerStatHandle FTM_RENDER_SHINY("Shiny"); -LLTrace::BlockTimerStatHandle FTM_RENDER_SIMPLE("Simple"); -LLTrace::BlockTimerStatHandle FTM_RENDER_TERRAIN("Terrain"); -LLTrace::BlockTimerStatHandle FTM_RENDER_TREES("Trees"); -LLTrace::BlockTimerStatHandle FTM_RENDER_UI("UI"); -LLTrace::BlockTimerStatHandle FTM_RENDER_WATER("Water"); -LLTrace::BlockTimerStatHandle FTM_RENDER_WL_SKY("Windlight Sky"); -LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA("Alpha Objects"); -LLTrace::BlockTimerStatHandle FTM_RENDER_CHARACTERS("Avatars"); -LLTrace::BlockTimerStatHandle FTM_RENDER_BUMP("Bump"); -LLTrace::BlockTimerStatHandle FTM_RENDER_MATERIALS("Render Materials"); -LLTrace::BlockTimerStatHandle FTM_RENDER_FULLBRIGHT("Fullbright"); -LLTrace::BlockTimerStatHandle FTM_RENDER_GLOW("Glow"); -LLTrace::BlockTimerStatHandle FTM_GEO_UPDATE("Geo Update"); -LLTrace::BlockTimerStatHandle FTM_POOLRENDER("RenderPool"); -LLTrace::BlockTimerStatHandle FTM_POOLS("Pools"); -LLTrace::BlockTimerStatHandle FTM_DEFERRED_POOLRENDER("RenderPool (Deferred)"); -LLTrace::BlockTimerStatHandle FTM_DEFERRED_POOLS("Pools (Deferred)"); -LLTrace::BlockTimerStatHandle FTM_POST_DEFERRED_POOLRENDER("RenderPool (Post)"); -LLTrace::BlockTimerStatHandle FTM_POST_DEFERRED_POOLS("Pools (Post)"); -LLTrace::BlockTimerStatHandle FTM_STATESORT("Sort Draw State"); -LLTrace::BlockTimerStatHandle FTM_PIPELINE("Pipeline"); -LLTrace::BlockTimerStatHandle FTM_CLIENT_COPY("Client Copy"); -LLTrace::BlockTimerStatHandle FTM_RENDER_DEFERRED("Deferred Shading"); - -LLTrace::BlockTimerStatHandle FTM_RENDER_UI_HUD("HUD"); -LLTrace::BlockTimerStatHandle FTM_RENDER_UI_3D("3D"); -LLTrace::BlockTimerStatHandle FTM_RENDER_UI_2D("2D"); - -static LLTrace::BlockTimerStatHandle FTM_STATESORT_DRAWABLE("Sort Drawables"); - static LLStaticHashedString sTint("tint"); static LLStaticHashedString sAmbiance("ambiance"); static LLStaticHashedString sAlphaScale("alpha_scale"); @@ -2462,8 +2427,6 @@ bool LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3& return res; } -static LLTrace::BlockTimerStatHandle FTM_CULL("Object Culling"); - // static bool LLPipeline::isWaterClip() { @@ -2473,7 +2436,7 @@ bool LLPipeline::isWaterClip() void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_CULL); + LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; LL_PROFILE_GPU_ZONE("updateCull"); // should always be zero GPU time, but drop a timer to flush stuff out bool water_clip = isWaterClip(); @@ -2834,7 +2797,7 @@ void LLPipeline::updateGeom(F32 max_dtime) LLTimer update_timer; LLPointer drawablep; - LL_RECORD_BLOCK_TIME(FTM_GEO_UPDATE); + LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("updateGeom"); if (gCubeSnapshot) { return; @@ -3217,7 +3180,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) } { - LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWABLE("stateSort"); // LL_RECORD_BLOCK_TIME(FTM_STATESORT_DRAWABLE); + LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWABLE("stateSort"); for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter) { @@ -3565,8 +3528,6 @@ void LLPipeline::postSort(LLCamera &camera) assertInitialized(); - LL_PUSH_CALLSTACKS(); - if (!gCubeSnapshot) { // rebuild drawable geometry @@ -3582,15 +3543,13 @@ void LLPipeline::postSort(LLCamera &camera) group->rebuildGeom(); } } - LL_PUSH_CALLSTACKS(); + // rebuild groups sCull->assertDrawMapsEmpty(); rebuildPriorityGroups(); } - LL_PUSH_CALLSTACKS(); - // build render map for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) { @@ -3711,7 +3670,6 @@ void LLPipeline::postSort(LLCamera &camera) std::sort(sCull->beginRiggedAlphaGroups(), sCull->endRiggedAlphaGroups(), LLSpatialGroup::CompareRenderOrder()); } - LL_PUSH_CALLSTACKS(); // only render if the flag is set. The flag is only set if we are in edit mode or the toggle is set in the menus if (LLFloaterReg::instanceVisible("beacons") && !sShadowRender && !gCubeSnapshot) { @@ -3764,7 +3722,7 @@ void LLPipeline::postSort(LLCamera &camera) forAllVisibleDrawables(renderSoundHighlights); } } - LL_PUSH_CALLSTACKS(); + // If managing your telehub, draw beacons at telehub and currently selected spawnpoint. if (LLFloaterTelehub::renderBeacons() && !sShadowRender && !gCubeSnapshot) { @@ -3825,13 +3783,12 @@ void LLPipeline::postSort(LLCamera &camera) LLVertexBuffer::flushBuffers(); // LLSpatialGroup::sNoDelete = false; - LL_PUSH_CALLSTACKS(); } void render_hud_elements() { - LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI); + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; gPipeline.disableLights(); LLGLSUIDefault gls_ui; @@ -3983,7 +3940,7 @@ U32 LLPipeline::sCurRenderPoolType = 0 ; void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion) { LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderGeomDeferred"); - LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_GEOMETRY); + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LL_PROFILE_GPU_ZONE("renderGeomDeferred"); llassert(!sRenderingHUDs); @@ -7028,8 +6985,6 @@ void LLPipeline::bindScreenToTexture() } -static LLTrace::BlockTimerStatHandle FTM_RENDER_BLOOM("Bloom"); - void LLPipeline::visualizeBuffers(LLRenderTarget* src, LLRenderTarget* dst, U32 bufferIndex) { dst->bindTarget(); @@ -8009,7 +7964,7 @@ void LLPipeline::renderFinalize() assertInitialized(); - LL_RECORD_BLOCK_TIME(FTM_RENDER_BLOOM); + LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("renderFinalize"); LL_PROFILE_GPU_ZONE("renderFinalize"); gGL.color4f(1, 1, 1, 1); @@ -8836,9 +8791,10 @@ void LLPipeline::renderDeferredLighting() { LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("renderDeferredLighting - fullscreen lights"); - LLGLDepthTest depth(GL_FALSE); LL_PROFILE_GPU_ZONE("fullscreen lights"); + LLGLDepthTest depth(GL_FALSE); + U32 count = 0; const U32 max_count = LL_DEFERRED_MULTI_LIGHT_COUNT; @@ -9471,20 +9427,9 @@ glm::mat4 look(const LLVector3 pos, const LLVector3 dir, const LLVector3 up) return glm::make_mat4(ret); } -static LLTrace::BlockTimerStatHandle FTM_SHADOW_RENDER("Render Shadows"); -static LLTrace::BlockTimerStatHandle FTM_SHADOW_ALPHA("Alpha Shadow"); -static LLTrace::BlockTimerStatHandle FTM_SHADOW_SIMPLE("Simple Shadow"); -static LLTrace::BlockTimerStatHandle FTM_SHADOW_GEOM("Shadow Geom"); - -static LLTrace::BlockTimerStatHandle FTM_SHADOW_ALPHA_MASKED("Alpha Masked"); -static LLTrace::BlockTimerStatHandle FTM_SHADOW_ALPHA_BLEND("Alpha Blend"); -static LLTrace::BlockTimerStatHandle FTM_SHADOW_ALPHA_TREE("Alpha Tree"); -static LLTrace::BlockTimerStatHandle FTM_SHADOW_ALPHA_GRASS("Alpha Grass"); -static LLTrace::BlockTimerStatHandle FTM_SHADOW_FULLBRIGHT_ALPHA_MASKED("Fullbright Alpha Masked"); - void LLPipeline::renderShadow(const glm::mat4& view, const glm::mat4& proj, LLCamera& shadow_cam, LLCullResult& result, bool depth_clamp) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_SHADOW_RENDER); + LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; LL_PROFILE_GPU_ZONE("renderShadow"); LLPipeline::sShadowRender = true; @@ -9562,7 +9507,7 @@ void LLPipeline::renderShadow(const glm::mat4& view, const glm::mat4& proj, LLCa gGL.setColorMask(false, false); } - LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow simple"); //LL_RECORD_BLOCK_TIME(FTM_SHADOW_SIMPLE); + LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow simple"); LL_PROFILE_GPU_ZONE("shadow simple"); gGL.getTexUnit(0)->disable(); @@ -9894,9 +9839,6 @@ LLRenderTarget* LLPipeline::getSpotShadowTarget(U32 i) return &mSpotShadow[i]; } -static LLTrace::BlockTimerStatHandle FTM_GEN_SUN_SHADOW("Gen Sun Shadow"); -static LLTrace::BlockTimerStatHandle FTM_GEN_SUN_SHADOW_SPOT_RENDER("Spot Shadow Render"); - // helper class for disabling occlusion culling for the current stack frame class LLDisableOcclusionCulling { @@ -9922,7 +9864,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) return; } - LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_GEN_SUN_SHADOW); + LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; LL_PROFILE_GPU_ZONE("generateSunShadow"); LLDisableOcclusionCulling no_occlusion; diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index dff0af46e20..90f96f48989 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -65,31 +65,6 @@ bool LLRayAABB(const LLVector3 ¢er, const LLVector3 &size, const LLVector3& bool setup_hud_matrices(); // use whole screen to render hud bool setup_hud_matrices(const LLRect& screen_region); // specify portion of screen (in pixels) to render hud attachments from (for picking) - -extern LLTrace::BlockTimerStatHandle FTM_RENDER_GEOMETRY; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_GRASS; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_INVISIBLE; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_SHINY; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_SIMPLE; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_TERRAIN; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_TREES; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_UI; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_WATER; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_WL_SKY; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_CHARACTERS; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_BUMP; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_MATERIALS; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_FULLBRIGHT; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_GLOW; -extern LLTrace::BlockTimerStatHandle FTM_STATESORT; -extern LLTrace::BlockTimerStatHandle FTM_PIPELINE; -extern LLTrace::BlockTimerStatHandle FTM_CLIENT_COPY; - -extern LLTrace::BlockTimerStatHandle FTM_RENDER_UI_HUD; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_UI_3D; -extern LLTrace::BlockTimerStatHandle FTM_RENDER_UI_2D; - class LLPipeline { public: diff --git a/indra/newview/skins/default/xui/de/floater_fast_timers.xml b/indra/newview/skins/default/xui/de/floater_fast_timers.xml deleted file mode 100644 index 4b5383c64d4..00000000000 --- a/indra/newview/skins/default/xui/de/floater_fast_timers.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - Pause - - - Rennen - - - - - - - - - - - - -