FIRE-31942 - Crash in 360 photo with perfstats running

Sigh...even the simplest things in LL land are non-thread safe it seems.
meow-7.2.2
Beq 2022-08-16 18:05:22 +01:00
parent 67de000421
commit 461c512b97
2 changed files with 9 additions and 4 deletions

View File

@ -53,6 +53,8 @@ namespace FSPerfStats
U32 lastGlobalPrefChange{0};
std::mutex bufferToggleLock{};
F64 cpu_hertz{0.0};
Tunables tunables;
std::atomic<int> StatsRecorder::writeBuffer{0};
@ -342,7 +344,7 @@ namespace FSPerfStats
}
// The frametime budget we have based on the target FPS selected
auto target_frame_time_raw = (U64)llround((F64)LLTrace::BlockTimer::countsPerSecond()/(tunables.userTargetFPS==0?1:tunables.userTargetFPS));
auto target_frame_time_raw = (U64)llround(FSPerfStats::cpu_hertz/(tunables.userTargetFPS==0?1:tunables.userTargetFPS));
// LL_INFOS() << "Effective FPS(raw):" << tot_frame_time_raw << " Target:" << target_frame_time_raw << LL_ENDL;
auto inferredFPS{1000/(U32)std::max(raw_to_ms(tot_frame_time_raw),1.0)};
U32 settingsChangeFrequency{inferredFPS > 25?inferredFPS:25};

View File

@ -76,6 +76,8 @@ namespace FSPerfStats
static constexpr U32 TUNE_AVATARS_ONLY{0};
static constexpr U32 TUNE_SCENE_AND_AVATARS{1};
extern F64 cpu_hertz;
extern std::atomic<int64_t> tunedAvatars;
extern std::atomic<U64> renderAvatarMaxART_ns;
extern bool belowTargetFPS;
@ -183,6 +185,7 @@ namespace FSPerfStats
static inline StatsRecorder& getInstance()
{
static StatsRecorder instance;
FSPerfStats::cpu_hertz = (F64)LLTrace::BlockTimer::countsPerSecond();
return instance;
}
static inline void setFocusAv(const LLUUID& avID){focusAv = avID;};
@ -491,9 +494,9 @@ namespace FSPerfStats
};
inline double raw_to_ns(U64 raw) { return (static_cast<double>(raw) * 1000000000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); };
inline double raw_to_us(U64 raw) { return (static_cast<double>(raw) * 1000000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); };
inline double raw_to_ms(U64 raw) { return (static_cast<double>(raw) * 1000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); };
inline double raw_to_ns(U64 raw) { return (static_cast<double>(raw) * 1000000000.0) / FSPerfStats::cpu_hertz; };
inline double raw_to_us(U64 raw) { return (static_cast<double>(raw) * 1000000.0) / FSPerfStats::cpu_hertz; };
inline double raw_to_ms(U64 raw) { return (static_cast<double>(raw) * 1000.0) / FSPerfStats::cpu_hertz; };
using RecordSceneTime = RecordTime<ObjType_t::OT_GENERAL>;
using RecordAvatarTime = RecordTime<ObjType_t::OT_AVATAR>;