profiling cleanup ready to merge back
put proper markers in place where forgotten beforemaster
parent
eb0bfc9e10
commit
2ce328282a
|
|
@ -1,12 +1,42 @@
|
|||
#pragma once
|
||||
#ifndef FS_TELEMETRY_H_INCLUDED
|
||||
#define FS_TELEMETRY_H_INCLUDED
|
||||
/**
|
||||
* @file fstelemetry.h
|
||||
* @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$
|
||||
*/
|
||||
|
||||
// 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.
|
||||
|
||||
#ifdef TRACY_ENABLE
|
||||
// generic switch (in case we ever add others or incorporate commercial tools like RAD Games if LL were to share a license)
|
||||
// turn off in the else statement below.
|
||||
#define FS_HAS_TELEMETRY_SUPPORT
|
||||
|
||||
#ifdef TRACY_ENABLE // (Tracy open source telemetry)
|
||||
#include "Tracy.hpp"
|
||||
|
||||
#define FSZone ZoneNamed( ___tracy_scoped_zone, FSTelemetry::active)
|
||||
|
|
@ -17,7 +47,10 @@
|
|||
#define FSFrameMark FrameMark
|
||||
#define FSTelemetryIsConnected TracyIsConnected
|
||||
|
||||
#else
|
||||
#else // (no telemetry)
|
||||
|
||||
// No we don't want no stinkin' telemetry. move along
|
||||
#undef FS_HAS_TELEMETRY_SUPPORT
|
||||
|
||||
#define FSZone
|
||||
#define FSZoneN( name )
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ LLFileSystem::~LLFileSystem()
|
|||
// static
|
||||
bool LLFileSystem::getExists(const LLUUID& file_id, const LLAssetType::EType file_type)
|
||||
{
|
||||
FSZoneC(tracy::Color::Gold);
|
||||
FSZoneC(tracy::Color::Gold); // <FS:Beq> measure cache performance
|
||||
std::string id_str;
|
||||
file_id.toString(id_str);
|
||||
const std::string extra_info = "";
|
||||
|
|
@ -86,7 +86,7 @@ bool LLFileSystem::getExists(const LLUUID& file_id, const LLAssetType::EType fil
|
|||
bool LLFileSystem::removeFile(const LLUUID& file_id, const LLAssetType::EType file_type, int suppress_error /*= 0*/)
|
||||
// </FS:Ansariel>
|
||||
{
|
||||
FSZoneC(tracy::Color::Gold);
|
||||
FSZoneC(tracy::Color::Gold); // <FS:Beq> measure cache performance
|
||||
std::string id_str;
|
||||
file_id.toString(id_str);
|
||||
const std::string extra_info = "";
|
||||
|
|
@ -104,8 +104,7 @@ bool LLFileSystem::removeFile(const LLUUID& file_id, const LLAssetType::EType fi
|
|||
bool LLFileSystem::renameFile(const LLUUID& old_file_id, const LLAssetType::EType old_file_type,
|
||||
const LLUUID& new_file_id, const LLAssetType::EType new_file_type)
|
||||
{
|
||||
FSZoneC(tracy::Color::Gold);
|
||||
;
|
||||
FSZoneC(tracy::Color::Gold); // <FS:Beq> measure cache performance
|
||||
std::string old_id_str;
|
||||
old_file_id.toString(old_id_str);
|
||||
const std::string extra_info = "";
|
||||
|
|
@ -136,8 +135,7 @@ bool LLFileSystem::renameFile(const LLUUID& old_file_id, const LLAssetType::ETyp
|
|||
// static
|
||||
S32 LLFileSystem::getFileSize(const LLUUID& file_id, const LLAssetType::EType file_type)
|
||||
{
|
||||
FSZoneC(tracy::Color::Gold);
|
||||
;
|
||||
FSZoneC(tracy::Color::Gold); // <FS:Beq> measure cache performance
|
||||
std::string id_str;
|
||||
file_id.toString(id_str);
|
||||
const std::string extra_info = "";
|
||||
|
|
@ -163,8 +161,7 @@ S32 LLFileSystem::getFileSize(const LLUUID& file_id, const LLAssetType::EType fi
|
|||
|
||||
BOOL LLFileSystem::read(U8* buffer, S32 bytes)
|
||||
{
|
||||
FSZoneC(tracy::Color::Gold);
|
||||
;
|
||||
FSZoneC(tracy::Color::Gold); // <FS:Beq> measure cache performance
|
||||
BOOL success = TRUE;
|
||||
|
||||
std::string id;
|
||||
|
|
@ -223,22 +220,19 @@ BOOL LLFileSystem::read(U8* buffer, S32 bytes)
|
|||
|
||||
S32 LLFileSystem::getLastBytesRead()
|
||||
{
|
||||
FSZoneC(tracy::Color::Gold);
|
||||
;
|
||||
FSZoneC(tracy::Color::Gold); // <FS:Beq> measure cache performance
|
||||
return mBytesRead;
|
||||
}
|
||||
|
||||
BOOL LLFileSystem::eof()
|
||||
{
|
||||
FSZoneC(tracy::Color::Gold);
|
||||
;
|
||||
FSZoneC(tracy::Color::Gold); // <FS:Beq> measure cache performance
|
||||
return mPosition >= getSize();
|
||||
}
|
||||
|
||||
BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
|
||||
{
|
||||
FSZoneC(tracy::Color::Gold);
|
||||
;
|
||||
FSZoneC(tracy::Color::Gold); // <FS:Beq> measure cache performance
|
||||
std::string id_str;
|
||||
mFileID.toString(id_str);
|
||||
const std::string extra_info = "";
|
||||
|
|
@ -348,8 +342,7 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
|
|||
|
||||
BOOL LLFileSystem::seek(S32 offset, S32 origin)
|
||||
{
|
||||
FSZoneC(tracy::Color::Gold);
|
||||
;
|
||||
FSZoneC(tracy::Color::Gold); // <FS:Beq> measure cache performance
|
||||
if (-1 == origin)
|
||||
{
|
||||
origin = mPosition;
|
||||
|
|
@ -380,30 +373,26 @@ BOOL LLFileSystem::seek(S32 offset, S32 origin)
|
|||
|
||||
S32 LLFileSystem::tell() const
|
||||
{
|
||||
FSZoneC(tracy::Color::Gold);
|
||||
;
|
||||
FSZoneC(tracy::Color::Gold); // <FS:Beq> measure cache performance
|
||||
return mPosition;
|
||||
}
|
||||
|
||||
S32 LLFileSystem::getSize()
|
||||
{
|
||||
FSZoneC(tracy::Color::Gold);
|
||||
;
|
||||
FSZoneC(tracy::Color::Gold); // <FS:Beq> measure cache performance
|
||||
return LLFileSystem::getFileSize(mFileID, mFileType);
|
||||
}
|
||||
|
||||
S32 LLFileSystem::getMaxSize()
|
||||
{
|
||||
FSZoneC(tracy::Color::Gold);
|
||||
;
|
||||
FSZoneC(tracy::Color::Gold); // <FS:Beq> measure cache performance
|
||||
// offer up a huge size since we don't care what the max is
|
||||
return INT_MAX;
|
||||
}
|
||||
|
||||
BOOL LLFileSystem::rename(const LLUUID& new_id, const LLAssetType::EType new_type)
|
||||
{
|
||||
FSZoneC(tracy::Color::Gold);
|
||||
;
|
||||
FSZoneC(tracy::Color::Gold); // <FS:Beq> measure cache performance
|
||||
LLFileSystem::renameFile(mFileID, mFileType, new_id, new_type);
|
||||
|
||||
mFileID = new_id;
|
||||
|
|
@ -414,8 +403,7 @@ BOOL LLFileSystem::rename(const LLUUID& new_id, const LLAssetType::EType new_typ
|
|||
|
||||
BOOL LLFileSystem::remove()
|
||||
{
|
||||
FSZoneC(tracy::Color::Gold);
|
||||
;
|
||||
FSZoneC(tracy::Color::Gold); // <FS:Beq> measure cache performance
|
||||
LLFileSystem::removeFile(mFileID, mFileType);
|
||||
|
||||
return TRUE;
|
||||
|
|
|
|||
|
|
@ -1654,17 +1654,24 @@ bool LLAppViewer::doFrame()
|
|||
{
|
||||
LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop"));
|
||||
LLSD newFrame;
|
||||
// <FS:Beq> Tracy enabling
|
||||
#ifdef TRACY_ENABLE
|
||||
// <FS:Beq> telemetry enabling.
|
||||
// This ifdef is optional but better to avoid even low overhead code in main loop where not needed.
|
||||
#ifdef FS_HAS_TELEMETRY_SUPPORT
|
||||
static bool one_time{false};
|
||||
static LLCachedControl<bool> tracy_enable_when_connected(gSavedSettings, "FSTracyEnableWhenConnected");
|
||||
static LLCachedControl<bool> profiling_enabled_when_connected(gSavedSettings, "FSTelemetryEnableWhenConnected");
|
||||
if( !one_time && (gFrameCount % 10 == 0) )
|
||||
{
|
||||
if(!FSProfiler::active && tracy_enable_when_connected && TracyIsConnected)
|
||||
if(!FSTelemetry::active && profiling_enabled_when_connected && FSTelemetryIsConnected)
|
||||
{
|
||||
FSProfiler::active = true;
|
||||
FSTelemetry::active = true;
|
||||
gSavedSettings.setBOOL("FSTelemetryActive", TRUE); // keep the setting in sync.
|
||||
one_time=true; // prevent reset race if we disable manually.
|
||||
LL_INFOS() << "Tracy profiler or collector connected" << LL_ENDL;
|
||||
LL_INFOS() << "Profiler or collector connected" << LL_ENDL;
|
||||
}
|
||||
else if(!profiling_enabled_when_connected)
|
||||
{
|
||||
// no point in checking if we are not waiting.
|
||||
one_time = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue