From eb0bfc9e10daacb0cea2a2bacb7cd089efadbf81 Mon Sep 17 00:00:00 2001 From: Beq Date: Sun, 21 Mar 2021 14:59:02 +0000 Subject: [PATCH] more cleanup of telemetry support remove superfluous cmake changes rename profiler to telemetry to avoid confusion --- indra/cmake/00-Common.cmake | 5 --- indra/llcommon/CMakeLists.txt | 1 + indra/llcommon/FSTracyClient.cpp | 10 ------ indra/llcommon/fstelemetry.cpp | 31 +++++++++++++++++++ .../llcommon/{fsprofiler.h => fstelemetry.h} | 30 ++++++++++-------- indra/llcommon/llfasttimer.h | 2 +- indra/llfilesystem/llfilesystem.cpp | 1 - indra/newview/app_settings/settings.xml | 15 +++++++-- indra/newview/llappviewer.cpp | 2 +- indra/newview/llviewermenu.cpp | 17 ++++++++++ .../skins/default/xui/en/menu_viewer.xml | 26 ++++++++++++++++ 11 files changed, 107 insertions(+), 33 deletions(-) create mode 100644 indra/llcommon/fstelemetry.cpp rename indra/llcommon/{fsprofiler.h => fstelemetry.h} (55%) diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 97f8e8690e..5dd44a953b 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -139,11 +139,6 @@ if (WINDOWS) # /arch:SSE2 /fp:fast ) -# Add Tracy profiler support - if (USE_TRACY_PROFILER) - add_definitions( /DTRACY_ENABLE /DTRACY_NO_FASTTIMERS ) - endif() -# # Nicky: x64 implies SSE2 if( ADDRESS_SIZE EQUAL 32 ) add_definitions( /arch:SSE2 ) diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 879a7c4a42..ed72fee9d2 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -257,6 +257,7 @@ set(llcommon_HEADER_FILES # Add all nd* files. memory pool, intrinsics, ... # Tracy Profiler support +list(APPEND llcommon_SOURCE_FILES fstelemetry.cpp) if (USE_TRACY_PROFILER) list(APPEND llcommon_SOURCE_FILES FSTracyClient.cpp) endif() diff --git a/indra/llcommon/FSTracyClient.cpp b/indra/llcommon/FSTracyClient.cpp index d40c042113..867a5442ac 100644 --- a/indra/llcommon/FSTracyClient.cpp +++ b/indra/llcommon/FSTracyClient.cpp @@ -10,19 +10,9 @@ // // Define TRACY_ENABLE to enable profiler. -// #define __CYGWIN__ #include "common/TracySystem.cpp" #ifdef TRACY_ENABLE -// are we actively profiling? -// At some point this should move to fsprofiler.cpp to correspond with the headerfile -#ifdef TRACY_ENABLE -namespace FSProfiler -{ - bool active{false}; -} -#endif -// #ifdef _MSC_VER # pragma warning(push, 0) diff --git a/indra/llcommon/fstelemetry.cpp b/indra/llcommon/fstelemetry.cpp new file mode 100644 index 0000000000..c2bc80b66a --- /dev/null +++ b/indra/llcommon/fstelemetry.cpp @@ -0,0 +1,31 @@ +/** + * @file fstelemetry.cpp + * @brief fstelemetry Telemetry abstraction for FS + * + * $LicenseInfo:firstyear=2021&license=fsviewerlgpl$ + * Phoenix Firestorm Viewer Source Code + * Copyright (C) 2021, The Phoenix Firestorm Project, 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 + * + * The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA + * http://www.firestormviewer.org + * $/LicenseInfo$ + */ +#include "fstelemetry.h" +namespace FSTelemetry +{ + bool active{false}; +} \ No newline at end of file diff --git a/indra/llcommon/fsprofiler.h b/indra/llcommon/fstelemetry.h similarity index 55% rename from indra/llcommon/fsprofiler.h rename to indra/llcommon/fstelemetry.h index 41ffa6a17f..cd7688907b 100644 --- a/indra/llcommon/fsprofiler.h +++ b/indra/llcommon/fstelemetry.h @@ -1,32 +1,36 @@ #pragma once -#ifndef FS_PROFILER_H_INCLUDED -#define FS_PROFILER_H_INCLUDED +#ifndef FS_TELEMETRY_H_INCLUDED +#define FS_TELEMETRY_H_INCLUDED // define a simple set of empty macros that allow us to build without the Tracy profiler installed in 3p // this is similar to the profiler abstraction used by LL but as they have no plans to release that any time soon we'll replace it -// Just a minimal set at the moment will add locks/gpu/memory and other stuff later +// Just a minimal set at the moment will add locks/gpu/memory and other stuff later. #ifdef TRACY_ENABLE #include "Tracy.hpp" -namespace FSProfiler -{ - extern bool active; -} -#define FSZone ZoneNamed( ___tracy_scoped_zone, FSProfiler::active) -#define FSZoneN( name ) ZoneNamedN( ___tracy_scoped_zone, name, FSProfiler::active) -#define FSZoneC(color) ZoneNamedC( ___tracy_scoped_zone, color, FSProfiler::active) -#define FSZoneNC(name, color) ZoneNamedNC( ___tracy_scoped_zone, name, color, FSProfiler::active) +#define FSZone ZoneNamed( ___tracy_scoped_zone, FSTelemetry::active) +#define FSZoneN( name ) ZoneNamedN( ___tracy_scoped_zone, name, FSTelemetry::active) +#define FSZoneC( color ) ZoneNamedC( ___tracy_scoped_zone, color, FSTelemetry::active) +#define FSZoneNC( name, color ) ZoneNamedNC( ___tracy_scoped_zone, name, color, FSTelemetry::active) #define FSPlot( name, value ) TracyPlot( name, value) #define FSFrameMark FrameMark +#define FSTelemetryIsConnected TracyIsConnected #else #define FSZone #define FSZoneN( name ) -#define FSZoneC(color) -#define FSZoneNC(name, color) +#define FSZoneC( color ) +#define FSZoneNC( name, color ) #define FSPlot( name, value ) #define FSFrameMark +#define FSTelemetryIsConnected #endif // TRACY_ENABLE + +namespace FSTelemetry +{ + extern bool active; +} + #endif \ No newline at end of file diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 70c0735f35..5bdce0817d 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -41,7 +41,7 @@ // Add Tracy profiler support // #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__); -#include "fsprofiler.h" +#include "fstelemetry.h" #ifdef TRACY_ENABLE // #undef TRACY_NO_FASTTIMERS // Uncomment if you want FASTTIMERS as well. #ifdef TRACY_NO_FASTTIMERS diff --git a/indra/llfilesystem/llfilesystem.cpp b/indra/llfilesystem/llfilesystem.cpp index 4b2b28af80..9d1a4605f3 100644 --- a/indra/llfilesystem/llfilesystem.cpp +++ b/indra/llfilesystem/llfilesystem.cpp @@ -33,7 +33,6 @@ #include "llfilesystem.h" #include "llfasttimer.h" #include "lldiskcache.h" -#include "fsprofiler.h" const S32 LLFileSystem::READ = 0x00000001; const S32 LLFileSystem::WRITE = 0x00000002; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9983a79b54..5f587acf7f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -24628,10 +24628,10 @@ Change of this parameter will affect the layout of buttons in notification toast Value 0 - FSTracyEnableWhenConnected + FSTelemetryEnableWhenConnected Comment - Enable profiling as soon as a server connects + Enable telemetry as soon as a server connects Persist 1 Type @@ -24639,6 +24639,17 @@ Change of this parameter will affect the layout of buttons in notification toast Value 1 + FSTelemetryActive + + Comment + Enable profiling as soon as a server connects. Off by default and non-persistent. Use with FSTelemetryEnableWhenConnected to initiate on startup + Persist + 0 + Type + Boolean + Value + 0 + FSFilterGrowlKeywordDuplicateIMs Comment diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index f16570c2de..0ba8e0ee92 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -282,7 +282,7 @@ #include "fsradar.h" #include "fsassetblacklist.h" -#include "fsprofiler.h" // Tracy profiler support +#include "fstelemetry.h" // Tracy profiler support #if (LL_LINUX || LL_SOLARIS) && LL_GTK #include "glib.h" diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index fd777ad8ff..855e806d35 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -9475,6 +9475,20 @@ class LLAdvancedToggleDoubleClickTeleport: public view_listener_t } }; +// Add telemetry controls to the viewer menus +class FSTelemetryToggleActive : public view_listener_t +{ +protected: + + bool handleEvent(const LLSD& userdata) + { + BOOL checked = gSavedSettings.getBOOL( "FSTelemetryActive" ); + gSavedSettings.setBOOL( "FSTelemetryActive", !checked ); + FSTelemetry::active = !checked; + return true; + } +}; +// void menu_toggle_attached_lights(void* user_data) { LLPipeline::sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights"); @@ -11831,6 +11845,9 @@ void initialize_menus() //Develop (clear cache immediately) commit.add("Develop.ClearCache", boost::bind(&handle_cache_clear_immediately) ); + // Add telemetry controls to the viewer Develop menu (Toggle profiling) + view_listener_t::addMenu(new FSTelemetryToggleActive(), "Develop.ToggleTelemetry"); + // Admin >Object view_listener_t::addMenu(new LLAdminForceTakeCopy(), "Admin.ForceTakeCopy"); view_listener_t::addMenu(new LLAdminHandleObjectOwnerSelf(), "Admin.HandleObjectOwnerSelf"); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index fc5d99a73e..88135aeedb 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3568,6 +3568,32 @@ function="Advanced.ToggleShowObjectUpdates" /> + + + + + + + + + +