mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-18 15:20:05 +00:00
Backport changes from yuzu-emu/yuzu#2806
This commit is contained in:
parent
029cc77c4b
commit
0a3f75c25f
@ -33,13 +33,13 @@ PerfStats::~PerfStats() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::time_t t = std::time(nullptr);
|
||||
const std::time_t t = std::time(nullptr);
|
||||
std::ostringstream stream;
|
||||
std::copy(perf_history.begin() + IgnoreFrames, perf_history.begin() + current_index,
|
||||
std::ostream_iterator<double>(stream, "\n"));
|
||||
std::string path = FileUtil::GetUserPath(FileUtil::UserPath::LogDir);
|
||||
const std::string& path = FileUtil::GetUserPath(FileUtil::UserPath::LogDir);
|
||||
// %F Date format expanded is "%Y-%m-%d"
|
||||
std::string filename =
|
||||
const std::string filename =
|
||||
fmt::format("{}/{:%F-%H-%M}_{:016X}.csv", path, *std::localtime(&t), title_id);
|
||||
FileUtil::IOFile file(filename, "w");
|
||||
file.WriteString(stream.str());
|
||||
@ -74,11 +74,13 @@ void PerfStats::EndGameFrame() {
|
||||
}
|
||||
|
||||
double PerfStats::GetMeanFrametime() {
|
||||
std::lock_guard lock{object_mutex};
|
||||
|
||||
if (current_index <= IgnoreFrames) {
|
||||
return 0;
|
||||
}
|
||||
double sum = std::accumulate(perf_history.begin() + IgnoreFrames,
|
||||
perf_history.begin() + current_index, 0);
|
||||
const double sum = std::accumulate(perf_history.begin() + IgnoreFrames,
|
||||
perf_history.begin() + current_index, 0);
|
||||
return sum / (current_index - IgnoreFrames);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <mutex>
|
||||
#include "common/common_types.h"
|
||||
#include "common/thread.h"
|
||||
|
Loading…
Reference in New Issue
Block a user