Minor fiddling with perfstats
parent
c53730b3dd
commit
0ebdc31cf1
|
|
@ -70,7 +70,7 @@ constexpr auto SceneType {FSPerfStats::ObjType_t::OT_GENERAL};
|
|||
class FSExceptionsContextMenu : public LLListContextMenu
|
||||
{
|
||||
public:
|
||||
FSExceptionsContextMenu(FSFloaterPerformance* floater_settings)
|
||||
explicit FSExceptionsContextMenu(FSFloaterPerformance* floater_settings)
|
||||
: mFloaterPerformance(floater_settings)
|
||||
{}
|
||||
protected:
|
||||
|
|
@ -250,11 +250,13 @@ void FSFloaterPerformance::draw()
|
|||
|
||||
FSPerfStats::bufferToggleLock.lock(); // prevent toggle for a moment
|
||||
|
||||
auto tot_frame_time_ns = FSPerfStats::raw_to_ns(FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_FRAME));
|
||||
|
||||
auto tot_frame_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_FRAME);
|
||||
// cumulative avatar time (includes idle processing, attachments and base av)
|
||||
auto tot_avatar_time_raw = FSPerfStats::StatsRecorder::getSum(AvType, FSPerfStats::StatType_t::RENDER_COMBINED);
|
||||
// cumulative avatar render specific time (a bit arbitrary as the processing is too.)
|
||||
auto tot_avatar_render_time_raw = tot_avatar_time_raw - FSPerfStats::StatsRecorder::getSum(AvType, FSPerfStats::StatType_t::RENDER_IDLE);
|
||||
// auto tot_av_idle_time_raw = FSPerfStats::StatsRecorder::getSum(AvType, FSPerfStats::StatType_t::RENDER_IDLE);
|
||||
// auto tot_avatar_render_time_raw = tot_avatar_time_raw - tot_av_idle_time_raw;
|
||||
// the time spent this frame on the "display()" call. Treated as "tot time rendering"
|
||||
auto tot_render_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_DISPLAY);
|
||||
// sleep time is basically forced sleep when window out of focus
|
||||
|
|
@ -263,8 +265,8 @@ void FSFloaterPerformance::draw()
|
|||
auto tot_ui_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_UI);
|
||||
// cumulative time spent rendering HUDS
|
||||
auto tot_huds_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_HUDS);
|
||||
// "idle" time. This is the time spent in the idle poll section of the main loop, we DO remove the avatar idle time as the avatar number we display is the total avatar time inclusive of idle processing.
|
||||
auto tot_idle_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_IDLE) - FSPerfStats::StatsRecorder::getSum(AvType, FSPerfStats::StatType_t::RENDER_IDLE);
|
||||
// "idle" time. This is the time spent in the idle poll section of the main loop
|
||||
auto tot_idle_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_IDLE);
|
||||
// similar to sleep time, induced by FPS limit
|
||||
auto tot_limit_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_FPSLIMIT);
|
||||
// swap time is time spent in swap buffer
|
||||
|
|
@ -273,6 +275,7 @@ void FSFloaterPerformance::draw()
|
|||
FSPerfStats::bufferToggleLock.unlock();
|
||||
|
||||
auto unreliable = false; // if there is something to skew the stats such as sleep of fps cap
|
||||
auto tot_frame_time_ns = FSPerfStats::raw_to_ns(tot_frame_time_raw);
|
||||
auto tot_avatar_time_ns = FSPerfStats::raw_to_ns( tot_avatar_time_raw );
|
||||
auto tot_huds_time_ns = FSPerfStats::raw_to_ns( tot_huds_time_raw );
|
||||
// UI time includes HUD time so dedut that before we calc percentages
|
||||
|
|
@ -282,10 +285,10 @@ void FSFloaterPerformance::draw()
|
|||
// auto tot_limit_time_ns = FSPerfStats::raw_to_ns( tot_limit_time_raw );
|
||||
|
||||
// auto tot_render_time_ns = FSPerfStats::raw_to_ns( tot_render_time_raw );
|
||||
auto tot_idle_time_ns = FSPerfStats::raw_to_ns( tot_idle_time_raw );
|
||||
auto tot_swap_time_ns = FSPerfStats::raw_to_ns( tot_swap_time_raw );
|
||||
auto tot_scene_time_ns = FSPerfStats::raw_to_ns( tot_render_time_raw - tot_avatar_render_time_raw - tot_swap_time_raw - tot_ui_time_raw);
|
||||
|
||||
auto tot_idle_time_ns = FSPerfStats::raw_to_ns( tot_idle_time_raw );
|
||||
auto tot_swap_time_ns = FSPerfStats::raw_to_ns( tot_swap_time_raw );
|
||||
auto tot_scene_time_ns = FSPerfStats::raw_to_ns( tot_render_time_raw - tot_avatar_time_raw - tot_swap_time_raw - tot_ui_time_raw);
|
||||
// auto tot_overhead_time_ns = FSPerfStats::raw_to_ns( tot_frame_time_raw - tot_render_time_raw - tot_idle_time_raw );
|
||||
|
||||
// // remove time spent sleeping for fps limit or out of focus.
|
||||
// tot_frame_time_ns -= tot_limit_time_ns;
|
||||
|
|
|
|||
|
|
@ -222,14 +222,14 @@ namespace FSPerfStats
|
|||
|
||||
// clean the write maps in all cases.
|
||||
auto& statsTypeMatrix = statsDoubleBuffer[writeBuffer];
|
||||
for(auto& statsMap : statsTypeMatrix)
|
||||
for(auto& statsMapByType : statsTypeMatrix)
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_STATS("Clear stats maps");
|
||||
for(auto& stat_entry : statsMap)
|
||||
for(auto& stat_entry : statsMapByType)
|
||||
{
|
||||
std::fill_n(stat_entry.second.begin() ,static_cast<size_t>(ST::STATS_COUNT),0);
|
||||
}
|
||||
statsMap.clear();
|
||||
statsMapByType.clear();
|
||||
}
|
||||
for(int i=0; i< static_cast<size_t>(ObjType_t::OT_COUNT); i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -186,15 +186,15 @@ namespace FSPerfStats
|
|||
return instance;
|
||||
}
|
||||
static inline void setFocusAv(const LLUUID& avID){focusAv = avID;};
|
||||
static inline const LLUUID& getFocusAv(){return (focusAv);};
|
||||
static inline void send(StatsRecord&& u){StatsRecorder::getInstance().q.enqueue(std::move(u));};
|
||||
static inline const LLUUID& getFocusAv(){return focusAv;};
|
||||
static inline void send(StatsRecord && upd){StatsRecorder::getInstance().q.enqueue(std::move(upd));};
|
||||
static void endFrame(){StatsRecorder::getInstance().q.enqueue(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 0});};
|
||||
static void clearStats(){StatsRecorder::getInstance().q.enqueue(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 1});};
|
||||
|
||||
static inline void setEnabled(bool on_or_off){collectionEnabled=on_or_off;};
|
||||
static inline void enable() { collectionEnabled=true; };
|
||||
static inline void disable() { collectionEnabled=false; };
|
||||
static inline bool enabled() { return(collectionEnabled); };
|
||||
static inline bool enabled() { return collectionEnabled; };
|
||||
|
||||
static inline int getReadBufferIndex() { return (writeBuffer ^ 1); };
|
||||
// static inline const StatsTypeMatrix& getCurrentStatsMatrix(){ return statsDoubleBuffer[getReadBufferIndex()];}
|
||||
|
|
@ -234,7 +234,7 @@ namespace FSPerfStats
|
|||
static bool collectionEnabled;
|
||||
|
||||
|
||||
void processUpdate(const StatsRecord& upd)
|
||||
void processUpdate(const StatsRecord& upd) const
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
|
||||
// LL_INFOS("perfstats") << "processing update:" << LL_ENDL;
|
||||
|
|
@ -339,7 +339,7 @@ namespace FSPerfStats
|
|||
static void run()
|
||||
{
|
||||
StatsRecord upd[10];
|
||||
auto& instance {StatsRecorder::getInstance()};
|
||||
auto & instance {StatsRecorder::getInstance()};
|
||||
LL_PROFILER_SET_THREAD_NAME("PerfStats");
|
||||
|
||||
while( enabled() && !LLApp::isExiting() )
|
||||
|
|
@ -409,7 +409,7 @@ namespace FSPerfStats
|
|||
|
||||
template < ObjType_t OD = ObjTypeDiscriminator,
|
||||
std::enable_if_t<OD == ObjType_t::OT_GENERAL> * = nullptr>
|
||||
RecordTime( StatType_t type ):RecordTime<ObjTypeDiscriminator>(LLUUID::null, LLUUID::null, type )
|
||||
explicit RecordTime( StatType_t type ):RecordTime<ObjTypeDiscriminator>(LLUUID::null, LLUUID::null, type )
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
|
||||
#ifdef USAGE_TRACKING
|
||||
|
|
@ -504,6 +504,7 @@ namespace FSPerfStats
|
|||
|
||||
// helper functions
|
||||
using RATptr = std::unique_ptr<FSPerfStats::RecordAttachmentTime>;
|
||||
using RSTptr = std::unique_ptr<FSPerfStats::RecordSceneTime>;
|
||||
|
||||
template <typename T>
|
||||
static inline void trackAttachments(const T * vobj, bool isRigged, RATptr* ratPtrp)
|
||||
|
|
@ -544,11 +545,12 @@ static inline void trackAttachments(const T * vobj, bool isRigged, RATptr* ratPt
|
|||
// deliberately reset to ensure destruction before construction of replacement.
|
||||
ratPtrp->reset();
|
||||
};
|
||||
*ratPtrp = std::make_unique<FSPerfStats::RecordAttachmentTime>( av,
|
||||
obj,
|
||||
( (LLPipeline::sShadowRender)?FSPerfStats::StatType_t::RENDER_SHADOWS : FSPerfStats::StatType_t::RENDER_GEOMETRY ),
|
||||
isRigged,
|
||||
rootAtt->isHUDAttachment());
|
||||
*ratPtrp = std::make_unique<FSPerfStats::RecordAttachmentTime>(
|
||||
av,
|
||||
obj,
|
||||
( LLPipeline::sShadowRender?FSPerfStats::StatType_t::RENDER_SHADOWS : FSPerfStats::StatType_t::RENDER_GEOMETRY ),
|
||||
isRigged,
|
||||
rootAtt->isHUDAttachment());
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue