From eea75557bcd524f6ae1aca0e8793ec7e9c6c3fe6 Mon Sep 17 00:00:00 2001 From: Beq Date: Thu, 4 Nov 2021 19:58:32 +0000 Subject: [PATCH] Switch to better timers --- indra/newview/fsfloaterperformance.cpp | 3 ++- indra/newview/fsperfstats.h | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/indra/newview/fsfloaterperformance.cpp b/indra/newview/fsfloaterperformance.cpp index 4557891a55..3a3ba823ed 100644 --- a/indra/newview/fsfloaterperformance.cpp +++ b/indra/newview/fsfloaterperformance.cpp @@ -212,11 +212,12 @@ void LLFloaterPerformance::draw() auto fps = LLTrace::get_frame_recording().getPeriodMedianPerSec(LLStatViewer::FPS, NUM_PERIODS); getChild("fps_value")->setValue((S32)llround(fps)); - auto tot_frame_time_ns = NANOS/fps; + // auto tot_frame_time_ns = NANOS/fps; auto target_frame_time_ns = NANOS/(targetFPS==0?1:targetFPS); 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)); // 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.) diff --git a/indra/newview/fsperfstats.h b/indra/newview/fsperfstats.h index 677d4e1419..93a137f86c 100644 --- a/indra/newview/fsperfstats.h +++ b/indra/newview/fsperfstats.h @@ -34,7 +34,7 @@ #include #include #include "lluuid.h" -#include "lltimer.h" +#include "llfasttimer.h" #include "blockingconcurrentqueue.h" #include "llapp.h" #include "fstelemetry.h" @@ -298,7 +298,7 @@ namespace FSPerfStats public: StatsRecord stat; - RecordTime( const LLUUID& av, const LLUUID& id, StatType_t type, bool isRiggedAtt=false):start{LLTimer::getCurrentClockCount()}, + RecordTime( const LLUUID& av, const LLUUID& id, StatType_t type, bool isRiggedAtt=false):start{LLTrace::BlockTimer::getCPUClockCount64()}, stat{type, ObjTypeDiscriminator, std::move(av), std::move(id), 0, isRiggedAtt}{ FSZoneC(tracy::Color::Orange); #ifdef USAGE_TRACKING @@ -364,7 +364,7 @@ namespace FSPerfStats } #endif - stat.time = LLTimer::getCurrentClockCount() - start; + stat.time = LLTrace::BlockTimer::getCPUClockCount64() - start; #ifdef ATTACHMENT_TRACKING static char obstr[36]; @@ -382,9 +382,9 @@ namespace FSPerfStats }; - inline double raw_to_ns(U64 raw) { return (static_cast(raw) * 1000000000.0) * get_timer_info().mClockFrequencyInv; }; - inline double raw_to_us(U64 raw) { return (static_cast(raw) * 1000000.0) * get_timer_info().mClockFrequencyInv; }; - inline double raw_to_ms(U64 raw) { return (static_cast(raw) * 1000.0) * get_timer_info().mClockFrequencyInv; }; + inline double raw_to_ns(U64 raw) { return (static_cast(raw) * 1000000000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); }; + inline double raw_to_us(U64 raw) { return (static_cast(raw) * 1000000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); }; + inline double raw_to_ms(U64 raw) { return (static_cast(raw) * 1000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); }; using RecordSceneTime = RecordTime; using RecordAvatarTime = RecordTime;